Skip to content

Commit 99b439a

Browse files
authored
Fix enum exported when namespaces aren't correctly processed (#102)
***NO_CI***
1 parent d3d0af0 commit 99b439a

File tree

1 file changed

+15
-2
lines changed

1 file changed

+15
-2
lines changed

source/MetadataProcessor.Core/Extensions/TypeDefinitionExtensions.cs

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,21 @@ public static EnumDeclaration ToEnumDeclaration(this TypeDefinition source)
7272
}
7373
else
7474
{
75-
// something very wrong here...
76-
throw new ArgumentException($"Can't process enum type {source.FullName}.");
75+
try
76+
{
77+
// namespace not showing up, remove everything before the last '.'
78+
enumName = source.FullName.Substring(
79+
source.DeclaringType.FullName.LastIndexOf('.'))
80+
.Replace(".", "");
81+
82+
// replace '/' separator
83+
enumName = source.FullName.Replace("/", "_");
84+
}
85+
catch
86+
{
87+
// something very wrong here...
88+
throw new ArgumentException($"Can't process enum type {source.FullName}.");
89+
}
7790
}
7891
}
7992

0 commit comments

Comments
 (0)