Uh oh!
There was an error while loading. Please reload this page.
[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). Fixesdotnet#112980.
There was a problem hiding this comment.
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)
Uh oh!
There was an error while loading. Please reload this page.
…PInvokeScanner.cs Co-authored-by: Theodore Tsirpanis <teo@tsirpanis.gr>
akoeplinger
commented
Mar 2, 2025
lgtm but there are a few code style errors |
rolfbjarne
commented
Mar 6, 2025
@akoeplinger looks like the failure is unrelated? is there anything else I need to do to get this in? |
akoeplinger
commented
Mar 7, 2025
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.