C
C#8mo ago
yambo

The type initializer for '<Module>' threw an exception.

Hello, I am currently unit testing my solution (not much has been programmed at all) and a few days ago all my tests (1 test lol) ran perfectly fine. Today I get this error (i also made another test project with a different testing framework, still same error): System.TypeInitializationException : The type initializer for '<Module>' threw an exception. ---- System.TypeInitializationException : The type initializer for 'WinRT.ActivationFactory1' threw an exception. -------- System.Runtime.InteropServices.COMException : Class not registered (0x80040154 (REGDB_E_CLASSNOTREG)) A friend of mine can also reproduce this error. All we have is a xUnit test project and a MAUI project with one class (no ui implementation at all) Stack Trace:  ItemGroupDTOTests.VerifyItemGroupDTOHoldsInputValues() RuntimeMethodHandle.InvokeMethod(Object target, Void** arguments, Signature sig, Boolean isConstructor) MethodBaseInvoker.InvokeWithNoArgs(Object obj, BindingFlags invokeAttr) ----- Inner Stack Trace ----- ActivationFactory1.ActivateInstanceI DeploymentInitializeOptions.ctor() AutoInitialize.get_Options() line 44 AutoInitialize.AccessWindowsAppSDK() line 30 cctor() ----- Inner Stack Trace ----- Marshal.ThrowExceptionForHR(Int32 errorCode) BaseActivationFactory.ctor(String typeNamespace, String typeFullName) ActivationFactory1.ctor() ActivationFactory1.cctor()
6 Replies
yambo
yamboOP8mo ago
All we do is initialize the constructor with certain parameters If we remove the constructor initialization from the test, the test passes but its really just a plain old constructor initialization and as i said we didnt even change anything since the last time it worked
333fred
333fred8mo ago
I see winrt, I tag @ref *&Sergio
Sergio
Sergio8mo ago
Are you missing an activation manifest?
yambo
yamboOP8mo ago
i dont even know what that is tbh we didnt manipulate anything, only created a class and an according test project on my laptop it worked, and now it also doesnt work (i didnt touch my laptop since the last time the tests were executed successful, only shut it down and booted it up)
yambo
yamboOP8mo ago
were on windows 11, the build settings are the same for the two projects
No description
yambo
yamboOP8mo ago
any heads up? still require help here
Want results from more Discord servers?
Add your server