title: SEHException in UWP app - attempting to load DLL for an SDK
body: <p>I'm trying to use an <a href="https://www.asus.com/campaign/aura/fl/SDK.html" rel="nofollow noreferrer">SDK</a> in a UWP desktop app, but I'm stopped by an exception I don't know quite what means or how to fix it: <em>InteropServices.SEHException</em></p>
  
  <p>I have obtained the source code for a <a href="https://github.com/nicoco007/AuraSDK" rel="nofollow noreferrer">C# wrapper</a> for the SDK, which I have successfully built as a UWP Class library (it was already available on nuget, but I figured maybe I needed to build it for UWP specifically - doesn't seem like the case anymore).</p>
  
  <p>Judging from the debug information, the DLL is loaded and the pointers for delegates are pointing somewhere, but the exception is thrown on this part of the wrapper code:</p>
  
  <pre><code>int controllerCount = EnumerateGpuController(IntPtr.Zero, 0);
  </code></pre>
  
  <p>This function is defined as:</p>
  
  <pre><code>internal int EnumerateGpuController(IntPtr handles, int size) =&gt; 
  enumerateGpuControllerPointer(handles, size);
  </code></pre>
  
  <p>The pointer is obtained from this:</p>
  
  <pre><code>enumerateGpuControllerPointer = (EnumerateGpuControllerPointer)
  Marshal.GetDelegateForFunctionPointer(NativeMethods.GetProcAddress(dllHandle, "EnumerateGPU"), typeof(EnumerateGpuControllerPointer));
  </code></pre>
  
  <p>The dllHandle seems valid after confirming that it is loaded.
  The DLL is in the project's root and built as content and copied to the Debug directory on build.</p>
  
  <p>Is there a solvable way around this, or is this the sandbox of UWP, making it impossible to use external DLLs?</p>