Unit testing with net8.0-windows* framework #18411
Unanswered
jsiemensLatitudegeo
asked this question in
General
Replies: 2 comments
-
Hello I had a similar issue and the only way I found to make it work is to use a separate maui lib project and put all the code there that can be tested... I only validated that with my viewmodels classes but assume it should work for UI classes too... |
Beta Was this translation helpful? Give feedback.
0 replies
-
There's no Unit Test framework for .net v8.0-windows ?!?!?! I'm getting a version error; and can't find any support! Please tell me that's not true.... |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
If I run this code:
Using:
Then I get:
Message:
Test method TestProject2.UnitTest1.TestMethod1 threw exception:
System.TypeInitializationException: The type initializer for 'Microsoft.Maui.Controls.VisualElement' threw an exception. ---> System.TypeInitializationException: The type initializer for 'WinRT.ActivationFactory`1' threw an exception. ---> System.Runtime.InteropServices.COMException: Class not registered (0x80040154 (REGDB_E_CLASSNOTREG))
But if I run it with net8.0 then it works fine. Because of a package dependency I cannot use 'net8.0' (platform neutral framework) - I must use a device framework.
Is there a way to get this code to work? Effectively, I don't want it to go and try to create the VisualElement. I just want it to do the platform neutral thing that it does with net8.0.
Beta Was this translation helpful? Give feedback.
All reactions