File tree Expand file tree Collapse file tree 1 file changed +11
-6
lines changed
source/MetadataProcessor.Core/Extensions Expand file tree Collapse file tree 1 file changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,9 @@ public static EnumDeclaration ToEnumDeclaration(this TypeDefinition source)
6161 }
6262 else
6363 {
64- if ( ! string . IsNullOrEmpty ( source . DeclaringType . Namespace ) )
64+ if (
65+ source . DeclaringType != null &&
66+ ! string . IsNullOrEmpty ( source . DeclaringType . Namespace ) )
6567 {
6668 enumName = source . FullName . Replace ( source . DeclaringType . Namespace , "" ) ;
6769 // remove trailing dot
@@ -70,15 +72,18 @@ public static EnumDeclaration ToEnumDeclaration(this TypeDefinition source)
7072 // replace '/' separator
7173 enumName = enumName . Replace ( "/" , "_" ) ;
7274 }
75+ else if ( source . DeclaringType != null )
76+ {
77+ // namespace not showing up, remove everything before the last '.'
78+ // namespace not showing up, remove everything before the last '.'
79+ enumName = source . FullName . Substring (
80+ source . DeclaringType . FullName . LastIndexOf ( '.' ) )
81+ . Replace ( "." , "" ) ;
82+ }
7383 else
7484 {
7585 try
7686 {
77- // namespace not showing up, remove everything before the last '.'
78- enumName = source . FullName . Substring (
79- source . DeclaringType . FullName . LastIndexOf ( '.' ) )
80- . Replace ( "." , "" ) ;
81-
8287 // replace '/' separator
8388 enumName = source . FullName . Replace ( "/" , "_" ) ;
8489 }
You can’t perform that action at this time.
0 commit comments