Skip to content

Commit

Permalink
Fixed #129. "Exported name mismatched"
Browse files Browse the repository at this point in the history
  • Loading branch information
3F committed Dec 14, 2019
1 parent 891d8e0 commit 2acb835
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions RGiesecke.DllExport/DisabledAssemblyResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,20 @@ namespace RGiesecke.DllExport
/// Related issue: https://github.com/3F/DllExport/issues/127
///
/// For issue127 we can also use DefaultAssemblyResolver.AddSearchDirectory(),
/// But we don't actually need any assembly resolving in our case at all.
/// But we don't actually need resolving of any ref assemblies. Only ref types in our meta attr.
/// </summary>
internal sealed class DisabledAssemblyResolver: DefaultAssemblyResolver
{
public override AssemblyDefinition Resolve(AssemblyNameReference name)
public override AssemblyDefinition Resolve(AssemblyNameReference aref)
{
// https://docs.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.callingconvention
// Assemblies: System.Runtime.InteropServices.dll, mscorlib.dll, netstandard.dll

if(aref.Name == "System.Runtime.InteropServices" || aref.Name == "mscorlib" || aref.Name == "netstandard")
{
return base.Resolve(aref);
}

return null; // It will be considered as `resolved = false` due to internal ResolutionException processing in cecil.
}
}
Expand Down

0 comments on commit 2acb835

Please sign in to comment.