Join 34,000+ subscribers and receive articles from our
blog about software quality, testing, QA and security.

Unhandled exception in SmartInspectLinqToSqlAdapter.Write method


#1

Hello,

I make heavy use of the LINQ logging feature. From time to time, i get the following exception:

System.NullReferenceException: Object reference not set to an instance of an object.
at Gurock.SmartInspect.LinqToSql.SmartInspectLinqToSqlAdapter.Write(String value)
at Devart.Data.Linq.Provider.DataProvider.LogCommand(IDbCommand dbCommand)
at Devart.Data.Linq.Provider.DataProvider.ExecuteQuery(CompiledQuery compiledQuery, Object[] parentArgs, Object[] userArgs, Object lastResult)
at Devart.Data.Linq.Provider.DataProvider.ExecuteAllQueries(CompiledQuery compiledQuery, Object[] userArguments)

Devart is my LINQ to Oracle provider.

The exception is not so frequent. In hundreds of query logs, 1 is faulted. Can you make something out of this?


#2

Hello,

Thanks for the report. We will look into this and I will let you know when we know more (likely on Monday). Thanks!

Regards,
Dennis


#3

Hello,

[quote]The exception is not so frequent. In hundreds of query logs, 1 is faulted. Can you make something out of this?
[/quote]

We’ve looked into this issue and it seems that the only case a NullReferenceException can be thrown is when the given ‘value’ argument to this function is null. I’m not sure under which circumstances the Devart provider might pass null to the logger but we haven’t seen this behavior with the standard .NET LINQ providers. You could add a null-check for the ‘value’ argument to the Write function, recompile our SmartInspect to LINQ adapter and retry with the modified version. We might also add this check to future versions of the adapter.

Regards,
Tobias