gpt4 book ai didi

visual-studio - F# 断点仅在抛出异常后才起作用

转载 作者:行者123 更新时间:2023-12-04 15:54:51 35 4
gpt4 key购买 nike

我尝试使用 F#、.Net-Core 3、Ionide 和 Visual Studio Code 创建一个 ASP.Net 网站,但是,当我尝试在 F# 文件中设置断点时,它没有被击中。

但是当我放一个

assert false

在我的断点前,我得到了异常,然后断点被击中。

我也在 Visual Studio 中尝试过相同的断言正确中断,但在继续时,它没有到达断点,即使 VS Code 做到了。

在 VS Code 中,这不起作用:

let x = 4 // <- Breakpoint

但这确实:

assert false
let x = 4 // <- Breakpoint

无论是否添加断言,我在启动时都会收到此警告。

Breakpoint warning: No executable code of the debugger’s target code type is associated with this line.
Possible causes include: conditional compilation, compiler optimizations, or the target architecture of this line is not supported by the current debugger code type.

可能是什么原因,我该如何解决?

最佳答案

最后,问题出在我所拥有的复杂的项目间依赖关系上。

  1. ASP.Net 项目 (F#)
  2. 迁移和 DbContext 项目(C#)
  3. 单元测试项目(F#)
  4. DbContext ASP.Net 共享对象项目 (F#)

我通过保留迁移项目但将 DbContext 移动到 ASP.Net 项目中解决了这个问题。因此,我没有从迁移到 ASP.Net 项目的引用,而是将其更改为相反的方式。这也允许我将共享对象移动到 ASP.Net 项目并删除共享对象项目。所以这是后来的样子

  1. ASP.Net 和 DbContext 项目(F#)
  2. 迁移项目(C#)
  3. 单元测试项目(F#)

虽然我不是为了解决这个问题而做的,但它作为副作用解决了它。我希望这对遇到相同或类似问题的其他人有所帮助。

关于visual-studio - F# 断点仅在抛出异常后才起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/57494648/

35 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com