0

I have an SPFx package developed for the SharePoint Subscription edition. I deployed multiple version of this package and never had an issue. But today, suddenly, when deploying a new version I started getting this error:

Invalid SharePoint App package. Error: The type initializer for 'MS.Utility.EventTrace' threw an exception

enter image description here

ULS Log

Caught an exception while updating the properties of SharePoint App package AppCatalog/onprem-news.sppkg. Error: There were errors when validating the App package: Invalid SharePoint App package. Error: The type initializer for 'MS.Utility.EventTrace' threw an exception. Stack Trace:
at Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.SPCorporateCatalogEventReceiver.PromoteProperties(SPListItem listItem, Stream packageStream, Boolean addingPackage)
at Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.SPCorporateCatalogEventReceiver.HandleItemAddedOrUpdated(SPListItem listItem, Boolean categoryChanged, Boolean addingPackage, Boolean isDeploying, Boolean beforeIsDeployed, Boolean beforeIsCurrentVersionDeployed) Inner Exception 0: 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__DisplayClass6_0.b__0()
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)
at Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.SPAppPackageHelper.LoadPackage(Stream packageStream)
at Microsoft.SharePoint.Marketplace.CorporateCuratedGallery.SPCorporateCatalogEventReceiver.PromoteProperties(SPListItem listItem, Stream packageStream, Boolean addingPackage) Inner Exception 1: 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() The Zone of the assembly that failed was: MyComputer

Question

Does anyone know how to address this error? I am really confused by why it started happening and why it works in other environments.

Things I tried

  • Deployed the package to two other SharePoint Subscription edition environments. (see the screenshot below)
  • Reverted to the previous versions of the SPFx package and deployed it. Result: same error
  • I re-deployed other SPFx packages that used to work. Result: Same error. It turns out the issue is not related to a specific package. All packages now fail to deploy.

enter image description here

More details

I doubt it is relevant, but:

  • I have a single webpart in the solution enter image description here
  • Package solution file
{
  "$schema": "https://developer.microsoft.com/json-schemas/spfx-build/package-solution.schema.json",
  "solution": {
    "name": "News webpart",
    "id": "777f0b87-9e30-43e1-aa32-6b4eb4e2e1e4",
    "version": "1.0.0.13",
    "includeClientSideAssets": true,
    "skipFeatureDeployment": true
  },
  "paths": {
    "zippedPackage": "solution/onprem-news.sppkg"
  }
}

  • The packaging is done using these commands
Gulp clean
Gulp bundle --ship
Gulp package-solution --ship

1 Answer 1

0

The solution was to recycle the IIS application pool that is responsible for hosting the SharePoint application.

Please, don't bother trying to fix the permission for the registry or change the anonymous authentication settings. This is has nothing to do with this issue.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.