Sergio0694 / ComputeSharp

A .NET library to run C# code in parallel on the GPU through DX12, D2D1, and dynamically generated HLSL compute and pixel shaders, with the goal of making GPU computing easy to use for all .NET developers! 🚀
MIT License
2.65k stars 122 forks source link

Unsafe Block Requirement Applies Transiently #815

Closed ds5678 closed 1 month ago

ds5678 commented 1 month ago

Description

When this library is used, it requires the referencing project to enable unsafe code, which is fine. However, it also forces anything that depends on that project to enable unsafe code.

Reproduction Steps

Expected Behavior

ComputeSharp should be more surgical about requesting to allow unsafe blocks. Ideally, it would only request in projects that require its source generation functionality.

Actual Behavior

It emits an error in any project that transiently references it if that project does not allow unsafe blocks.

System info

This section should contain useful info such as:

Workaround

Affected users can apply <NoWarn>CMPS0052</NoWarn> in projects that don't use ComputeSharp directly.

Sergio0694 commented 1 month ago

Good catch, thank you! Might publish a patch release to fix this one 😄