【发布时间】:2016-06-10 02:36:20
【问题描述】:
我使用 UDF 为 SQL Server 2008 开发了一些 C# 程序集。 特别是我有一些使用 SQLite 数据库的函数。 我在那里添加了跟踪侦听器来编写一个日志文件以查看里面发生了什么。 但是有一个问题 - 每次调用 UDF 函数时,日志文件都会出现如下消息:
20160226,191636.67 [P5816]/[T4] Native library pre-loader failed to get setting "No_PreLoadSQLite" value: System.ArgumentNullException: Value cannot be null.
Parameter name: path1
at System.IO.Path.Combine(String path1, String path2)
at System.Data.SQLite.UnsafeNativeMethods.GetXmlConfigFileName()
at System.Data.SQLite.UnsafeNativeMethods.GetSettingValue(String name, String default)
我可以看到,在每次调用时,它都会为以下每个参数记录约 18 条此类消息:
"No_PreLoadSQLite", "PreLoadSQLite_NoSearchForDirectory", "PreLoadSQLite_ProcessorArchitecture",
"PreLoadSQLite_ProcessorArchitecture", "PreLoadSQLite_BaseDirectory", "PreLoadSQLite_UseAssemblyDirectory",
"PreLoadSQLite_ProcessorArchitecture", "No_PreLoadSQLite", "PreLoadSQLite_NoSearchForDirectory",
"PreLoadSQLite_ProcessorArchitecture", "PreLoadSQLite_ProcessorArchitecture", "PreLoadSQLite_BaseDirectory",
"PreLoadSQLite_UseAssemblyDirectory", "PreLoadSQLite_ProcessorArchitecture", "No_SQLiteConnectionNewParser",
"DefaultFlags_SQLiteConnection", "No_SQLiteFunctions", "SQLite_ForceLogPrepare"
看到日志中的所有消息有点烦人,很难跟踪与我感兴趣的功能相关的日志消息。
您能否建议一下 - 我如何才能摆脱那些额外/不需要的跟踪消息?
也许我需要调用一些特殊的 SQLlite API 来禁用所有设置的加载?
注意:为了让我的 UDF 程序集在 SQL Server CLR 引擎下工作,我复制了 SQLite.Interop.dll、System.Data.SQLite.dll 和 System.Data.SQLite.dll.config 文件放入 C:\Windows\system32。 如您所见,System.Data.SQLite.dll.config 文件与 System.Data.SQLite.dll 位于同一目录中,但没有帮助。
注意:两个 DLL SQLite.Interop.dll、System.Data.SQLite.dll 的版本均为 1.0.99.0。
提前谢谢你。
【问题讨论】:
标签: c# sqlite sql-server-2008