Skip to content

Commit ef3fd85

Browse files
[mono] MarshalingPInvokeScanner tolerates DLLs without metadata (#89430)
* 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>
1 parent ed12a81 commit ef3fd85

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

src/tasks/MonoTargetsTasks/MarshalingPInvokeScanner/MarshalingPInvokeScanner.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,10 @@ private bool IsAssemblyIncompatible(string assyPath, MinimalMarshalingTypeCompat
106106
{
107107
using FileStream file = new FileStream(assyPath, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
108108
using PEReader peReader = new PEReader(file);
109+
if (!peReader.HasMetadata)
110+
{
111+
return false;
112+
}
109113
MetadataReader mdtReader = peReader.GetMetadataReader();
110114

111115
foreach(CustomAttributeHandle attrHandle in mdtReader.CustomAttributes)

0 commit comments

Comments
 (0)