I try to add a spfx app(.sppkg file) to SharePoint 2019 on-premise appcatalog. and got the error
Invalid SharePoint App package. Error: The type initializer for 'MS.Utility.EventTrace' threw an exception
Using ULS LogViewer, I found following error stacktrace
Unexpected App Packaging: CreatePackage: Unexpected exception: System.TypeInitializationException: The type initializer for 'MS.Utility.EventTrace' threw an exception. ---> > > > System.Security.SecurityException: Requested registry access is not allowed.
at System.ThrowHelper.ThrowSecurityException(ExceptionResource resource) at Microsoft.Win32.RegistryKey.OpenSubKey(String name, Boolean writable)
at Microsoft.Win32.Registry.GetValue(String keyName, String valueName, Object defaultValue)
at MS.Utility.EventTrace.IsClassicETWRegistryEnabled() at MS.Utility.EventTrace..cctor()
--- End of inner exception stack trace --- at MS.Utility.EventTrace.EasyTraceEvent(Keyword keywords, Event eventID) at System.IO.Packaging.Package.Open(String path, FileMode packageMode, FileAccess packageAccess, FileShare packageShare, Boolean streaming)
at Microsoft.SharePoint.Utilities.SPAppFileSystemUtility.<>c__DisplayClass10.b__f()
at Microsoft.SharePoint.Utilities.SecurityContext.RunAsProcess(CodeToRunElevated secureCode)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(WaitCallback secureCode, Object param)
at Microsoft.SharePoint.SPSecurity.RunWithElevatedPrivileges(CodeToRunElevated secureCode)
at Microsoft.SharePoint.Utilities.SPAppFileSystemUtility.ElevateToReadPackage(String filePath)
at Microsoft.SharePoint.Packaging.SPPackageFactory.CreatePackage(Stream stream, Boolean extract) 67cd01a0-63da-20aa-cc56-871fd3bad25c
This is working in most SharePoint 2019 environment except one.
UAC(User access control) is set to low on SharePoint server and also checked permission on the default regkey for officeserver at HKLM:\Software\Microsoft\OfficeServer\16 and everything looks good.
Thanks