Uploaded image for project: 'Spring.NET'
  1. Spring.NET
  2. SPRNET-1066

Wrong assembly version number used to specify CommandBuilder Type and Exception Type for SQL CE 3.5 provider

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 1.2.0 RC1
    • Fix Version/s: 1.2.0
    • Component/s: None
    • Labels:
      None
    • Environment:
      SQL CE 3.5, provider="SqlServerCe-3.5.1"

      Description

      Hello guys, just got this report from our dev:
      --------------------------------------------------------------------------------

      We've encountered an exception raised on the first call to ContextRegistry.GetContext() which says

      "Could not load file or assembly 'System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91' or one of its dependencies. The system cannot find the file specified."

      That exception does not bubble up to the application level, but causes a failure on a later stage (used Debug/Exceptions.../Break on CLR Exceptions in VS menu to pinpoint that original source of the problem).

      Technical details

      We use SQL CE 3.5 and the following Spring.NET DB provider:

      <db:provider id="dbProvider" provider="SqlServerCe-3.5.1" connectionString="$${db.connectionString}"/>

      System.Data.SqlServerCe.dll in SQL CE 3.5 has version 3.5.1.0
      System.Data.SqlServerCe.dll in SQL CE 3.1 had version 9.0.242.0

      We assume that SqlServerCe-3.5.1 should use the System.Data.SqlServerCe.dll of version 3.5.1.0 and should not depend on its previous version (9.0.242.0). However, judging by the exception under certain circumstances SqlServerCe-3.5.1 provider depends on the old DLL (9.0.242.0).

      Checked Spring.Data.Common.dbproviders.xml resource in the Spring.Data.dll (versions 1.1.2.20280 and 1.2.0.20288) and it seems that commandBuilderType (SqlCeCommandBuilder) and exceptionType (SqlCeException) reference the old DLL. See the excerpt below for details.

      <object id="SqlServerCe-3.5.1" type="Spring.Data.Common.DbProvider, Spring.Data" singleton="false">
      <constructor-arg name="dbMetaData">
      <object type="Spring.Data.Common.DbMetadata">
      <constructor-arg name="productName" value="Microsoft SQL Server Compact Edition, provider V3.5.1.0" />
      <constructor-arg name="assemblyName" value="System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
      <constructor-arg name="connectionType" value="System.Data.SqlServerCe.SqlCeConnection, System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
      <constructor-arg name="commandType" value="System.Data.SqlServerCe.SqlCeCommand, System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
      <constructor-arg name="parameterType" value="System.Data.SqlServerCe.SqlCeParameter, System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
      <constructor-arg name="dataAdapterType" value="System.Data.SqlServerCe.SqlCeDataAdapter, System.Data.SqlServerCe, Version=3.5.1.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
      <constructor-arg name="commandBuilderType" value="System.Data.SqlServerCe.SqlCeCommandBuilder, System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
      <constructor-arg name="commandBuilderDeriveParametersMethod" value="not supported"/>
      <constructor-arg name="parameterDbType" value="System.Data.SqlDbType, System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"/>
      <constructor-arg name="parameterDbTypeProperty" value="SqlDbType"/>
      <constructor-arg name="parameterIsNullableProperty" value="IsNullable"/>
      <constructor-arg name="parameterNamePrefix" value="@"/>
      <constructor-arg name="exceptionType" value="System.Data.SqlServerCe.SqlCeException, System.Data.SqlServerCe, Version=9.0.242.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91"/>
      <constructor-arg name="useParameterNamePrefixInParameterCollection" value="true"/>
      <constructor-arg name="useParameterPrefixInSql" value="true"/>
      <constructor-arg name="bindByName" value="true"/>
      <constructor-arg name="errorCodeExceptionExpression" value="Errors[0].NativeError.ToString()"/>
      <!-- TODO select form system db all errors that have 'incorrect syntax' at the start of the error string-->
      <property name="ErrorCodes.BadSqlGrammarCodes">
      <value></value>
      </property>
      <property name="ErrorCodes.PermissionDeniedCodes">
      <value></value>
      </property>
      <property name="ErrorCodes.DataIntegrityViolationCodes">
      <value></value>
      </property>
      <property name="ErrorCodes.DeadlockLoserCodes">
      <value></value>
      </property>
      </object>
      </constructor-arg>
      </object>

      Related ticket in JIRA: http://jira.springframework.org/browse/SPRNET-815

      Temporary workaround: <bindingRedirect oldVersion="9.0.242.0" newVersion="3.5.1.0"/>

      kind regards
      reinis

        Attachments

          Activity

            People

            • Assignee:
              mark.pollack Mark Pollack
              Reporter:
              reinis reinis vicups
            • Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: