Copied to clipboard

Flag this post as spam?

This post will be reported to the moderators as potential spam to be looked at


  • João 3 posts 94 karma points
    Oct 18, 2018 @ 10:51
    João
    0

    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)
    

    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!

  • João 3 posts 94 karma points
    Oct 19, 2018 @ 13:05
    João
    0

    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...

  • João 3 posts 94 karma points
    Oct 19, 2018 @ 16:00
    João
    101

    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...

  • Alex Skrypnyk 6132 posts 23951 karma points MVP 7x admin c-trib
    Oct 19, 2018 @ 20:07
    Alex Skrypnyk
    0

    Hi João

    Thanks for sharing.

    Alex

  • Luis Paulo Silva 2 posts 74 karma points
    Oct 22, 2018 @ 09:34
    Luis Paulo Silva
    1

    Great Job @João! Lets just wait for Umbraco to make an official fix (or use the workaround you made)

Please Sign in or register to post replies

Write your reply to:

Draft