@@ -74,24 +74,30 @@ public nanoGenericParamTable(
7474 nanoTablesContext context )
7575 : base ( items , new GenericParameterComparer ( ) , context )
7676 {
77- foreach ( var gp in items )
77+ foreach ( GenericParameter gp in items )
7878 {
7979 MethodDefinition methodWithGenericParam = _context . MethodDefinitionTable . Items . SingleOrDefault ( m => m . GenericParameters . Contains ( gp ) ) ;
8080
8181 if ( methodWithGenericParam != null )
8282 {
8383 // get the first method specification that matches this type AND name
84- var instanceMethod = _context . MethodSpecificationTable . Items . FirstOrDefault (
84+ GenericInstanceMethod instanceMethod = _context . MethodSpecificationTable . Items . FirstOrDefault (
8585 mr => mr . DeclaringType . GetElementType ( ) == methodWithGenericParam . DeclaringType &&
8686 mr . Name == methodWithGenericParam . Name ) as GenericInstanceMethod ;
8787
88- Debug . Assert (
89- instanceMethod != null ,
90- $ "Couldn't find a method specification for type { methodWithGenericParam . DeclaringType } when processing generic parameter { gp } .") ;
91-
92- _typeForGenericParam . Add (
93- gp ,
94- instanceMethod . GenericArguments . ElementAt ( gp . Position ) ) ;
88+ if ( instanceMethod == null )
89+ {
90+ // No instantiation was ever emitted in the IL, treat the parameter as an "open generic"
91+ _typeForGenericParam . Add ( gp , gp ) ;
92+ }
93+ else
94+ {
95+ // found a closed instantiation, so pick the real type argument
96+ _typeForGenericParam . Add (
97+ gp ,
98+ instanceMethod . GenericArguments . ElementAt ( gp . Position )
99+ ) ;
100+ }
95101 }
96102 else
97103 {
0 commit comments