System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'
See original GitHub issueDescribe the bug Since updating a project to the latest version of WinUI3 (Reunion 0.5) we receive the following error whenever trying to debug:
System.Reflection.TargetInvocationException
HResult=0x80131604
Message=Exception has been thrown by the target of an invocation.
Source=System.Private.CoreLib
StackTrace:
at System.RuntimeTypeHandle.CreateInstance(RuntimeType type, Boolean publicOnly, Boolean wrapExceptions, Boolean& canBeCached, RuntimeMethodHandleInternal& ctor, Boolean& hasNoDefaultCtor)
at System.RuntimeType.CreateInstanceDefaultCtorSlow(Boolean publicOnly, Boolean wrapExceptions, Boolean fillCache) in /_/src/coreclr/src/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs:line 4005
at System.RuntimeType.CreateInstanceDefaultCtor(Boolean publicOnly, Boolean skipCheckThis, Boolean fillCache, Boolean wrapExceptions) in /_/src/coreclr/src/System.Private.CoreLib/src/System/RuntimeType.CoreCLR.cs:line 4062
at System.Activator.CreateInstance[T]() in /_/src/libraries/System.Private.CoreLib/src/System/Activator.RuntimeType.cs:line 151
at WinRT.WeakLazy`1.get_Value()
at Microsoft.UI.Xaml.Application._IApplicationStatics.get_Instance()
at Microsoft.UI.Xaml.Application.Start(ApplicationInitializationCallback callback)
at Project.Program.Main(String[] args) in C:\Users\USER\Source\Repos\Project\Project.UI\Project.UI\obj\x64\Debug\net5.0-windows10.0.19041.0\App.g.i.cs:line 26
This exception was originally thrown at this call stack:
System.Runtime.InteropServices.Marshal.ThrowExceptionForHR(int) in Marshal.cs
WinRT.BaseActivationFactory.BaseActivationFactory(string, string)
Microsoft.UI.Xaml.Application._IApplicationStatics._IApplicationStatics()
Inner Exception 1:
COMException: Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))
Steps to reproduce the bug We used a project created in WinUI3 v3 and followed the official instructions to upgrade to Reunion 0.5. The original project works as expected until Reunion is installed/WinUI3 removed - then we are unable to run the project with the CLASSNOTREG error.
Expected behavior The project will run as before.
Screenshots
Version Info NuGet package version: Microsoft.ProjectReunion-v0.5.0-prerelease Microsoft.ProjectReunion.Foundation-v0.5.0-prerelease Microsoft.ProjectReunion.WinUI-v0.5.0-prerelease
Windows app type: Win32
Windows 10 version | Saw the problem? |
---|---|
Insider Build (xxxxx) | |
October 2020 Update (19042) | Yes |
May 2020 Update (19041) | |
November 2019 Update (18363) | |
May 2019 Update (18362) | |
October 2018 Update (17763) | |
April 2018 Update (17134) | |
Fall Creators Update (16299) | |
Creators Update (15063) |
Device form factor | Saw the problem? |
---|---|
Desktop | Yes |
Xbox | |
Surface Hub | |
IoT |
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:9 (4 by maintainers)
Top Results From Across the Web
Why I'm getting System.Reflection.TargetInvocationException
Why I'm getting System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.' when downloading images ...
Read more >Exception has been thrown by the target of an invocation - ...
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation · You need to add reference to the system.
Read more >"System.Reflection.TargetInvocationException: Exception ...
TargetInvocationException : Exception has been thrown by the target of an invocation." Was hoping somebody could help me figure out this error.
Read more >System.Reflection.TargetInvocationException: 'Exception ...
I'm getting this exception when I try to create an instance of ... TargetInvocationException: 'Exception has been thrown by the target of an...
Read more >Exception has been thrown by the target of an invocation. -- ...
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.IO.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@Noemata - agreed it’s painful. We plan to remove the wapproj and only need a single project for Desktop apps for Project Reunion’s 0.8 release.
This issue is stale because it has been open 180 days with no activity. Remove stale label or comment or this will be closed in 5 days.