@@ -266,14 +266,10 @@ private void DumpTypeDefinitions(DumpAllTable dumpTable)
266266 {
267267 var h = new ExceptionHandler ( ) ;
268268
269- if ( eh . HandlerType == Mono . Cecil . Cil . ExceptionHandlerType . Filter )
270- {
271- h . Handler = "THIS IS AN EXCEPTION HANDLER" ;
272- }
273- else
274- {
275- h . Handler = "THIS IS ANoTHER EXCEPTION HANDLER" ;
276- }
269+ h . Handler = $ "{ ( ( int ) eh . HandlerType ) . ToString ( "x2" ) } " +
270+ $ "{ eh . TryStart . Offset . ToString ( "x8" ) } ->{ eh . TryEnd . Offset . ToString ( "x8" ) } " +
271+ $ "{ eh . HandlerStart . Offset . ToString ( "x8" ) } ->{ eh . HandlerEnd . Offset . ToString ( "x8" ) } " +
272+ $ "{ eh . CatchType . MetadataToken . ToInt32 ( ) . ToString ( "x8" ) } ";
277273
278274 methodDef . ExceptionHandlers . Add ( h ) ;
279275 }
@@ -342,7 +338,8 @@ private void DumpTypeReferences(DumpAllTable dumpTable)
342338 var typeRef = new TypeRef ( )
343339 {
344340 Name = t . FullName ,
345- Scope = new MetadataToken ( TokenType . AssemblyRef , _tablesContext . TypeReferencesTable . GetScope ( t ) ) . ToInt32 ( ) . ToString ( "x8" )
341+ // need to add 1 to match the index on the old MDP
342+ Scope = new MetadataToken ( TokenType . AssemblyRef , _tablesContext . TypeReferencesTable . GetScope ( t ) + 1 ) . ToInt32 ( ) . ToString ( "x8" )
346343 } ;
347344
348345 if ( _tablesContext . TypeReferencesTable . TryGetTypeReferenceId ( t , out refId ) )
@@ -383,7 +380,8 @@ private void DumpAssemblyReferences(DumpAllTable dumpTable)
383380 dumpTable . AssemblyReferences . Add ( new AssemblyRef ( )
384381 {
385382 Name = a . Name ,
386- ReferenceId = new MetadataToken ( TokenType . AssemblyRef , _tablesContext . AssemblyReferenceTable . GetReferenceId ( a ) ) . ToInt32 ( ) . ToString ( "x8" ) ,
383+ // need to add 1 to match the index on the old MDP
384+ ReferenceId = new MetadataToken ( TokenType . AssemblyRef , _tablesContext . AssemblyReferenceTable . GetReferenceId ( a ) + 1 ) . ToInt32 ( ) . ToString ( "x8" ) ,
387385 Flags = "00000000"
388386 } ) ;
389387 }
0 commit comments