Skip to content

FSI in Visual Studio seemingly confuses line numbers #15258

@inosik

Description

@inosik

When code snippets are send to FSI from the editor, and then at the call site in the REPL there's a compilation error, FSI confuses line numbers and prints wrong lines as being incorrect. Looks to be related to #14717 (comment).

Repro steps

  1. Create a new F# script file and add some code

    For example, this:

    let sum a b = a + b
  2. Send the function to F# Interactive

  3. Call the function in the F# Interactive window, but incorrectly

    For example, like this: sum 1 2 3

Expected behavior

The output should look like this (from VS 2019):

> val sum : a:int -> b:int -> int

> sum 1 2 3;;

  sum 1 2 3;;
  ^^^^^^^

stdin(3,1): error FS0003: This value is not a function and cannot be applied.

Actual behavior

This is the actual output:

> val it: unit = () <-- This line is missing in VS 2019

> val sum: a: int -> b: int -> int

> sum 1 2 3;;

  #interactiveprompt "hide"
  ^^^^^^^

stdin(3,1): error FS0003: This value is not a function and cannot be applied.

Known workarounds

None.

Related information

  • Operating system: Windows 10
  • .NET Runtime kind (.NET Core, .NET Framework, Mono): Doesn't matter, I tried with "Use .NET Core scripting" set to true and false
  • Editing Tools (e.g. Visual Studio Version, Visual Studio):
    Microsoft Visual Studio Professional 2022
    Version 17.6.1
    VisualStudio.17.Release/17.6.1+33717.318
    Microsoft .NET Framework
    Version 4.8.04084
    
    Installed Version: Professional
    
    ASP.NET and Web Tools   17.6.326.62524
    ASP.NET and Web Tools
    
    Azure App Service Tools v3.0.0   17.6.326.62524
    Azure App Service Tools v3.0.0
    
    C# Tools   4.6.0-3.23259.8+c3cc1d0ceeab1a65da0217e403851a1e8a30086a
    C# components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
    
    Common Azure Tools   1.10
    Provides common services for use by Azure Mobile Services and Microsoft Azure Tools.
    
    Microsoft JVM Debugger   1.0
    Provides support for connecting the Visual Studio debugger to JDWP compatible Java Virtual Machines
    
    NuGet Package Manager   6.6.0
    NuGet Package Manager in Visual Studio. For more information about NuGet, visit https://docs.nuget.org/
    
    Razor (ASP.NET Core)   17.6.0.2326105+37f2727000f6a964584cafb86e69cf0b39baecb7
    Provides languages services for ASP.NET Core Razor.
    
    Rewrap Extension   1.0
    Re-wraps comments and other text
    
    Select Next Occurrence   1.4.182
    Selects the next occurrence of the current selection and adds multiple cursors for editing.
    
    SQL Server Data Tools   17.6.13.0
    Microsoft SQL Server Data Tools
    
    SubwordNavigation   2.0.0
    Provides subword navigation for Visual Studio.
    
    TypeScript Tools   17.0.20329.2001
    TypeScript Tools for Microsoft Visual Studio
    
    Visual Basic Tools   4.6.0-3.23259.8+c3cc1d0ceeab1a65da0217e403851a1e8a30086a
    Visual Basic components used in the IDE. Depending on your project type and settings, a different version of the compiler may be used.
    
    Visual F# Tools   17.6.0-beta.23174.5+0207bea1afae48d9351ac26fb51afc8260de0a97
    Microsoft Visual F# Tools
    

Metadata

Metadata

Assignees

Labels

Area-VS-FSIVS window and commands for F# InteractiveBugImpact-Medium(Internal MS Team use only) Describes an issue with moderate impact on existing code.

Type

No type

Projects

Status

Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions