dotMorten / WinUIEx

WinUI Extensions
https://dotmorten.github.io/WinUIEx
MIT License
602 stars 38 forks source link

Error that class is not registered #10

Closed logue closed 3 years ago

logue commented 3 years ago

I cloned it and tried to run it locally, but I get the error System.Reflection.TargetInvocationException: 'Exception has been thrown by the target of an invocation.'.

image The source has not changed. Is there anything missing?

dotMorten commented 3 years ago

When do you get this error? Did you press any buttons in the sample app that caused this? Also enable native debugging, then look at the exception details, inner exceptions and .Data property on those exceptions to get more detail about the problem.

logue commented 3 years ago

The error occurred when I simply Git cloned, opened the sln file and pressed the build button. I shouldn't have changed any settings.

Also enable native debugging, then look at the exception details, inner exceptions and .Data property on those exceptions to get more detail about the problem.

When I clicked the execute button with the native debug function checked, the following error message was displayed. There seemed to be an exception stating that the DLL could not be found.

'WinUIExSample.exe' (CoreCLR: DefaultDomain): 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\5.0.9\System.Private.CoreLib.dll' が読み込まれました。
'WinUIExSample.exe' (CoreCLR: clrhost): 'C:\Users\[user]\source\repos\WinUIEx\src\WinUIExSample\bin\x86\Debug\net5.0-windows10.0.19041.0\WinUIExSample.dll' が読み込まれました。シンボルが読み込まれました。
'WinUIExSample.exe' (CoreCLR: clrhost): 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\5.0.9\System.Runtime.dll' が読み込まれました。
'WinUIExSample.exe' (CoreCLR: clrhost): 'C:\Users\[user]\source\repos\WinUIEx\src\WinUIExSample\bin\x86\Debug\net5.0-windows10.0.19041.0\WinRT.Runtime.dll' が読み込まれました。
'WinUIExSample.exe' (CoreCLR: clrhost): 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\5.0.9\System.Runtime.InteropServices.dll' が読み込まれました。
'WinUIExSample.exe' (CoreCLR: clrhost): 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\5.0.9\System.Collections.dll' が読み込まれました。
'WinUIExSample.exe' (CoreCLR: clrhost): 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\5.0.9\System.Collections.Concurrent.dll' が読み込まれました。
'WinUIExSample.exe' (CoreCLR: clrhost): 'C:\Program Files (x86)\dotnet\shared\Microsoft.NETCore.App\5.0.9\System.Threading.dll' が読み込まれました。
'WinUIExSample.exe' (CoreCLR: clrhost): 'C:\Users\[user]\source\repos\WinUIEx\src\WinUIExSample\bin\x86\Debug\net5.0-windows10.0.19041.0\Microsoft.WinUI.dll' が読み込まれました。
例外がスローされました: 'System.DllNotFoundException' (System.Private.CoreLib.dll の中)
例外がスローされました: 'System.Runtime.InteropServices.COMException' (System.Private.CoreLib.dll の中)
例外がスローされました: 'System.DllNotFoundException' (System.Private.CoreLib.dll の中)
例外がスローされました: 'System.IO.FileNotFoundException' (System.Private.CoreLib.dll の中)
例外がスローされました: 'System.DllNotFoundException' (System.Private.CoreLib.dll の中)
例外がスローされました: 'System.IO.FileNotFoundException' (System.Private.CoreLib.dll の中)
例外がスローされました: 'System.Runtime.InteropServices.COMException' (System.Private.CoreLib.dll の中)
例外がスローされました: 'System.Reflection.TargetInvocationException' (System.Private.CoreLib.dll の中)
型 'System.Reflection.TargetInvocationException' のハンドルされていない例外が System.Private.CoreLib.dll で発生しました
Exception has been thrown by the target of an invocation.

The only thing I was curious about was the error that Microsoft.WindowsAppSDK.Bootstrap.dll was not found when building the solution.

重大度レベル  コード 説明  プロジェクト  ファイル    行   抑制状態
エラー MSB3030 ファイル "C:\Users\[user]\.nuget\packages\microsoft.windowsappsdk.foundation\1.0.0-experimental1\build\..\runtimes\lib\native\AnyCPU\Microsoft.WindowsAppSDK.Bootstrap.dll" は見つからなかったためコピーできません。    WinUIEx C:\Users\[user]\.nuget\packages\microsoft.windowsappsdk.foundation\1.0.0-experimental1\build\Microsoft.WindowsAppSDK.Bootstrap.targets  11  

However, when I built it again, the build passed without any problems.

dotMorten commented 3 years ago

Just to confirm: You set WinUIExSample (Package) as the startup project right?

logue commented 3 years ago

As shown in the figure below, I changed the startup project of the solution to WinUIExSample (Package) and it worked. image

image