sharpdx / SharpDX

SharpDX GitHub Repository
http://sharpdx.org
MIT License
1.68k stars 642 forks source link

warning MCG0007: Unresolved P/Invoke method 'kernel32.dll!GetModuleHandle' for meth od 'System.IntPtr SharpDX.DXGI.Kernel32.GetModuleHandle(System.String)'. #1090

Open SDeepika285 opened 5 years ago

SDeepika285 commented 5 years ago

Hi, I have SharpDx and SharpDx.DXGI nugets associated with my visual studio project. But during compilation I am getting the below two warnings.

C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method 'kernel32.dll!LoadLibraryEx' for method 'System.IntPtr SharpDX.DXGI.Kernel32.LoadLibraryEx(System.String, System.IntPtr, SharpDX.DXGI.Kernel32.LoadLibraryFlags)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisify those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.

C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\1.7.3\tools\Microsoft.NetNative.targets(697,5): warning : MCG : warning MCG0007: Unresolved P/Invoke method 'kernel32.dll!GetModuleHandle' for method 'System.IntPtr SharpDX.DXGI.Kernel32.GetModuleHandle(System.String)'. Calling this method would throw exception at runtime. Please make sure the P/Invoke either points to a Windows API allowed in UWP applications, or a native DLL that is part of the package. If for some reason your P/Invoke does not satisify those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs.

How can these be fixed? @xoofx @Ziriax

h1cks commented 5 years ago

Compiling a UWP app with .NET Native toolchain as far as I know does not currently work.

ericjpeters commented 5 years ago

Is there any plan to address this issue?

I'm not sure if it's a show-stopper for me or not, but I must use UWP, really want to use C#/SharpDX, and have a strong feeling that using .NET Native is going to be required of me (perhaps not... I'm not sure at this time).

Update: It seems that The Windows App Certification Kit will not pass my application if SharpDX is using these two PInvokes. So this is a blocker to my use of SharpDX.