-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[mono] Fix detecting [DisableRuntimeMarshalling] in MarshalingPInvokeScanner. #112981
Conversation
…Scanner. Fix detecting the [DisableRuntimeMarshalling] attribute in MarshalingPInvokeScanner for assemblies that reference the attribute from another assembly (i.e. any assembly except System.Runtime.dll). Fixes dotnet#112980.
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.
PR Overview
This PR addresses the issue of detecting the [DisableRuntimeMarshalling] attribute when it is referenced from assemblies other than System.Runtime.dll. The changes refactor inline string comparisons into a new helper method and apply it in both type definition and member reference contexts.
- Introduced the IsDisableRuntimeMarshallingAttribute helper method.
- Replaced inline attribute checks with the new helper method for clearer logic.
- Updated attribute checks for both direct and member reference cases.
Reviewed Changes
File | Description |
---|---|
src/tasks/MonoTargetsTasks/MarshalingPInvokeScanner/MarshalingPInvokeScanner.cs | Refactored attribute detection to improve consistency while fixing the attribute resolving issue. |
Copilot reviewed 1 out of 1 changed files in this pull request and generated no comments.
Comments suppressed due to low confidence (1)
src/tasks/MonoTargetsTasks/MarshalingPInvokeScanner/MarshalingPInvokeScanner.cs:107
- Ensure unit tests cover scenarios for both direct type definition and member reference attribute detections using IsDisableRuntimeMarshallingAttribute to confirm the fix works under all expected conditions.
private bool IsDisableRuntimeMarshallingAttribute (MetadataReader mdtReader, StringHandle ns, StringHandle name)
src/tasks/MonoTargetsTasks/MarshalingPInvokeScanner/MarshalingPInvokeScanner.cs
Outdated
Show resolved
Hide resolved
…PInvokeScanner.cs Co-authored-by: Theodore Tsirpanis <teo@tsirpanis.gr>
lgtm but there are a few code style errors |
@akoeplinger looks like the failure is unrelated? is there anything else I need to do to get this in? |
no, I just forgot to merge, sorry :D |
Fix detecting the [DisableRuntimeMarshalling] attribute in
MarshalingPInvokeScanner for assemblies that reference the attribute from
another assembly (i.e. any assembly except System.Runtime.dll).
Fixes #112980.