@@ -114,25 +114,39 @@ public override IEnumerable<IExtractionProduct> Contents
114
114
115
115
if ( ! body . LocalSignature . IsNil )
116
116
{
117
- var locals = Context . MdReader . GetStandaloneSignature ( body . LocalSignature ) ;
118
- var localVariableTypes = locals . DecodeLocalSignature ( Context . TypeSignatureDecoder , this ) ;
119
-
120
- this . locals = new LocalVariable [ localVariableTypes . Length ] ;
117
+ var localVariableTypes = System . Collections . Immutable . ImmutableArray < Type > . Empty ;
118
+ var hasError = false ;
119
+ try
120
+ {
121
+ var locals = Context . MdReader . GetStandaloneSignature ( body . LocalSignature ) ;
122
+ localVariableTypes = locals . DecodeLocalSignature ( Context . TypeSignatureDecoder , this ) ;
123
+ }
124
+ catch ( System . BadImageFormatException exc )
125
+ {
126
+ Context . Extractor . Logger . Log ( Util . Logging . Severity . Info ,
127
+ $ "Could not decode locals in method { declaringType . GetQualifiedName ( ) } .{ name } . { exc } ") ;
128
+ hasError = true ;
129
+ }
121
130
122
- for ( var l = 0 ; l < this . locals . Length ; ++ l )
131
+ if ( ! hasError )
123
132
{
124
- var t = localVariableTypes [ l ] ;
125
- if ( t is ByRefType brt )
126
- {
127
- t = brt . ElementType ;
128
- this . locals [ l ] = Context . Populate ( new LocalVariable ( Context , Implementation , l , t ) ) ;
129
- yield return this . locals [ l ] ;
130
- yield return Tuples . cil_type_annotation ( this . locals [ l ] , TypeAnnotation . Ref ) ;
131
- }
132
- else
133
+ this . locals = new LocalVariable [ localVariableTypes . Length ] ;
134
+
135
+ for ( var l = 0 ; l < this . locals . Length ; ++ l )
133
136
{
134
- this . locals [ l ] = Context . Populate ( new LocalVariable ( Context , Implementation , l , t ) ) ;
135
- yield return this . locals [ l ] ;
137
+ var t = localVariableTypes [ l ] ;
138
+ if ( t is ByRefType brt )
139
+ {
140
+ t = brt . ElementType ;
141
+ this . locals [ l ] = Context . Populate ( new LocalVariable ( Context , Implementation , l , t ) ) ;
142
+ yield return this . locals [ l ] ;
143
+ yield return Tuples . cil_type_annotation ( this . locals [ l ] , TypeAnnotation . Ref ) ;
144
+ }
145
+ else
146
+ {
147
+ this . locals [ l ] = Context . Populate ( new LocalVariable ( Context , Implementation , l , t ) ) ;
148
+ yield return this . locals [ l ] ;
149
+ }
136
150
}
137
151
}
138
152
}
0 commit comments