-
Notifications
You must be signed in to change notification settings - Fork 758
Description
Repro project: nunitlite-3.12.0-c582df3.zip
To reproduce, download and extract, and then execute msbuild /p:Platform=iPhone /r
This results in a few errors:
Undefined symbols for architecture arm64:
"_GetVersionEx", referenced from:
wrapper_managed_to_native_NUnit_Framework_Internal_OSPlatform_GetVersionEx_NUnit_Framework_Internal_OSPlatform_OSVERSIONINFOEX_ in nunit.framework.dll.o
ld: symbol(s) not found for architecture arm64
MTOUCH : error MT5210: Native linking failed, undefined symbol: _GetVersionEx. Please verify that all the necessary frameworks have been referenced and native libraries are properly linked in. [/Users/rolf/Projects/nunitlite-3.12.0/nunitlite-3.12.0.csproj]
This is the P/Invoke in question:
nunit/src/NUnitFramework/framework/Internal/OSPlatform.cs
Lines 201 to 202 in 35242d4
| [DllImport("Kernel32.dll")] | |
| private static extern bool GetVersionEx(ref OSVERSIONINFOEX osvi); |
This is clearly a Windows-only P/Invoke, since GetVersionEx is a Windows-only function.
For Xamarin.iOS apps it's highly recommended to not have P/Invokes to functions that don't exist on the platform, because otherwise we have to apply a workaround that has a performance impact on the application.
Would it be possible to rework this code somehow so that the NUnit assemblies that are used for Xamarin.iOS (and tvOS/watchOS) don't have this P/Invoke?