@@ -646,6 +646,43 @@ public void PortablePdbLineInfo()
646
646
} , symbolReaderProvider : typeof ( PortablePdbReaderProvider ) , symbolWriterProvider : typeof ( PortablePdbWriterProvider ) ) ;
647
647
}
648
648
649
+ [ Test ]
650
+ public void TypeDefinitionDebugInformation ( )
651
+ {
652
+ TestModule ( "TypeDefinitionDebugInformation.dll" , module => {
653
+ var enum_type = module . GetType ( "TypeDefinitionDebugInformation.Enum" ) ;
654
+ Assert . IsTrue ( enum_type . HasCustomDebugInformations ) ;
655
+ var binary_custom_debug_info = enum_type . CustomDebugInformations . OfType < BinaryCustomDebugInformation > ( ) . FirstOrDefault ( ) ;
656
+ Assert . IsNotNull ( binary_custom_debug_info ) ;
657
+ Assert . AreEqual ( new Guid ( "932E74BC-DBA9-4478-8D46-0F32A7BAB3D3" ) , binary_custom_debug_info . Identifier ) ;
658
+ Assert . AreEqual ( new byte [ ] { 0x1 } , binary_custom_debug_info . Data ) ;
659
+
660
+ var interface_type = module . GetType ( "TypeDefinitionDebugInformation.Interface" ) ;
661
+ Assert . IsTrue ( interface_type . HasCustomDebugInformations ) ;
662
+ binary_custom_debug_info = interface_type . CustomDebugInformations . OfType < BinaryCustomDebugInformation > ( ) . FirstOrDefault ( ) ;
663
+ Assert . IsNotNull ( binary_custom_debug_info ) ;
664
+ Assert . AreEqual ( new Guid ( "932E74BC-DBA9-4478-8D46-0F32A7BAB3D3" ) , binary_custom_debug_info . Identifier ) ;
665
+ Assert . AreEqual ( new byte [ ] { 0x1 } , binary_custom_debug_info . Data ) ;
666
+ } , symbolReaderProvider : typeof ( PortablePdbReaderProvider ) , symbolWriterProvider : typeof ( PortablePdbWriterProvider ) ) ;
667
+ }
668
+
669
+ [ Test ]
670
+ public void ModifyTypeDefinitionDebugInformation ( )
671
+ {
672
+ using ( var module = GetResourceModule ( "TypeDefinitionDebugInformation.dll" , new ReaderParameters { SymbolReaderProvider = new PortablePdbReaderProvider ( ) } ) ) {
673
+ var enum_type = module . GetType ( "TypeDefinitionDebugInformation.Enum" ) ;
674
+ var binary_custom_debug_info = enum_type . CustomDebugInformations . OfType < BinaryCustomDebugInformation > ( ) . FirstOrDefault ( ) ;
675
+ Assert . AreEqual ( new byte [ ] { 0x1 } , binary_custom_debug_info . Data ) ;
676
+ binary_custom_debug_info . Data = new byte [ ] { 0x2 } ;
677
+
678
+ var outputModule = RoundtripModule ( module , RoundtripType . None ) ;
679
+ enum_type = outputModule . GetType ( "TypeDefinitionDebugInformation.Enum" ) ;
680
+ binary_custom_debug_info = enum_type . CustomDebugInformations . OfType < BinaryCustomDebugInformation > ( ) . FirstOrDefault ( ) ;
681
+ Assert . IsNotNull ( binary_custom_debug_info ) ;
682
+ Assert . AreEqual ( new byte [ ] { 0x2 } , binary_custom_debug_info . Data ) ;
683
+ }
684
+ }
685
+
649
686
public sealed class SymbolWriterProvider : ISymbolWriterProvider {
650
687
651
688
readonly DefaultSymbolWriterProvider writer_provider = new DefaultSymbolWriterProvider ( ) ;
@@ -730,6 +767,11 @@ public void Write ()
730
767
symbol_writer . Write ( ) ;
731
768
}
732
769
770
+ public void Write ( ICustomDebugInformationProvider provider )
771
+ {
772
+ symbol_writer . Write ( provider ) ;
773
+ }
774
+
733
775
public void Dispose ( )
734
776
{
735
777
symbol_writer . Dispose ( ) ;
0 commit comments