gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-11-29 13:06:56 24 4
gpt4 key购买 nike

这可能与我在 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/

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