Export (0) Print
Expand All

ISymbolDocumentWriter Interface

Represents a document referenced by a symbol store.

For a list of all members of this type, see ISymbolDocumentWriter Members.

[Visual Basic]
Public Interface ISymbolDocumentWriter
[C#]
public interface ISymbolDocumentWriter
[C++]
public __gc __interface ISymbolDocumentWriter
[JScript]
public interface ISymbolDocumentWriter

Remarks

A document is defined by a URL and a document type GUID. Optionally, the document source can be stored in the symbol store.

Note   This interface is the managed counterpart of the ISymUnmanagedDocumentWriter interface, defined in the Debug Reference (located in the %\Microsoft.NET\Framework SDK\Tool Developers Guide\Docs directory). The unmanaged Symbol Store interfaces described in the Debug Reference provide an alternative set of unmanaged APIs for writing and manipulating symbolic information.

Example

[Visual Basic, C#, C++] The following code example demonstrates how an ISymbolDocumentWriter can be obtained when calling DefineDocument.

[Visual Basic] 
Imports System
Imports System.Reflection
Imports System.Reflection.Emit
Imports System.Resources
Imports System.Diagnostics.SymbolStore

Namespace ILGenServer

   Public Class CodeGenerator
      Private myModuleBuilder As ModuleBuilder
      Private myAssemblyBuilder As AssemblyBuilder

      Public Sub New()

         ' Get the current application domain for the current thread.
         Dim currentDomain As AppDomain = AppDomain.CurrentDomain
         Dim myAssemblyName As New AssemblyName()
         myAssemblyName.Name = "TempAssembly"

         ' Define a dynamic assembly in the current domain.
         myAssemblyBuilder = currentDomain.DefineDynamicAssembly(myAssemblyName, _
                                                         AssemblyBuilderAccess.RunAndSave)
         ' Define a dynamic module in "TempAssembly" assembly.
         myModuleBuilder = myAssemblyBuilder.DefineDynamicModule("TempModule", "Resource.mod", True)

         ' Define a document for source.on 'TempModule' module.
         Dim myDocument As ISymbolDocumentWriter = myModuleBuilder.DefineDocument("RTAsm.il", _
                     SymDocumentType.Text, SymLanguageType.ILAssembly, SymLanguageVendor.Microsoft)
         Console.WriteLine("The object representing the defined document is:" + _
                                                             CObj(myDocument).ToString())

      End Sub 'New
   End Class 'CodeGenerator

   Public Class CallerClass

      Public Shared Sub Main()
         Dim myGenerator As New CodeGenerator()
      End Sub 'Main
   End Class 'CallerClass
End Namespace 'ILGenServer

[C#] 
using System;
using System.Reflection;
using System.Reflection.Emit;
using System.Resources;
using System.Diagnostics.SymbolStore;

namespace ILGenServer
{
   public class CodeGenerator
   {
      ModuleBuilder myModuleBuilder ;
      AssemblyBuilder myAssemblyBuilder ;

      public CodeGenerator()
      {

         // Get the current application domain for the current thread.
         AppDomain currentDomain = AppDomain.CurrentDomain;
         AssemblyName myAssemblyName = new AssemblyName();
         myAssemblyName.Name = "TempAssembly";

         // Define a dynamic assembly in the current domain.
         myAssemblyBuilder =
            currentDomain.DefineDynamicAssembly
                        (myAssemblyName, AssemblyBuilderAccess.RunAndSave);
         // Define a dynamic module in "TempAssembly" assembly.
         myModuleBuilder =
            myAssemblyBuilder.DefineDynamicModule("TempModule","Resource.mod",true);

         // Define a document for source.on 'TempModule' module.
         ISymbolDocumentWriter myDocument =
         myModuleBuilder.DefineDocument("RTAsm.il", SymDocumentType.Text,
                  SymLanguageType.ILAssembly,SymLanguageVendor.Microsoft);

         Console.WriteLine("The object representing the defined document is:"+myDocument);

      }
   }
   public class CallerClass
   {
      public static void Main()
      {
         CodeGenerator myGenerator = new CodeGenerator();
      }
   }
}

[C++] 
#using <mscorlib.dll>

using namespace System;
using namespace System::Reflection;
using namespace System::Reflection::Emit;
using namespace System::Resources;
using namespace System::Diagnostics::SymbolStore;

public __gc class CodeGenerator {
   ModuleBuilder* myModuleBuilder ;
   AssemblyBuilder* myAssemblyBuilder ;

public:
   CodeGenerator() {

      // Get the current application domain for the current thread.
      AppDomain*  currentDomain = AppDomain::CurrentDomain;
      AssemblyName* myAssemblyName = new AssemblyName();
      myAssemblyName->Name = S"TempAssembly";

      // Define a dynamic assembly in the current domain.
      myAssemblyBuilder =
         currentDomain->DefineDynamicAssembly
         (myAssemblyName, AssemblyBuilderAccess::RunAndSave);
      // Define a dynamic module in S"TempAssembly" assembly.
      myModuleBuilder =
         myAssemblyBuilder->DefineDynamicModule(S"TempModule", S"Resource.mod", true);

      // Define a document for source.on 'TempModule' module.
      ISymbolDocumentWriter* myDocument =
         myModuleBuilder->DefineDocument(S"RTAsm.il", SymDocumentType::Text,
         SymLanguageType::ILAssembly, SymLanguageVendor::Microsoft);

      Console::WriteLine(S"The object representing the defined document is: {0}", myDocument);

   }
};

int main() {
   CodeGenerator* myGenerator = new CodeGenerator();
}

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.

Requirements

Namespace: System.Diagnostics.SymbolStore

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: Mscorlib (in Mscorlib.dll)

See Also

ISymbolDocumentWriter Members | System.Diagnostics.SymbolStore Namespace | ISymbolWriter | ILGenerator.MarkSequencePoint | ModuleBuilder.DefineDocument

Show:
© 2014 Microsoft