debugging - Npgsql - 不支持指定的方法

标签 debugging nhibernate postgresql fluent-nhibernate npgsql

这可能与我在 FNH 遇到的其他问题有某种联系。

Fluent NHibernate cannot load MySql.Data from GAC in debug mode of a test

通常我得到一个简单的测试,首先运行以下代码:

FluentConfiguration config = Fluently
    .Configure()
    .Database(
        PostgreSQLConfiguration.Standard.ConnectionString(c => c.FromConnectionStringWithKey("PostgreSQLConnectionString")))
    .Mappings(m => m.FluentMappings.AddFromAssemblyOf<MyMapping>());

s_SessionSource = new SessionSource(config);

当我不在调试中运行它(只是运行测试)时它工作正常。

当我尝试调试时,我得到了 NotSupportedException: 第二行抛出 (new SessionSource one)

Specified method is not supported. at Npgsql.NpgsqlConnection.GetSchema(String collectionName, String[] restrictions) in C:\projects\Npgsql2\src\Npgsql\NpgsqlConnection.cs:line 970

为什么在调试时抛出异常,但在没有调试的情况下运行却没有错误? 我对此感到困惑。再次注意,当我运行代码时它工作正常,它访问 postgre db 没有问题。

请注意,这不是 Release 和 Debug 之间的区别,在这两种情况下都是调试,但在第一种情况下我运行调试,但在第二种情况下我运行代码而不调试。

编辑:发现这个问题:http://pgfoundry.org/forum/message.php?msg_id=1003008似乎是我的确切问题,但只发生在调试中。

最佳答案

Npgsql.NpgsqlConnection.GetSchema 在其 collectionName 参数未知时抛出 NotSupportedException。您也许应该升级到 latest patch支持 NHibernate 测试套件。

异常必须由 Fluent 捕获,但附加的调试器将在其上停止。

关于debugging - Npgsql - 不支持指定的方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7289061/

相关文章:

html - 如何调试tabindex

c++ - 保护类内存数组检测段错误

c++ - GDB 7.5 (OS X) : Can't access source from library functions

C# - Nhibernate 问题

sql - Nhibernate CreateSQLQuery 错误 - ',' 附近的 SetParameterList 语法不正确

java - PSQL异常 : A result was returned when none was expected

android - BubblePopupHelper 填充 Android 调试日志

c# - 流利的 NHibernate 错误 : The entity 'ClassMap` 1' doesn' t have an Id mapped

postgresql - 在不知道架构名称的情况下向组角色添加权限

PostgreSQL - 自更新序列字段