Skip to content
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 second pass of MarshallingPInvokeScanner with metadata-free DLLs #89555

Merged
merged 2 commits into from
Jul 28, 2023

Conversation

jandupej
Copy link
Member

This fixes the second pass of #89429 when trying to read DLLs that have no metadata. The first pass was addressed in #89430.

@jandupej jandupej added this to the 8.0.0 milestone Jul 27, 2023
@jandupej jandupej self-assigned this Jul 27, 2023
Copy link
Member

@kotlarmilos kotlarmilos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@@ -81,6 +81,9 @@ private void ResolveInconclusiveTypes(HashSet<string> incompatible, string assyP

using FileStream file = new FileStream(assyPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using PEReader peReader = new PEReader(file);
if (!peReader.HasMetadata)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: May be good to encapsulate this, so we don't forget to check peReader.HasMetadata each time it is created, but I think it is nice to have.

@kotlarmilos
Copy link
Member

/azp run runtime-ioslike

@azure-pipelines
Copy link

No commit pushedDate could be found for PR 89555 in repo dotnet/runtime

@kotlarmilos
Copy link
Member

/azp run runtime-ioslike

@azure-pipelines
Copy link

No commit pushedDate could be found for PR 89555 in repo dotnet/runtime

@kotlarmilos
Copy link
Member

/azp run runtime-ioslike

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kotlarmilos
Copy link
Member

kotlarmilos commented Jul 27, 2023

The failure looks related. The scanner invokes GetAssemblyName which ends up with:

peReader = new PEReader((byte*)safeBuffer.DangerousGetHandle(), (int)safeBuffer.ByteLength);
MetadataReader mdReader = peReader.GetMetadataReader(MetadataReaderOptions.None);
AssemblyName assemblyName = mdReader.GetAssemblyDefinition().GetAssemblyName();

@kotlarmilos
Copy link
Member

/azp run runtime-ioslike

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

@kotlarmilos
Copy link
Member

The failures shouldn't be related. Thanks!

@jandupej jandupej merged commit 1da23b1 into dotnet:main Jul 28, 2023
@jandupej jandupej deleted the issue89429-part-deux branch July 28, 2023 09:24
@ghost ghost locked as resolved and limited conversation to collaborators Aug 27, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants