Uh oh!
There was an error while loading. Please reload this page.
Remove [RequiresUnsafe] attribute usages - #127761
Conversation
Tagging subscribers to this area: @dotnet/area-system-runtime-compilerservices |
EgorBo
commented
May 4, 2026
This PR should probably also remove the analyzers/codefixer as well, otherwise |
am11
commented
May 4, 2026
Will it be removed from source before .NET 11 release (and docs be deleted https://learn.microsoft.com/dotnet/api/system.diagnostics.codeanalysis.requiresunsafeattribute) or does this attribute serve some other purpose? We can probably close the lid on #125904 and other enhancement plan concerning this attribute. |
Uh oh!
There was an error while loading. Please reload this page.
jjonescz
commented
May 4, 2026
The attribute is still used by the compiler, it shouldn't be removed. However, it could be moved back to CompilerServices namespace. |
jjonescz
commented
May 4, 2026
Sounds like that might be better in a separate PR (can be merged before this one though) for simpler reviewing. Here it is: #127768 |
agocke
commented
May 4, 2026
Can we onboard to the new compiler at the same time? So it correctly prohibits the use? |
We could set the compiler version but that will be overwritten by next flow from dotnet/dotnet. Changing the infra to avoid that seems like an overkill. But once dotnet/dotnet#6291 is merged, the next roslyn update will contain the change. So I think it would be good to merge this here and you will get validation with the new compiler soon after. |
jjonescz
commented
May 5, 2026
@EgorBo is this |
am11
commented
May 5, 2026
It's mainly for the local dev, e.g. this wrapper script calls dotnet format would produce undesired diffs: runtime/eng/formatting/format.sh Line 1 in 349228c |
EgorBo
commented
May 5, 2026
I think code-fixers never run, analyzers do. And for code-fixers it's very complicated to run them against CoreLib, currently, that requires a bit of hacks |
agocke
commented
May 5, 2026
I don't believe we always use the compiler from the VMR. We can just override it. |
agocke
commented
May 5, 2026
OK, I've taken a look and I think the workarounds for the VMR/source build aren't worth it. We can just proactively remove these. |
Uh oh!
There was an error while loading. Please reload this page.
It won't be possible to be used in source with new compiler (dotnet/roslyn#83295). Specifically, it will result in
Related to #125800 and dotnet/roslyn#81207.