[英]How can I avoid NullReferenceException when setting the DataSource of a listBox in C#?
[英]NullReferenceException when setting a out parameter in c#
我在 c# 中使用 easyhook 得到了一個不安全的程序集.. 這段代碼波紋管運行良好,但總而言之,調用此方法時出現 NullReferenceException ..
這個類的實例是一個單例模式它經過了幾次,有一次它得到了一個空引用
此類用於攔截某些 I/O 文件中的所有寫入以進行某些操作
任何想法見代碼..
僅在執行 SQLCOMMAND 時發生
在 ....SystemHook.WriteFileHook(IntPtr hFile, Void* lpBuffer, UInt32 nNumberOfBytesToWrite, UInt32& lpNumberOfBytesWritten, NativeOverlapped& lpOverlapped)
在 SNIWriteSyncOverAsync(SNI_ConnWrapper* , SNI_Packet* )
在 SNINativeMethodWrapper.SNIWritePacket(SafeHandle pConn, SafeHandle packet, Boolean sync)
在 System.Data.SqlClient.TdsParserStateObject.SNIWritePacket(SNIHandle 句柄,SNIPacket 數據包,UInt32& sniError,Boolean canAccumulate,Boolean callerHasConnectionLock)
在 System.Data.SqlClient.TdsParserStateObject.WriteSni(Boolean canAccumulate)
在 System.Data.SqlClient.TdsParserStateObject.WritePacket(Byte flushMode, Boolean canAccumulate)
在 System.Data.SqlClient.TdsParserStateObject.ExecuteFlush()
在 System.Data.SqlClient.TdsParser.TdsExecuteSQLBatch(String text, Int32 timeout, SqlNotificationRequest notificationRequest, TdsParserStateObject stateObj, Boolean sync, Boolean callerHasConnectionLock, Byte[] enclavePackage)
在 System.Data.SqlClient.SqlCommand.RunExecuteReaderTds(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, Boolean async, Int32 timeout, Task& task, Boolean asyncWrite, Boolean inRetry, SqlDataReader ds, Boolean describeParameterEncryptionRequest)
在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String 方法, TaskCompletionSource`1 完成, Int32 超時, Task& 任務, Boolean&usedCache, Boolean asyncWrite, Boolean inRetry)
在 System.Data.SqlClient.SqlCommand.RunExecuteReader(CommandBehavior cmdBehavior, RunBehavior runBehavior, Boolean returnStream, String method)
在 System.Data.SqlClient.SqlCommand.ExecuteReader(CommandBehavior 行為,String 方法)
在 System.Data.SqlClient.SqlCommand.ExecuteDbDataReader(CommandBehavior 行為)
在 System.Data.Common.DbCommand.ExecuteReader()
bool WriteFileHook(IntPtr hFile, void* lpBuffer, uint nNumberOfBytesToWrite, out uint lpNumberOfBytesWritten, [In] ref System.Threading.NativeOverlapped lpOverlapped)
{
bool results = false;
bool write = true;
lpNumberOfBytesWritten = 0; // CRASH!!!
...
}
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.