我现在遇到一个很奇怪的问题,在调试一个单元测试。如果我调试单元测试(Ctrl + R键Ctrl + T键),我得到一个未捕获的异常。如果我只是运行单元测试(CTRL + RT)我不明白此异常。
I'm encountering a very strange issue while debugging a unit test. If I debug the unit test (ctrl+r ctrl+t) I am getting an uncaught exception. If I just run the unit test (ctrl+r t) I do not get this exception.
未捕获的异常是一个 NHibernate.ByteCode.ProxyFactoryFactoryNotConfiguredException。
堆栈跟踪:
at NHibernate.Bytecode.AbstractBytecodeProvider.get_ProxyFactoryFactory() in d:\CSharp\NH\NH\nhibernate\src\NHibernate\Bytecode\AbstractBytecodeProvider.cs:line 32 at NHibernate.Validator.Util.NHibernateHelper.IsProxyFactoryConfigurated()我用反射来看看定义此方法(NHibernate.Validator大会。 ..它是开源的),这里是抛出异常的方法:
I used .Net Reflector to look at the assembly that defines this method (NHibernate.Validator ... it's open source) and here is the method that "throws" the exception:
public static bool IsProxyFactoryConfigurated() { try { IProxyFactoryFactory proxyFactoryFactory = Environment.BytecodeProvider.ProxyFactoryFactory; return true; } catch (ProxyFactoryFactoryNotConfiguredException) { return false; } }
这怎么能例外不会被捕获的尝试捕捉阻止?
How can this exception not be caught by that Try Catch block?
推荐答案这听起来像你看到的第一次机会异常。
你有破第一次机会异常启用?您应该能够配置它在调试 - >例外菜单。
Do you have "Break on first-chance exceptions" enabled? You should be able to configure it in the Debug->Exceptions menu.
更多推荐
在单元测试C#uncaught异常
发布评论