Skip to content

Commit

Permalink
[mtouch/mmp] Make it possible to compute assembly identity even if an…
Browse files Browse the repository at this point in the history
… assembly doesn't have a filename.

In .NET AssemblyDefinitions don't have MainModule.FileName set, because they're not
loaded using FileStreams.

Ref: dotnet/linker#1313
  • Loading branch information
rolfbjarne committed Aug 6, 2020
1 parent 967c475 commit d93f6c3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions tools/common/Assembly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,13 @@ public string FullPath {
}
}
public string FileName { get { return Path.GetFileName (FullPath); } }
public string Identity { get { return GetIdentity (FullPath); } }
public string Identity { get { return GetIdentity (AssemblyDefinition); } }

public static string GetIdentity (AssemblyDefinition ad)
{
return Path.GetFileNameWithoutExtension (ad.MainModule.FileName);
if (!string.IsNullOrEmpty (ad.MainModule.FileName))
return Path.GetFileNameWithoutExtension (ad.MainModule.FileName);
return ad.Name.Name;
}

public static string GetIdentity (string path)
Expand Down

0 comments on commit d93f6c3

Please sign in to comment.