Skip to content

Commit

Permalink
[mono] MarshalingPInvokeScanner tolerates DLLs without metadata (#89430)
Browse files Browse the repository at this point in the history
* Acquire MetadataReader under try.

* Logging failed metadata access.

* Update src/tasks/MonoTargetsTasks/MarshalingPInvokeScanner/MarshalingPInvokeScanner.cs

Co-authored-by: Theodore Tsirpanis <teo@tsirpanis.gr>

---------

Co-authored-by: Theodore Tsirpanis <teo@tsirpanis.gr>
  • Loading branch information
jandupej and teo-tsirpanis committed Jul 26, 2023
1 parent ed12a81 commit ef3fd85
Showing 1 changed file with 4 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ private bool IsAssemblyIncompatible(string assyPath, MinimalMarshalingTypeCompat
{
using FileStream file = new FileStream(assyPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using PEReader peReader = new PEReader(file);
if (!peReader.HasMetadata)
{
return false;
}
MetadataReader mdtReader = peReader.GetMetadataReader();

foreach(CustomAttributeHandle attrHandle in mdtReader.CustomAttributes)
Expand Down

0 comments on commit ef3fd85

Please sign in to comment.