GoEddie / SQLCover

Apache License 2.0
63 stars 53 forks source link

Exception running code coverage: Unable to cast object of type 'System.DBNull' to type 'System.String' #71

Closed priyasomangali closed 3 years ago

priyasomangali commented 3 years ago

Hi @GoEddie

I am running SQLCover against a local database. However I am getting the below exception. at SQLCover.Source.DatabaseSourceGateway.GetBatches(List1 objectFilter) at SQLCover.CodeCoverage.GenerateResults(List1 filter, List`1 xml) at SQLCover.CodeCoverage.Cover(String command)

On running the query, SELECT sm.object_id, ISNULL('[' + OBJECT_SCHEMA_NAME(sm.object_id) + '].[' + OBJECT_NAME(sm.object_id) + ']', '[' + st.name + ']') object_name, sm.definition, sm.uses_quoted_identifier FROM sys.sql_modules sm LEFT JOIN sys.triggers st ON st.object_id = sm.object_id WHERE sm.object_id NOT IN(SELECT object_id FROM sys.objects WHERE type = 'IF');

I am getting results with values in all the columns.

Could you please help ?

Thanks, Priya

priyasomangali commented 3 years ago

It was happening due to the database config