Skip to content
This repository has been archived by the owner on Mar 30, 2019. It is now read-only.

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

Open
SDeepika285 opened this issue Oct 26, 2018 · 2 comments

Comments

@SDeepika285
Copy link

SDeepika285 commented Oct 26, 2018

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
Copy link

h1cks commented Feb 11, 2019

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

@ericjpeters
Copy link

ericjpeters commented Mar 29, 2019

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.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants