@@ -240,9 +240,10 @@ public static Func<Unpacker, DasherContext, object> Build(Type type, UnexpectedF
240240 var notSeenLabel = ilg . DefineLabel ( ) ;
241241 ilg . Emit ( OpCodes . Brfalse , notSeenLabel ) ;
242242 {
243- ilg . Emit ( OpCodes . Ldstr , "Encountered duplicate field \" {0}\" ." ) ;
243+ ilg . Emit ( OpCodes . Ldstr , "Encountered duplicate field \" {0}\" for type \" {1} \" ." ) ;
244244 ilg . Emit ( OpCodes . Ldloc , key ) ;
245- ilg . Emit ( OpCodes . Call , typeof ( string ) . GetMethod ( nameof ( string . Format ) , new [ ] { typeof ( string ) , typeof ( object ) } ) ) ;
245+ ilg . Emit ( OpCodes . Ldstr , type . Name ) ;
246+ ilg . Emit ( OpCodes . Call , typeof ( string ) . GetMethod ( nameof ( string . Format ) , new [ ] { typeof ( string ) , typeof ( object ) , typeof ( object ) } ) ) ;
246247 throwException ( ) ;
247248 }
248249
@@ -267,9 +268,10 @@ public static Func<Unpacker, DasherContext, object> Build(Type type, UnexpectedF
267268 // If we got here then the property was not recognised. Either throw or ignore, depending upon configuration.
268269 if ( unexpectedFieldBehaviour == UnexpectedFieldBehaviour . Throw )
269270 {
270- ilg . Emit ( OpCodes . Ldstr , "Encountered unexpected field \" {0}\" ." ) ;
271+ ilg . Emit ( OpCodes . Ldstr , "Encountered unexpected field \" {0}\" for type \" {1} \" ." ) ;
271272 ilg . Emit ( OpCodes . Ldloc , key ) ;
272- ilg . Emit ( OpCodes . Call , typeof ( string ) . GetMethod ( nameof ( string . Format ) , new [ ] { typeof ( string ) , typeof ( object ) } ) ) ;
273+ ilg . Emit ( OpCodes . Ldstr , type . Name ) ;
274+ ilg . Emit ( OpCodes . Call , typeof ( string ) . GetMethod ( nameof ( string . Format ) , new [ ] { typeof ( string ) , typeof ( object ) , typeof ( object ) } ) ) ;
273275 throwException ( ) ;
274276 }
275277 else
0 commit comments