Add callout that readonly structs can cause PEVerify to fail on .NET Framework
- Dominant language
- No language data
- Stars
- 4.8k
- Forks
- 6.1k
- Avg merge
- 15h 21m
- Merged PRs (30d)
- 370
Description
I recently hit an issue where using readonly structs in a .NET Framework library causes issues with scenarios that require PEVerify (common one is in partial trust situations). It would be good to document this. Some things that we may want to include:
- readonly structs cause new codegen that may fail PEVerify. Can opt in `/feature:peverify-compat` to resolve that
- It appears this is automatically applied when C# langversion < 7.2. I started targeting C# 8 (yes, I know it's not supported officially for framework, but for the features that are available in framework it is nice to use)
There may be others, but those are the things I found.
A related issue is: https://github.com/dotnet/roslyn/issues/27382
Edit by @BillWagner
Changing the document block to move to the *PEVerify* docs.
---
#### Document Details
⚠ *Do not edit this section. It is required for learn.microsoft.com ➟ GitHub issue linking.*
* ID: df533f87-7ae1-6cae-ff21-951ed1bcbe51
* Version Independent ID: 64e471c8-9655-7cf6-718f-c734f77c2e01
* Content: [Peverify.exe (PEVerify Tool) - .NET Framework](https://learn.microsoft.com/en-us/dotnet/framework/tools/peverify-exe-peverify-tool)
* Content Source: [docs/framework/tools/peverify-exe-peverify-tool.md](https://github.com/dotnet/docs/blob/main/docs/framework/tools/peverify-exe-peverify-tool.md)
* Product: **dotnet-framework**
* GitHub Login: @gewarren
* Microsoft Alias: **gewarren**
Contributor guide
Assessment
This issue has not been assessed yet.