-
Notifications
You must be signed in to change notification settings - Fork 120
Description
Description
When I update the NetProjectionSample project from net6.0-windows10.0.19041.0 to net8.0-windows10.0.19041.0, a System.Runtime.InteropServices.COMException is thrown at runtime. The error message is Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)).
This error occurs in the ConsoleAppSample when trying to create an instance of the SimpleMathComponent.
Steps To Reproduce
- In the ConsoleAppSample project, change the Target Framework in the project file (.csproj) from:
<TargetFramework>net6.0-windows10.0.19041.0</TargetFramework>to<TargetFramework>net8.0-windows10.0.19041.0</TargetFramework> - Also, update the Target Framework for the SimpleMathProjection to
net8.0-windows10.0.19041.0. - Update the Nuget package for the SimpleMathProjection from:
<PackageReference Include="Microsoft.Windows.CsWinRT" VersionOverride="1.3.5" />to<PackageReference Include="Microsoft.Windows.CsWinRT" VersionOverride="2.2.0" /> - Rebuild both solution.
- Run the
ConsoleAppSample.
Expected Behavior
The ConsoleAppSample should run successfully without any exceptions, just as it does when targeting net6.0. The application should be able to activate and use the SimpleMath component.
Version Info
CsWinRT Version: 2.2.0
Target Framework: net8.0-windows10.0.19041.0
Windows SDK Version: 10.0.19041.0
Visual Studio Version: 17.14.8
Additional Context
This issue seems to be related to the .NET 8.0 upgrade. The COM activation of the projected component fails, suggesting a potential issue with how the component is registered or activated in the context of a .NET 8.0 application. The project works perfectly fine on net6.0.