Reputation: 17647
I have a small C# Console Application that has a F# Project Reference.
using System;
namespace ConsoleApp1
{
class Program
{
static void Main(string[] args)
{
var number = FS.DecodeRomanNumeral("XV");
Console.WriteLine("Hello World!");
}
}
}
On the F# project, I have this code:
module FS
open System
/// Decodes a Roman Number string to a int number // https://twitter.com/nikoloz_p/status/1421218836896960515
let DecodeRomanNumeral RomanNumeral =
let DigitToNumber = function
| 'I' -> 1
| 'V' -> 5
| 'X' -> 10
| 'L' -> 50
| 'C' -> 100
| 'D' -> 500
| 'M' -> 1000
| c -> failwith (sprintf "Invalid digit %c" c)
let rec sum' Numbers =
match Numbers with
| [] -> 0
| x::y::rest when x < y -> y - x + sum' rest
| x::rest -> x + sum' rest
RomanNumeral
|> Seq.map DigitToNumber
|> Seq.toList
|> sum'
When I click on the DecodeRomanNumeral word and press F12 it brings the Disassembler window, instead of the actual F# source code that is on the referenced project. I noted that this behavior occurs in Visual Studio 2019 (Version 16.10.4) and also Visual Studio 2022 (Version 17.0.0 Preview 2.1)
I double checked and I added a Project Reference on the C# Project, making a reference to the F#
I need that it goes from the C# to the actual F# code when I press F12 (Go To Definition).
How to do that?
Upvotes: 0
Views: 426
Reputation: 3929
Unfortunately, VS doesn't support that yet. Only from F# to C# works since VS 16.10: https://devblogs.microsoft.com/dotnet/f-and-f-tools-update-for-visual-studio-16-10/#better-mixing-of-c-and-f-projects-in-your-solution
Personally, I've resorted to JetBrains Rider just for this, where it works very well.
Upvotes: 3