dotnet / roslyn

The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
https://docs.microsoft.com/dotnet/csharp/roslyn-sdk/
MIT License
19.04k stars 4.03k forks source link

Function pointers are not encoded into XML docs #46674

Open john-h-k opened 4 years ago

john-h-k commented 4 years ago

Version Used: Latest public preview

Steps to Reproduce:

/// <summary>
/// Registers a callback for when this <see cref="GpuTask"/> completes
/// </summary>
/// <typeparam name="T">The type of the state to be passed to <paramref name="onFinished"/></typeparam>
/// <param name="state">The <typeparamref name="T"/> to pass to <paramref name="onFinished"/></param>
/// <param name="onFinished">The callback to invoke when this <see cref="GpuTask"/> finishes</param>
public void RegisterCallback<T>(T state, delegate*<T, void> onFinished) where T : class => _awaiter.RegisterCallback(state, onFinished);
  1. Have this code
  2. Build this code
  3. Try to use XML output from this code

Expected Behavior: Function pointers are encoded in the XML, or at least compiler provides a warning

Actual Behavior: Function pointers are not encoded in the metadata and simply vanish,, no warning or messages are provided, e.g the XML output for above is

<member name="M:Voltium.Core.Memory.GpuTask.RegisterCallback``1(``0,)">
GlebChili commented 3 years ago

Can confirm same issue with Roslyn in dotnet sdk 5.0.100 (RTM).

Fragment of the code to generate docs:

         /// <summary>
        /// Pushes a given C# function pointer with native Cdecl calling convention onto the Lua stack.
        /// </summary>
        /// <remarks>
        /// Function which pointer is pushed onto the Lua stack must conform lua_CFunction specification as described here: https://www.lua.org/pil/26.1.html
        /// </remarks>
        /// <param name="function_pointer">C# function pointer with native calling convention Cdecl.</param>
        public unsafe void PushCFunction(delegate* unmanaged[Cdecl]<IntPtr, int> function_pointer);

Resulting XML docs:

        <member name="M:GmodNET.API.ILua.PushCFunction()">
            <summary>
            Pushes a given C# function pointer with native Cdecl calling convention onto the Lua stack.
            </summary>
            <remarks>
            Function which pointer is pushed onto the Lua stack must conform lua_CFunction specification as described here: https://www.lua.org/pil/26.1.html
            </remarks>
            <param name="function_pointer">C# function pointer with native calling convention Cdecl.</param>
        </member>
saucecontrol commented 3 years ago

https://github.com/dotnet/roslyn/issues/48363 is about defining the DocID format. Implementation will be easy once the DocID is defined.