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)
61
61
}
62
62
else
63
63
{
64
- if ( ! string . IsNullOrEmpty ( source . DeclaringType . Namespace ) )
64
+ if (
65
+ source . DeclaringType != null &&
66
+ ! string . IsNullOrEmpty ( source . DeclaringType . Namespace ) )
65
67
{
66
68
enumName = source . FullName . Replace ( source . DeclaringType . Namespace , "" ) ;
67
69
// remove trailing dot
@@ -70,15 +72,18 @@ public static EnumDeclaration ToEnumDeclaration(this TypeDefinition source)
70
72
// replace '/' separator
71
73
enumName = enumName . Replace ( "/" , "_" ) ;
72
74
}
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
+ }
73
83
else
74
84
{
75
85
try
76
86
{
77
- // namespace not showing up, remove everything before the last '.'
78
- enumName = source . FullName . Substring (
79
- source . DeclaringType . FullName . LastIndexOf ( '.' ) )
80
- . Replace ( "." , "" ) ;
81
-
82
87
// replace '/' separator
83
88
enumName = source . FullName . Replace ( "/" , "_" ) ;
84
89
}
You can’t perform that action at this time.
0 commit comments