I am migrating to .net9 and I got this exception when running my test assemblies built with .net9. I am using version nunit3-console 3.19.2 (net8.0)
Unhandled exception. System.MissingMethodException: Method not found: 'System.TimeSpan System.TimeSpan.FromMilliseconds(Int64, Int64)'.
at System.Windows.Threading.Dispatcher.Invoke(DispatcherPriority priority, Delegate method, Object arg)
at MS.Win32.HwndSubclass.SubclassWndProc(IntPtr hwnd, Int32 msg, IntPtr wParam, IntPtr lParam)
For other ppl struggling with that - I was able to workaround the error by editing nunit3-console.runtimeconfig.json and manually setting tfm and version to net9.0
and 9.0.0
{
"runtimeOptions": {
"tfm": "net9.0",
"rollForward": "Major",
"framework": {
"name": "Microsoft.NETCore.App",
"version": "9.0.0"
},
"configProperties": {
"System.Reflection.Metadata.MetadataUpdater.IsSupported": false,
"System.Runtime.Serialization.EnableUnsafeBinaryFormatterSerialization": false
}
}
}
This make nunit3-console.exe to use .net9 to run the tests. I believe this happens because there were new overloads of TimeSpan added in .net9 and when the code make use of them, this happens.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4