Unable to cast object of type 'StackExchange.Profiling.Data.ProfiledDbTransaction' to type 'System.Data.SqlClient.SqlTransaction'.
Hello!
I upgraded umbraco from 7.5.7 to 7.12.3, and suddenly my logs are filled with the error:
umbraco.DataLayer.SqlHelperException: Umbraco Exception (DataLayer): SQL helper exception in ExecuteReader ---> System.InvalidCastException: Unable to cast object of type 'StackExchange.Profiling.Data.ProfiledDbTransaction' to type 'System.Data.SqlClient.SqlTransaction'.
at umbraco.DataLayer.SqlHelpers.SqlServer.SqlServerHelper.ExecuteReader(String commandText, SqlParameter[] parameters)
at umbraco.DataLayer.SqlHelper`1.ExecuteReader(String commandText, IParameter[] parameters)
After trying to fix this, I reached a different error with the same underlying cause:
2018-10-19 15:03:29,897 [P1744/D2/T69] ERROR umbraco.DataLayer.SqlHelper`1[[System.Data.SqlClient.SqlParameter, System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] - Error executing query SELECT versionId FROM cmsDocument where nodeid=36757 AND newest = 1 ORDER BY updateDate desc
System.InvalidCastException: Unable to cast object of type 'StackExchange.Profiling.Data.ProfiledDbTransaction' to type 'System.Data.SqlClient.SqlTransaction'.
at umbraco.DataLayer.SqlHelpers.SqlServer.SqlServerHelper.ExecuteReader(String commandText, SqlParameter[] parameters) in C:\Dev\Umbraco-CMS\src\umbraco.datalayer\SqlHelpers\SqlServer\SqlServerHelper.cs:line 105
at umbraco.DataLayer.SqlHelper`1.ExecuteReader(String commandText, IParameter[] parameters) in C:\Dev\Umbraco-CMS\src\umbraco.datalayer\SqlHelper.cs:line 254
2018-10-19 15:03:29,897 [P1744/D2/T69] ERROR Umbraco.Core.Sync.DatabaseServerMessenger - DISTRIBUTED CACHE IS NOT UPDATED. Failed to execute instructions (id: 45, instruction count: 1). Instruction is being skipped/ignored
umbraco.DataLayer.SqlHelperException: Umbraco Exception (DataLayer): SQL helper exception in ExecuteReader ---> System.InvalidCastException: Unable to cast object of type 'StackExchange.Profiling.Data.ProfiledDbTransaction' to type 'System.Data.SqlClient.SqlTransaction'.
at umbraco.DataLayer.SqlHelpers.SqlServer.SqlServerHelper.ExecuteReader(String commandText, SqlParameter[] parameters) in C:\Dev\Umbraco-CMS\src\umbraco.datalayer\SqlHelpers\SqlServer\SqlServerHelper.cs:line 105
at umbraco.DataLayer.SqlHelper`1.ExecuteReader(String commandText, IParameter[] parameters) in C:\Dev\Umbraco-CMS\src\umbraco.datalayer\SqlHelper.cs:line 254
--- End of inner exception stack trace ---
at umbraco.DataLayer.SqlHelper`1.ExecuteReader(String commandText, IParameter[] parameters) in C:\Dev\Umbraco-CMS\src\umbraco.datalayer\SqlHelper.cs:line 259
at umbraco.cms.businesslogic.Content.get_Version()
at umbraco.cms.businesslogic.web.Document.setupNode()
at umbraco.content.UpdateDocumentCache(Int32 pageId)
at Umbraco.Web.Cache.PageCacheRefresher.Refresh(Int32 id)
Because of this I'm unable to publish consistently...
Unable to cast object of type 'StackExchange.Profiling.Data.ProfiledDbTransaction' to type 'System.Data.SqlClient.SqlTransaction'.
Hello!
I upgraded umbraco from 7.5.7 to 7.12.3, and suddenly my logs are filled with the error:
I have checked on github and it seems that on version 7.6 it was added some specifications on the type of the profiling transaction -> https://github.com/umbraco/Umbraco-CMS/commit/ab3b04c1659006006f781a7b72e483b18981d5d2
The error is being thrown from here https://github.com/umbraco/Umbraco-CMS/blob/release-7.12.3/src/umbraco.datalayer/SqlHelpers/SqlServer/SqlServerHelper.cs#L107
Does anyone knows what this is about and a way to fix it?
Thanks!
After trying to fix this, I reached a different error with the same underlying cause:
Because of this I'm unable to publish consistently...
For anyone suffering from the same issue, I solved by looking at the connection properties, to try and find one that was castable
https://github.com/Mindbus/Umbraco-CMS/commit/985a6146126567e442c51ae7ed84d44801c9385f
Basically I'm getting served a connection that isn't castable on that point. Still haven't figured out why though...
Hi João
Thanks for sharing.
Alex
Great Job @João! Lets just wait for Umbraco to make an official fix (or use the workaround you made)
is working on a reply...