Compiler warning and runtime exception on UWP Release
See original GitHub issueThe library works fine on Debug UWP builds but gives the compiler warnings for each of the unsupported windows p/invoke calls when built in Release. For example:
MCG : warning MCG0007: Unresolved P/Invoke method 'user32.dll!CloseClipboard' for method 'System.Boolean WindowsClipboard.CloseClipboard()'.
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 satisfy those requirements, please use [DllImport(ExactSpelling=true) to indicate that you understand the implications of using non-UWP APIs
At runtime the promised exception is thrown when trying to cut, copy or paste.
This is using a UWP with a minimum target version of 10.0.16299. I don’t see the clipboard windows calls listed in the available APIs: https://docs.microsoft.com/en-us/uwp/win32-and-com/win32-and-com-for-uwp-apps
I will attempt a fix for my own app that uses the UWP Clipboard https://docs.microsoft.com/en-us/windows/uwp/app-to-app/copy-and-paste
If that works I’ll make a PR for this library.
Issue Analytics
- State:
- Created 4 years ago
- Comments:13 (7 by maintainers)
Top Results From Across the Web
UWP-APP Application Error on Release Build
I figured out, how to perform a Build with the Compile with .NET Native tool chain option enabled. However, I receive only the...
Read more >Compiling UWP C# app in Release mode fails due to ...
I have a solution that has a Windows Runtime Component (C++/WinRT) and a C# app that consumes that component.
Read more >Trying out v5. UWP App does not build in Release mode. ...
Describe the bug I was able to get my app updated to v5 and works in Debug mode, but now that I'm trying...
Read more >[UWP] Bug report: .Net Native compiler crashing
I am unable to compile UWP application in Release configuration when the following two lines added to the project: public struct TestStruct ...
Read more >Runtime error in release mode while preparing build for ...
as per the MD guidlines I enabled the "Compile with .net native tool chain" option but I am getting error1. Error 1:.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
can u submit a failing PR with that code?
I think there’s definitely something weird with my setup which I’m going to look into further.
I tried copying your test code by getting and setting on a thread and it worked fine.
I then tried repeatedly firing the get and set on new threads:
I found two things from this:
GetText
was nullCLIPBRD_E_CANT_OPEN
. I vaguely seeing code where you handled this for the .NET framework version. https://stackoverflow.com/questions/68666/clipbrd-e-cant-open-error-when-setting-the-clipboard-from-net