Environment is Azure Devops Pipeline, running Code Coverage analysis of C# Unit Tests, accessing SQL Server via NHibernate, on Azure Devops Agent:
- SonarSource.sonarcloud.14d9cde6-c1da-4d55-aa01-2965cd301255.SonarCloudPrepare@1
- VSBuild@1
- VSTest@2
Result and Problem
- Running Pipeline with VSTest@2 Unit Tests works fine, 100% successful without SonarCloud.
- Wrapping the SonarSource.Sonarcloud task around the build and tests, immediately causes errors on every test which uses System.Data.SqlClient.SqlDataReader.Read() via NHibernate code as soon as it attempts to access SQL via connections string. Error is:
System.Data.SqlClient.SqlException : Failed to initialize the Common Language Runtime (CLR) v4.0.30319 with HRESULT 0x80004005. You need to restart SQL Server to use CLR integration features.
at System.Data.SqlClient.SqlConnection.OnError(SqlException exception, Boolean breakConnection, Action`1 wrapCloseInAction)
at System.Data.SqlClient.TdsParser.ThrowExceptionAndWarning(TdsParserStateObject stateObj, Boolean callerHasConnectionLock, Boolean asyncClose)
at System.Data.SqlClient.TdsParser.TryRun(RunBehavior runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj, Boolean& dataReady)
at System.Data.SqlClient.SqlDataReader.TryHasMoreRows(Boolean& moreRows)
at System.Data.SqlClient.SqlDataReader.TryReadInternal(Boolean setTimeout, Boolean& more)
at System.Data.SqlClient.SqlDataReader.Read()
at System.Data.SqlClient.SqlMetaDataFactory.addUDTsToDataTypesTable(DataTable dataTypesTable, SqlConnection connection, String ServerVersion)
at System.Data.SqlClient.SqlMetaDataFactory.GetDataTypesTable(SqlConnection connection)
at System.Data.SqlClient.SqlMetaDataFactory.PrepareCollection(String collectionName, String[] restrictions, DbConnection connection)
at System.Data.ProviderBase.DbMetaDataFactory.GetSchema(DbConnection connection, String collectionName, String[] restrictions)
at System.Data.SqlClient.SqlConnection.GetSchema(String collectionName, String[] restrictionValues)
at NHibernate.Dialect.Schema.AbstractDataBaseSchema.GetReservedWords()
at NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.GetReservedWords(Dialect dialect, IConnectionHelper connectionHelper)
at NHibernate.Tool.hbm2ddl.SchemaMetadataUpdater.UpdateDialectKeywords(Dialect dialect, IConnectionHelper connectionHelper)
at NHibernate.Impl.SessionFactoryImpl..ctor(Configuration cfg, IMapping mapping, Settings settings, EventListeners listeners)
at NHibernate.Cfg.Configuration.BuildSessionFactory()
- ALM used - Azure DevOps
- CI system used - Azure DevOps
- Languages of the repository - C#