@@ -266,14 +266,10 @@ private void DumpTypeDefinitions(DumpAllTable dumpTable)
266
266
{
267
267
var h = new ExceptionHandler ( ) ;
268
268
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" ) } ";
277
273
278
274
methodDef . ExceptionHandlers . Add ( h ) ;
279
275
}
@@ -342,7 +338,8 @@ private void DumpTypeReferences(DumpAllTable dumpTable)
342
338
var typeRef = new TypeRef ( )
343
339
{
344
340
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" )
346
343
} ;
347
344
348
345
if ( _tablesContext . TypeReferencesTable . TryGetTypeReferenceId ( t , out refId ) )
@@ -383,7 +380,8 @@ private void DumpAssemblyReferences(DumpAllTable dumpTable)
383
380
dumpTable . AssemblyReferences . Add ( new AssemblyRef ( )
384
381
{
385
382
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" ) ,
387
385
Flags = "00000000"
388
386
} ) ;
389
387
}
0 commit comments