Symptoms

Consider the following scenario:

  • You use SQL Server 2012, 2014, or 2016 Reporting Services.

  • You install Microsoft SQL Server 2014 Service Pack 1, a later cumulative update of SQL Server 2012 SP3, or a cumulative update of SQL Server 2016 .

  • You run an RDL report that's generated programmatically.

In this scenario, you may receive an error message that resembles the following:

processing!ReportServer_0-1!1328!01/14/2016-10:58:06:: e ERROR: Throwing Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: , Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: An unexpected error occurred in Report Processing. ---> System.IO.IOException: The process cannot access the file 'C:\Users\ReportServer\AppData\Local\Temp\kpw4qafn.out' because it is being used by another process. at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath) at System.IO.File.InternalDelete(String path, Boolean checkHost) at Microsoft.ReportingServices.RdlExpressions.VBExpressionCodeProvider.CompileAssemblyFromDomWithRetry(CompilerParameters options, CodeCompileUnit compilationUnit) at Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.InternalCompile(AppDomain compilationTempAppDomain, Boolean refusePermissions) at Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.<>c__DisplayClass2.<Compile>b__0() at Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.<>c__DisplayClass1.<Run>b__0(Object state) at System.Security.SecurityContext.runTryCode(Object userData) at System.Runtime.CompilerServices.RuntimeHelpers.ExecuteCodeWithGuaranteedCleanup(TryCode code, CleanupCode backoutCode, Object userData) at System.Security.SecurityContext.Run(SecurityContext securityContext, ContextCallback callback, Object state) at Microsoft.ReportingServices.Diagnostics.RevertImpersonationContext.Run(ContextBody callback) at Microsoft.ReportingServices.RdlExpressions.ExprHostCompiler.Compile(IExpressionHostAssemblyHolder expressionHostAssemblyHolder, AppDomain compilationTempAppDomain, Boolean refusePermissions, PublishingVersioning versioning) at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.Phase3(ParameterInfoCollection& parameters, Dictionary`2& groupingExprCountAtScope) at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.InternalCreateIntermediateFormat(Stream definitionStream, String& description, String& language, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]& dataSetsHash) at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CompileOdpReport(PublishingContext reportPublishingContext, PublishingErrorContext errorContext, String& reportDescription, String& reportLanguage, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, DataSetInfoCollection& sharedDataSetReferences, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks, Byte[]& dataSetsHash) at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(PublishingContext reportPublishingContext) --- End of inner exception stack trace ---

Note This error is also logged in the Reporting Services logs. 

Resolution

This problem was fixed in the following cumulative update for SQL Server:     Cumulative Update 5 for SQL Server 2016 RTM          Cumulative Update 2 for SQL Server 2016 SP1     Cumulative Update 9 for SQL Server 2014 Service Pack 1 

Cumulative Update 1 for SQL Server 2014 SP2

Cumulative Update 8 for SQL Server 2012 SP3

Cumulative Update 16 for SQL Server 2012 Service Pack 2 (SP2)

Cumulative Update 2 for SQL Server 2016

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:

Latest cumulative update for SQL Server 2014 Latest cumulative update for SQL Server 2016 Latest cumulative update for SQL Server 2012 SP3

Latest cumulative update for SQL Server 2012 SP2

Status

Microsoft has confirmed that this is a problem in the Microsoft products that are listed in the "Applies to" section.

References

Learn about the terminology that Microsoft uses to describe software updates.

Need more help?

Want more options?

Explore subscription benefits, browse training courses, learn how to secure your device, and more.

Communities help you ask and answer questions, give feedback, and hear from experts with rich knowledge.