Closed jonthysell closed 1 month ago
This appears to be a recurring phenomenon with VS upgrades, see #10155.
As this looks similar to what cropped up 2 years ago: https://github.com/microsoft/react-native-windows/issues/10155#issuecomment-1160741015
@srdjanjovcic could you please take a look? It looks like DeployAppRecipe is failing again.
Do you have any idea on this one? I'm on 17.10.2, should I install a different version?
VS Profesional fixed version 17.9.7 is working for me, you can find it here https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history
The problem appears to be a bug in the DeployAppRecipe.exe
tool we use to deploy the app. I can repro the error by calling it directly with our appxrecipe:
"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\Common7\IDE\DeployAppRecipe.exe" "E:\code\rnw\packages\e2e-test-app\windows\RNTesterApp\bin\x64\Debug\RNTesterApp.build.appxrecipe"
ERROR: ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetExports(ImportDefinition definition)
at System.ComponentModel.Composition.Hosting.AggregateCatalog.GetExports(ImportDefinition definition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.InternalGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExports(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExports(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.TryGetExports(ExportProvider provider, ComposablePart part, ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportSubset(PartManager partManager, IEnumerable`1 imports, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.TryPreviewImportsStateMachine(PartManager partManager, ComposablePart part, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.PreviewImports(ComposablePart part, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.Compose(CompositionBatch batch)
at Microsoft.VisualStudio.Deployment.Deployer.Deploy()
ERROR: Exceptions from the reflection loader:
ERROR: FileLoadException: Could not load file or assembly 'NuGet.VisualStudio.Contracts, Version=17.10.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
ERROR: ArgumentNullException: Value cannot be null.
Parameter name: format
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.Format(IFormatProvider provider, String format, Object[] args)
at System.IO.TextWriter.WriteLine(String format, Object[] arg)
at System.IO.TextWriter.SyncTextWriter.WriteLine(String format, Object[] arg)
at System.Console.WriteLine(String format, Object[] arg)
at Microsoft.VisualStudio.Deployment.Deployer.Microsoft.VisualStudio.Deployment.ILoggerSink.Log(Level level, String format, Object[] args)
at Microsoft.VisualStudio.Deployment.Deployer.Deploy()
We're currently working on a solution with the Visual Studio team, the best current workaround is at the top of the bug description.
The bug appears to be fixed in the next VS 2022 Preview release, version 17.11.0, but that's not out yet and it has its own issues: https://github.com/microsoft/react-native-windows/issues/13374
This fix for this will be in VS 17.10.4.
Is there any ETA on when 17.10.4 will be out? The cadence is somewhat irregular according to this.
Current Workaround: You can still open and deploy the app manually using Visual Studio. As long as Metro is running with yarn start you can then open your app's windows\YourAppName.sln file and press F5 to build and deploy the app successfully.
Does this workaround work fine for you guys when building a release? This seems to work fine when in debug mode, but when I'm trying to make an actual release, I'm getting this issue at the end (@jonthysell):
√ Building Solution
√ Enabling Developer Mode
‼ No package found in *_Release_* folder, removing the _Release_ prefix and checking again
ERROR: ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetExports(ImportDefinition definition)
at System.ComponentModel.Composition.Hosting.AggregateCatalog.GetExports(ImportDefinition definition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.InternalGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExports(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.TryGetExports(ExportProvider provider, ComposablePart part, ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportSubset(PartManager partManager, IEnumerable`1 imports, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.TryPreviewImportsStateMachine(PartManager partManager, ComposablePart part, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.PreviewImports(ComposablePart part, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.Compose(CompositionBatch batch)
at Microsoft.VisualStudio.Deployment.Deployer.Deploy()
ERROR: Exceptions from the reflection loader:
ERROR: FileLoadException: Could not load file or assembly 'NuGet.VisualStudio.Contracts, Version=17.10.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
ERROR: ArgumentNullException: Value cannot be null.
Parameter name: format
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.Format(IFormatProvider provider, String format, Object[] args)
at System.IO.TextWriter.WriteLine(String format, Object[] arg)
at System.IO.TextWriter.SyncTextWriter.WriteLine(String format, Object[] arg)
at System.Console.WriteLine(String format, Object[] arg)
at Microsoft.VisualStudio.Deployment.Deployer.Microsoft.VisualStudio.Deployment.ILoggerSink.Log(Level level, String format, Object[] args)
at Microsoft.VisualStudio.Deployment.Deployer.Deploy()
× Deploying
× Failed to deploy: Deploying C:/SoftwareProjects/app1-react-native/app1/windows/x64/Release/app1/app1.build.appxrecipe - exit error code 100
× It is possible your installation is missing required software dependencies. Dependencies can be automatically installed by running C:\SoftwareProjects\app1-react-native\app1\node_modules\react-native-windows\scripts\rnw-dependencies.ps1 from an elevated PowerShell prompt.
For more information, go to http://aka.ms/rnw-deps
i Gathering MSBuild data for telemetry.
i Loading properties from msbuildproperties.g.json
Command failed with error DeployRecipeFailure: Deploying C:/SoftwareProjects/app1-react-native/app1/windows/x64/Release/app1/app1.build.appxrecipe - exit error code 100
Your telemetry sessionId was c15787cb59922220a86da1467366cc0e```
Fixed with the new version, until next update then it will break.
Tried to bump us to 17.10.4, but it looks like it breaks our native unit tests: https://developercommunity.visualstudio.com/t/VS2022-17101-throws-an-error-in-Azure-/10678969
So end users should be unblocked by 17.10.4, but we can't update the repo until maybe 17.10.5.
:(
I am on version 17.10.5 and I still have the same problem.
Alternative solution to waiting for a new version ?
You have to let it fail, then open Visual Studio without closing the window that comes up, and then hit deploy in vs and it will put an entry in your start menu that will work. That's what I do. Please give us normal exe's in the future this is rediculous.
I am on version 17.10.5 and I still have the same problem.
Alternative solution to waiting for a new version ?
sigh Confirming that 17.10.5 breaks it again. :(
ERROR: ReflectionTypeLoadException: Unable to load one or more of the requested types. Retrieve the LoaderExceptions property for more information.
at System.Reflection.RuntimeModule.GetTypes(RuntimeModule module)
ERROR: Exceptions from the reflection loader:
at System.Reflection.RuntimeModule.GetTypes()
at System.Reflection.Assembly.GetTypes()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.get_InnerCatalog()
at System.ComponentModel.Composition.Hosting.AssemblyCatalog.GetExports(ImportDefinition definition)
at System.ComponentModel.Composition.Hosting.AggregateCatalog.GetExports(ImportDefinition definition)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.InternalGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExports(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.CatalogExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.AggregateExportProvider.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExports(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.CompositionContainer.GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ExportProvider.TryGetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition, IEnumerable`1& exports)
at System.ComponentModel.Composition.Hosting.ExportProvider.GetExports(ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.TryGetExports(ExportProvider provider, ComposablePart part, ImportDefinition definition, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.TrySatisfyImportSubset(PartManager partManager, IEnumerable`1 imports, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.TryPreviewImportsStateMachine(PartManager partManager, ComposablePart part, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ImportEngine.PreviewImports(ComposablePart part, AtomicComposition atomicComposition)
at System.ComponentModel.Composition.Hosting.ComposablePartExportProvider.Compose(CompositionBatch batch)
at Microsoft.VisualStudio.Deployment.Deployer.Deploy()
ERROR: FileLoadException: Could not load file or assembly 'NuGet.VisualStudio.Contracts, Version=17.10.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)
ERROR: ArgumentNullException: Value cannot be null.
Parameter name: format
at System.String.FormatHelper(IFormatProvider provider, String format, ParamsArray args)
at System.String.Format(IFormatProvider provider, String format, Object[] args)
at System.IO.TextWriter.WriteLine(String format, Object[] arg)
at System.IO.TextWriter.SyncTextWriter.WriteLine(String format, Object[] arg)
at System.Console.WriteLine(String format, Object[] arg)
at Microsoft.VisualStudio.Deployment.Deployer.Microsoft.VisualStudio.Deployment.ILoggerSink.Log(Level level, String format, Object[] args)
at Microsoft.VisualStudio.Deployment.Deployer.Deploy()
I don't understand how this is happening, can someone explain?
Unfortunately, fix in 17.10.4 was a partial one, and we received another dependency update in 17.10.5, regressing us. Proper fix is deployed to 17.10.7, 17.11.0 (available yesterday), and Preview 17.12.
Sorry for the randomization, and hope that you can move to latest public release (17.11.0) with a fix.
I have confirmed that 17.11.0 fixes this issue (and other outstanding VS issues) for us. I'm updating our CI images to 17.11.0 now and PR #13455 will bump our dependency script to make sure you have 17.11.0 installed, but everyone should be safe to upgrade to 17.11.0 now. Sorry that this took so long to figure out.
I don't understand how this is happening, can someone explain?
At the end of run-windows
we call Visual Studio's DeployAppRecipe.exe
tool in order to deploy (install) the newly built app to your system. Unfortunately there was some regression in that tool in newer VS 2022 versions (17.10.0-17.10.3, ~17.10.4~, 17.10.5) that broke us.
I see, well thanks guys keep up the great work!
This bug was finally fixed in VS 17.11.0. Please upgrade to VS 17.11.0. Previous workaround below:
Problem Description
Trying to build/launch/deploy a RNW app with
run-windows
gives the following error:Steps To Reproduce
npx react-native run-windows --logging
in an RNW appExpected Results
App deploys and launches
CLI version
14.0.0-alpha.2
Environment
Community Modules
No response
Target Platform Version
10.0.22621
Target Device(s)
Desktop
Visual Studio Version
Visual Studio 2022
Build Configuration
Debug
Snack, code example, screenshot, or link to a repository
No response