MoQ - 尝试调试测试时出现问题
希望这很简单。我刚刚开始使用模拟框架,并决定使用最小起订量。设置模拟对象后,我的测试之一遇到问题,因此我决定单步执行代码。当我在以下行后按 F10 时:
Dim Mock = New Mock(Of IMyInterface) <----Error When on this line and hit F10
With Mock
.Setup(Function(x) x.MyProperty).Returns(5)
..........
我收到以下错误对话框:
“当前位置没有可用的源代码
[ ] 自动显示反汇编”
我最初下载的是二进制文件,而不是源代码。我想也许我需要下载源代码并在调试模式下手动编译它。尝试过,但没有成功。尝试过谷歌搜索,但并没有真正成功 。
任何帮助将不胜感激
Hopefully this is a simple. I just getting started with mocking frameworks and have decided to use MOQ. I'm having trouble with one of my test after setup of my mock object so i decided to step through the code. When i hit F10 after the following line:
Dim Mock = New Mock(Of IMyInterface) <----Error When on this line and hit F10
With Mock
.Setup(Function(x) x.MyProperty).Returns(5)
..........
I get the following error Dialog:
"There is no source code available for the current location
[ ] Show disassembly automatically"
I originally downloaded the binaries and not the source. I thought maybe i needed to download the source and compile it in debug mode manually. Tried that but it didn't work. Tried googling around but didn't really find much.
Any help would be appreciated
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
关闭帖子是因为我知道发生了什么事。 MOQ 框架中有一个例外,显然 Visual Studio 试图破解 MOQ 框架源代码,但由于某种原因无法成功。不知道为什么,因为它是由我手动编译为调试的,并且我确实包含了 pdb 文件。无论如何,这一行失败了:
我们通常将所有项目的基本命名空间设置为空,因为我们准确地说明了我们的命名空间是什么。上面的行当然不喜欢这样,你会得到一个“对象引用未设置到对象实例”,但这不是我得到的。我将向最小起订量团队报告这一点。仍然困惑为什么我收到错误,但那是另一篇文章的:)。
Closing the post because i figured out what was going on. There was an exception in the MOQ framework and apparently visual studio was trying to break in the MOQ framework source code but could not for some reason. Not sure why since it was compiled as debug manually by me and i did include the pdb file. Anyways this line was failing:
We usually set the base namespace on all our projects to nothing since we spell out exactly what our namespace will be. The line above doesn't like that of course and you get a "object reference not set to an instance of an object" but this isn't what i got. I will report this to the MOQ team.Still confused why i got the error i got but that is for another post :).