-
Notifications
You must be signed in to change notification settings - Fork 6k
Update trimmer docs to include warning IL3003 #27644
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Please also add an entry to https://github.com/dotnet/docs/blob/main/docs/fundamentals/toc.yml. |
} | ||
void TestMethod() | ||
{ | ||
// IL3002: Using member 'MethodWithAssemblyFilesUsage' which has 'RequiresAssemblyFilesAttribute' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation looks off
| | Value | | ||
|-------------------------------------|--------------------------------------| | ||
| **Rule ID** | IL3003 | | ||
| **Category** | [SingleFile](singlefile-warnings.md) | | ||
| **Fix is breaking or non-breaking** | Non-breaking | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This table looks different from other docs, I think we should be consistent
|
||
## Cause | ||
|
||
When publishing as a single file (for example, by setting the PublishSingleFile property in a project to true), interface implementations or derived classes with members that don't have matching annotations of `[RequiresAssemblyFiles]` can lead to calling an unsafe member with the attribute. There are four possible scenarios where the warning can be generated: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In general, please avoid "Safe"/"Unsafe" wording - it feels too much like security related. For trimming we've been trying to use "trim compatible", we can do the same for single-file.
|
||
When publishing as a single file (for example, by setting the PublishSingleFile property in a project to true), calling the `Assembly.GetFile(s)` methods for | ||
assemblies embedded inside the single-file bundle always throws an exception. | ||
assemblies embedded inside the single-file bundle always throws an exception, as these methods are not trim compatible. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for the confusion, although Vitek mentioned that the wording safe/unsafe is something we want to avoid, the term trim compatible does not apply for single file, since trimming is an independent process that might or might not be executed for single-file apps. The term to document would be 'single-file compatible'
## Cause | ||
|
||
When publishing an app as a single file (for example, by setting the `PublishSingleFile` property in a project to `true`), calling members annotated with the `RequiresAssemblyFilesAttribute` attribute might be unsafe. These calls can be unsafe because members annotated with this attribute require assembly files to be on disk, and the assemblies embedded in a single-file app are memory loaded. | ||
When publishing an app as a single file (for example, by setting the `PublishSingleFile` property in a project to `true`), calling members annotated with the `RequiresAssemblyFilesAttribute` attribute is not trim compatible. These calls is not trim compatible because members annotated with this attribute require assembly files to be on disk, and the assemblies embedded in a single-file app are memory loaded. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This still talks about "Trim compatible" - but it's about single-file.
Co-authored-by: Genevieve Warren <[email protected]>
Co-authored-by: Genevieve Warren <[email protected]>
Co-authored-by: Genevieve Warren <[email protected]>
Co-authored-by: Genevieve Warren <[email protected]>
Updates the docs related to the trimmer to include info about warning IL3003