You are currently offline, waiting for your internet to reconnect

FIX: Access violation when you maintain RBS with the .NET Framework 4.0 in related configuration file in SQL Server

Assume that you are using a custom RBS provider with Runtime .NET Framework 4.0 to store blobs remotely for SharePoint 2013. When you try to run the garbage cleanup which internally calls Microsoft.Data.SqlRemoteBlobs.Maintainer.exe, you receive the following exception during garbage collection:
Starting Maintainer tasks.
Starting Garbage Collection.
Starting Reference Scan.
<Time>:ERR:0:::AssemblyLoad:::An error occurred while reading extension file xxxx.RemoteBlobStoreProvider.dll.
<Time>:ERR:0:::AssemblyLoad::: System.BadImageFormatException: This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded. (Exception from HRESULT: 0x8013101B)
<Time>:ERR:0:::AssemblyLoad::: at System.Reflection.Assembly.nLoadFile(String path, Evidence evidence)
<Time>:ERR:0:::AssemblyLoad::: at System.Reflection.Assembly.LoadFile(String path)<Time>:ERR:0:::AssemblyLoad::: at Microsoft.Data.SqlRemoteBlobs.ProviderClass.Initialize()

The Maintainer utility is compiled with Runtime .NET Framework 2.0 and cannot load assemblies based out of the .NET Framework 4.0 for enumeration of blobs and garbage collection. For any .NET Framework application, you can use its configuration file and add supportedRuntime tag to use the later version of the .NET Framework. The configuration file of Maintainer component is Microsoft.Data.SqlRemoteBlobs.MaintainerConfig.xml, here is an example:
<startup>            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/></startup>
Now if you try to run the garbage cleanup, Microsoft.Data.SqlRemoteBlobs.Maintainer.exe encounters an access violation exception, the exception stack is following:
System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
at System.Text.StringBuilder.AppendFormat(IFormatProvider provider, String format, Object[] args)
at Microsoft.Data.SqlRemoteBlobs.InformationUtilities.InformationDetails()
at Microsoft.Data.BlobStores.LogProvider.CreateHeaderInformation()
at Microsoft.Data.BlobStores.LogProvider.Initialize(LogLevel logLevel)
at Microsoft.Data.BlobStores.DebugPrint.InitializeProviders()
at Microsoft.Data.BlobStores.DebugPrint.Initialize(Boolean initializeProviders)
at Microsoft.Data.BlobStores.DebugPrint.WriteLine(OperationType operation, LogLevel level, Int32 blobStoreId, Exception exception, String message, Object[] arg)
at Microsoft.Data.SqlRemoteBlobs.Maintainer.Maintainer.MainInternal() at Microsoft.Data.SqlRemoteBlobs.Maintainer.Maintainer.Main(String[] args)
The first exception occurs because the maintainer utility is compiled with the .NET Framework 2.0 and cannot load assemblies based out of the .NET Framework 4.0. The access violation exception occurs when you try to initialize the logging providers for Microsoft.Data.SqlRemoteBlobs.Maintainer.exe.
The issue was first fixed in the following cumulative update of SQL Server.
After you apply the fix, the access violation exception issue should be resolved. If you have used the workaround suggested, you can go-ahead and remove/enable the Logging related tags and keeps the supportRuntime tag.

Note You could reinstall RBS by using the new RBS.msi to apply the fix without applying the update.

Cumulative Update 1 for SQL Server 2012 SP2

Cumulative Update 2 for SQL Server 2014

Cumulative Update 10 for SQL Server 2012 SP1

About cumulative updates for SQL Server

Each new cumulative update for SQL Server contains all the hotfixes and all the security fixes that were included with the previous cumulative update. Check out the latest cumulative updates for SQL Server:
To work around this situation you can add the following additional configuration to the configuration file together with the supportedRuntime tag. These tags disable logging capability for the Maintainer application as the exception is being thrown while initializing the logging providers.
 <startup>            <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/> </startup>     <RemoteBlobStorage>        <Logging>            <add key="ConsoleLog" value="0" />            <add key="FileLog" value="0" />            <add key="CircularLog" value="0" />            <add key="EventViewerLog" value="0" />            <add key="DatabaseTableLog" value="0" />        </Logging>    </RemoteBlobStorage>
Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

Article ID: 2960310 - Last Review: 03/14/2016 07:35:00 - Revision: 4.0

Microsoft SQL Server 2012 Service Pack 1, Microsoft SQL Server 2014 Developer, Microsoft SQL Server 2014 Enterprise, Microsoft SQL Server 2014 Standard, Microsoft SQL Server 2012 Service Pack 2

  • kbqfe kbfix kbsurveynew kbexpertiseadvanced KB2960310