Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

XML-comments for function with out parameter not visible from C# project #6310

Open
viktorvan opened this issue Mar 8, 2019 · 3 comments
Open
Assignees
Labels
Area-LangService-ToolTips tooltips/hover/quickinfo Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Milestone

Comments

@viktorvan
Copy link

XML-comments from an F# project are not showing up in a C# project when the function in question has out parameters.

Repro steps

Github-repo with reproduction https://github.com/viktorvan/FSharpXmlCommentBugRepro

  1. Create a new F# class library dotnet new classlib --language "F#" -n FSharpProject

  2. Add a type with xml-comments:

namespace FSharpProject
open System.Runtime.InteropServices //for OutAttribute

/// <summary>
/// This is my type
/// </summary>
type MyType() =

    /// <summary>
    /// This is a method with an out parameter
    /// </summary>
    /// <param name="s">An input string</param>
    /// <param name="result">An output string</param>
    static member StaticOutParam((s : string), [<Out>] result : string byref) =
        result <- "test"
  1. Setup the project to generate doc-comments, in fsproj, add:
<GenerateDocumentationFile>true</GenerateDocumentationFile>
  1. Build the project and verify that xml-comments are generated correctly in /bin/Debug/netstandard2.0/FSharpProject.xml

  2. At this point intellisense will work from within the F# project, or from another F# project referencing the original F#-project.

  3. Create a new C# class library and reference the F# project. dotnet new classlib -n CSharpProject. dotnet add CSharpProject/CSharpProject.csproj reference FSharpProject/FSharpProject.fsproj

  4. Add a class that uses the function from the F# project:

using FSharpProject;

namespace CSharpProject
{
    public class Class1
    {
        public static void Test() 
        {
            MyType.StaticOutParam("test", out var dummy);
        }
    }
}
  1. Hovering the class MyType will show the expected intellisense documentation. Hovering over the function StaticOutParam will not show any intellisense documentation.

Expected behavior

Intellisense documentation is displayed when hovering the function in the C# project.

Actual behavior

No intellisense documentation is shown.

Known workarounds

None that I have found.

Related information

Provide any related information

  • Operating system: tested on Mac Os X 10.14.3 and Windows 10
  • Branch: N/A
  • .NET Runtime, CoreCLR or Mono Version: dotnet core sdk 2.2.104
  • Editing Tools (e.g. Visual Studio Version): tested in VsCode 1.32.1 with Ionide 3.34.0 and also Visual Studio 2017 (latest)
  • Links to F# RFCs or entries on https://github.com/fsharp/fslang-suggestions
  • Links to performance testing scripts
  • Indications of severity: This is an inconvenience, but not blocking.
@inosik
Copy link

inosik commented Mar 11, 2019

This is the output XML documentation:

<?xml version="1.0" encoding="utf-8"?>
<doc>
<assembly><name>FSharpProject</name></assembly>
<members>
<member name="M:FSharpProject.MyType.StaticOutParam(System.String,Microsoft.FSharp.Core.byref{System.String,Microsoft.FSharp.Core.ByRefKinds.InOut})">
 <summary>
 This is a method with an out parameter
 </summary>
 <param name="s">An input string</param>
 <param name="result">An output string</param>
</member>
</members>
</doc>

This is the documentation the C# compiler generates for the same class:

<?xml version="1.0"?>
<doc>
    <assembly>
        <name>CSharpProject</name>
    </assembly>
    <members>
        <member name="M:CSharpProject.MyType.StaticOutParam(System.String,System.String@)">
            <summary>
            This is a method with an out parameter
            </summary>
            <param name="s">An input string.</param>
            <param name="result">An output string</param>
        </member>
    </members>
</doc>

The type of the second parameter is different. The C# tooling probably looks for docs with the signature as seen in the second example.

@inosik
Copy link

inosik commented Mar 11, 2019

BTW, it's the same the other way around:

image

@cartermp cartermp modified the milestones: 16.1, 16.2 Apr 23, 2019
@cartermp cartermp modified the milestones: 16.2, Backlog Apr 30, 2019
@dsyme
Copy link
Contributor

dsyme commented Aug 26, 2020

Thanks, this should be an easy fix

@dsyme dsyme added the Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code. label Aug 26, 2020
@dsyme dsyme self-assigned this Aug 26, 2020
@dsyme dsyme added Area-LangService-ToolTips tooltips/hover/quickinfo and removed Area-LangService-API labels Apr 5, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-LangService-ToolTips tooltips/hover/quickinfo Bug Impact-Low (Internal MS Team use only) Describes an issue with limited impact on existing code.
Projects
Status: New
Development

No branches or pull requests

4 participants