Enable AllowUnsafeBlocks for Gallery and Test heads under Windows App SDK#223
Conversation
|
I'm still confused on what WinRT is trying to do here that requires unsafe codeblocks for @Sergio0694 do you know what this is about? |
|
@michael-hawker it's just the way CsWinRT works. It's a known concern, but ultimately it just needs unsafe code. It's only impacting a specific subset of projects (it only triggers when you need to marshal some type of generic types), and we added an analyzer in CsWinRT to at least emit a useful and clear message if you don't have it enabled already. Note that it's common practice to enforce this, eg. the COM interop generator also requires you to allow unsafe blocks 🙂 |
|
@Sergio0694 thanks Sergio, good to know. Just wanted to call it out, as it'd be a concern if it causes problems later where we see apps which have to take this on now run into problems with accidentally running unsafe code unintentionally (or for those that want to explicitly restrict it). |
This PR fixes the error annotations in the Gallery head when running the latest WindowsAppSDK and CsWinRT:
See https://github.com/CommunityToolkit/Labs-Windows/actions/runs/11560414170