Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions ILRepack/RepackImporter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,15 @@ public TypeDefinition Import(TypeDefinition type, Collection<TypeDefinition> col
// rename the type previously imported.
// renaming the new one before import made Cecil throw an exception.
string other = GenerateName(nt, originalModule?.Mvid.ToString());

//Check whether renamed type already exists
TypeDefinition otherNt = _repackContext.TargetAssemblyMainModule.GetType(other);
if (otherNt != null)
{
//Create a random name
other = GenerateName(nt);
}

_logger.Verbose("Renaming " + nt.FullName + " into " + other);
nt.Name = other;
nt = CreateType(type, col, internalize, null);
Expand Down