我正在使用MVC 4(测试版),并有一些问题试图测试我写的auth属性。调试到.net源不工作对我
为了更深入地研究这一点,我试图使用调试到.net框架源代码调试选项,以确切地看到错误。我按照这里的设置说明:http://weblogs.asp.net/gunnarpeipman/archive/2010/07/04/stepping-into-asp-net-mvc-source-code-with-visual-studio-debugger.aspx
做完所有这些之后,当我调试到我的测试中看看发生了什么,当我来到调用.net fw的代码行时,测试只是终止,并给我我想要调试的异常。为了完整性,这里是我的代码:
var controller = new MyController();
controller.SetFakeAuthenticatedControllerContext("foo"); // Set up a fake http context for the user
var actionDescriptor = new Mock<ActionDescriptor>();
actionDescriptor.SetupGet(x => x.ActionName).Returns("AddedForTest");
var context = new AuthorizationContext(controller.ControllerContext, actionDescriptor.Object);
var auth = new SamCommandAuthenticationAttribute();
auth.OnAuthorization(context); // On this line the test will just terminate
Assert.Pass(); // This line would never be called.
有谁知道为什么我无法调试到.net源?
你有pdb文件,对不对? – 2012-04-18 10:59:46
嗯,我从WPI安装了mvc4,我很确定它也获得了pdb。此外,我可以从源代码中手动导航到源代码,这让我可以看到mvc4代码,所以我认为我做... – 2012-04-18 11:04:23