Skip to content

Line Numbers missing in Exceptions #13290

Closed

Description

@goswinr

When using F# Interactive via FSharp.Compiler.Service 41.0.4 on net48 Exceptions do not include line numbers.
Line numbers are only shown on net6.0 :
image

Is there a way to make exceptions include line numbers when on net48 ?
I am hosting fsi in a much larger net48 process. So I can't switch to net6.0.

code used:

let code = """
try
    8 / 0 |> ignore
with e -> 
    printfn $"Runtime: {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}"
    printfn $"Error: {e}" 
"""

open System
open System.IO
open FSharp.Compiler.Interactive.Shell

let eval(codeStr) = 
    let inn = new StringReader("")
    let out = Console.Out
    let config = FsiEvaluationSession.GetDefaultConfiguration()
    let noArgs = [| "the first arg is neded, but ignored"|]
    let session = FsiEvaluationSession.Create(config, noArgs, inn, out, out)
    session.EvalInteraction(codeStr)

eval(code)
    
System.Console.ReadLine() |> ignore

and

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>net48;net6.0</TargetFrameworks>
  </PropertyGroup>

  <ItemGroup>
    <Compile Include="Program.fs" />
  </ItemGroup>

  <ItemGroup>
    <PackageReference Update="FSharp.Core" Version="6.0.4" />
    <PackageReference Include="FSharp.Compiler.Service" Version="41.0.4" />
  </ItemGroup>
</Project>

full repo: https://github.com/goswinr/ErrorLineNumberMissing

Activity

  1. dsyme commented on Jun 14, 2022

    @dsyme
    Contributor

    You might try passing --debug in the arguments to the interactive session

  2. dsyme commented on Jun 14, 2022

    @dsyme
    Contributor

    You might also try --multiemit

  3. dsyme commented on Jun 14, 2022

    @dsyme
    Contributor

    I'll convert this to a discussion since I don't think we'd treat this as a specific bug yet based on the info above

  4. locked and limited conversation to collaborators on Jun 14, 2022
  5. converted this issue into a discussion #13293 on Jun 14, 2022
  6. Repository owner moved this from Not Planned to Done in F# Compiler and Toolingon Jun 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions