.NET Framework Bookmark and Share   
 index > Building Development and Diagnostic Tools for .Net > XML Documentation for Reflecion Emit
 

XML Documentation for Reflecion Emit

Is it possible to generate XML documentation from assemblies made using reflection emit. VB and C# can do it. Is this feature inside the reflection classes?.
  • Edited byBorgdylan Monday, September 14, 2009 4:02 PMspelling
  •  

Answers

  • Monday, September 14, 2009 5:00 PMKarel ZikmundMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    I guess you have assemblies saved to disk which were produced by Ref.Emit, correct?
    In that case you can use any disassembler (ildasm, Reflector). That's the best documentation you can get for existing assemblies, as assemblies don't contain any comments, just names of methods and names of (some) parameters.

    C# and VB can generate XML documentation only from sources. If you don't have sources (like in Ref.Emit case), then you cannot produce any useful XML documentation.

    -Karel

  • Thursday, September 17, 2009 4:38 PMKarel ZikmundMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     AnswerHas Code
    Just experiment with it and you will find out that there is no fixed XML Schema for the doc.
    You can bing it- first result is documentation about C# XMLDocumentationComments, which leads you to XMLDocumentation format, that explains what C# puts into the XML Documentation file and how.

    Here's my quick experiment -it shows that also custom XML tags (myOwnTag) will be in the XML documentation file:
    // HelloWorld.cs
    /// <summary>
    
    /// The main class with the entry point
    
    /// </summary>
    
    public class HelloWorld
    {
        /// <summary>
    
        /// Entry point of the application.
    
        /// </summary>
    
        /// <param name="args">Arguments from the command line.</param>
    
        /// <returns>App error code</returns>
    
        /// <myOwnTag>Will this be included in the XML documentation?</myOwnTag>
    
        public static int Main(string [] args)
        {
            return 0;
        }
    }
    
    

    Run csc.exe /doc:Documentation.xml HelloWorld.cs
    <?xml version="1.0"?>
    <doc>
        <assembly>
            <name>HelloWorld</name>
        </assembly>
        <members>
            <member name="T:HelloWorld">
                <summary>
                The main class with the entry point
                </summary>
            </member>
            <member name="M:HelloWorld.Main(System.String[])">
                <summary>
                Entry point of the application.
                </summary>
                <param name="args">Arguments from the command line.</param>
                <returns>App error code</returns>
                <myOwnTag>Will this be included in the XML documentation?</myOwnTag>
            </member>
        </members>
    </doc>
    
    

All Replies

  • Monday, September 14, 2009 5:00 PMKarel ZikmundMSFT, ModeratorUsers MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     Answer

    I guess you have assemblies saved to disk which were produced by Ref.Emit, correct?
    In that case you can use any disassembler (ildasm, Reflector). That's the best documentation you can get for existing assemblies, as assemblies don't contain any comments, just names of methods and names of (some) parameters.

    C# and VB can generate XML documentation only from sources. If you don't have sources (like in Ref.Emit case), then you cannot produce any useful XML documentation.

    -Karel

  • Thursday, September 17, 2009 12:20 PMBorgdylan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    But I do have sources. The binaries are made by my compiler which processes source files. Is there an XML Schema for XML Documentation that I can use to learn its structure?
Borgdylan
Just experiment with it and you will find out that there is no fixed XML Schema for the doc.
You can bing it- first result is documentation about C# XMLDocumentationComments, which leads you to XMLDocumentation format, that explains what C# puts into the XML Documentation file and how.

Here's my quick experiment -it shows that also custom XML tags (myOwnTag) will be in the XML documentation file:
// HelloWorld.cs
/// <summary>

/// The main class with the entry point

/// </summary>

public class HelloWorld
{
    /// <summary>

    /// Entry point of the application.

    /// </summary>

    /// <param name="args">Arguments from the command line.</param>

    /// <returns>App error code</returns>

    /// <myOwnTag>Will this be included in the XML documentation?</myOwnTag>

    public static int Main(string [] args)
    {
        return 0;
    }
}


Run csc.exe /doc:Documentation.xml HelloWorld.cs
<?xml version="1.0"?>
<doc>
    <assembly>
        <name>HelloWorld</name>
    </assembly>
    <members>
        <member name="T:HelloWorld">
            <summary>
            The main class with the entry point
            </summary>
        </member>
        <member name="M:HelloWorld.Main(System.String[])">
            <summary>
            Entry point of the application.
            </summary>
            <param name="args">Arguments from the command line.</param>
            <returns>App error code</returns>
            <myOwnTag>Will this be included in the XML documentation?</myOwnTag>
        </member>
    </members>
</doc>


  • Tuesday, September 22, 2009 3:27 PMBorgdylan Users MedalsUsers MedalsUsers MedalsUsers MedalsUsers Medals
     
    Thanks Karel, that was exactly what I wanted to know. The xml makes a lot of sense. I just needed how it is formatted. I have worked with xml documents beforehand. You are the best.
  • Karel Zikmund

    You can use google to search for other answers

    Custom Search

    More Threads

    • Identify Finalizer Thread
    • ILDASM/ILASM - Resulting .exe crashes.
    • Problem with showing Toltip on DataGridView Column Headers .NET 3.5
    • How to check if a pdb is present on a symbol server?
    • MDbg sample pdb2xml code can not update PE debug Headers, it throws IOException: The process cannot access the file 'E:\mdbg\bin\Debug\mdbg.exe' because it is being used by another process.
    • Thread Crash scenarios with ICorProfilerCallback
    • Profling API - Catching Caller Information of Asynchronous Calls
    • Windows Service Crashes and JIT debug
    • Will ICorProfilerInfo.SetFunctionReJIT be implemented in 3.5 (split from: Will there be a new CLR in 3.5?)
    • Multiple App.config