Vojin Stefanovic
Vojin Stefanovic

Reputation: 101

RDLC net 4.5.2. - Operation could destabilize the runtime

When I try to export report in PDF/Excel/Word or print report, I got a error. Error description :

Server Error in '/' Application.

Operation could destabilize the runtime. 
  Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

 Exception Details: System.Security.VerificationException: Operation could destabilize the runtime.

Source Error:

An unhandled exception was generated during the execution of the current web request. Information regarding the origin and location of the exception can be identified using the exception stack trace below.

Stack Trace:

[VerificationException: Operation could destabilize the runtime.]

[TypeInitializationException: The type initializer for 'System.Diagnostics.Activity' threw an exception.]

[TargetInvocationException: Exception has been thrown by the target of an invocation.]
   System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg) +153
   System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type) +336
   System.Collections.Generic.IList`1.get_Item(Int32 index) +0
   Microsoft.ReportingServices.ReportIntermediateFormat.TextBox.SetExprHost(ReportExprHost reportExprHost, ObjectModelImpl reportObjectModel) +101
   Microsoft.ReportingServices.OnDemandProcessing.OnDemandProcessingContext.RuntimeInitializeTextboxObjs(ReportItem reportItem, Boolean setExprHost) +74
   Microsoft.ReportingServices.OnDemandReportRendering.OnDemandPageEvaluation.InitializeEnvironment() +778
   Microsoft.ReportingServices.OnDemandReportRendering.OnDemandPageEvaluation..ctor(Report report) +84
   Microsoft.ReportingServices.OnDemandReportRendering.Report..ctor(Report reportDef, ReportInstance reportInstance, RenderingContext renderingContext, String reportName, String description) +100
   Microsoft.ReportingServices.ReportProcessing.Execution.RenderReportOdp.PrepareROM(RenderingContext& odpRenderingContext) +158
   Microsoft.ReportingServices.ReportProcessing.Execution.RenderReport.Execute(IRenderingExtension newRenderer) +306

[LocalProcessingException: An error occurred during local report processing.]
   Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings) +166
   Microsoft.Reporting.WebForms.LocalModeSession.RenderReport(String format, Boolean allowInternalRenderers, String deviceInfo, NameValueCollection additionalParams, Boolean cacheSecondaryStreamsForHtml, String& mimeType, String& fileNameExtension) +193
   Microsoft.Reporting.WebForms.ExportOperation.PerformOperation(NameValueCollection urlQuery, HttpResponse response) +514
   Microsoft.Reporting.WebForms.HttpHandler.ProcessRequest(HttpContext context) +250
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +188
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

Version Information: Microsoft .NET Framework Version:4.0.30319; ASP.NET Version:4.6.1087.0

Any ideas. Thanks.

Upvotes: 10

Views: 2833

Answers (6)

Roger
Roger

Reputation: 457

I had the same issue and was able to resolve it by commenting out the Microsoft.ApplicationInsights.Web.AspNetDiagnosticTelemetryModule in the ApplicationInsights.config.

Upvotes: 2

mhussain
mhussain

Reputation: 29

I had this issue too. Started to see this issue after I had upgraded NuGet packages in my application to the latest version. The application would worke fine on my development machine, but once I deployed the it to a production server I started to see this error when trying to access a ReportViewer page.

I ended up removing all ApplicationInsights NuGet packages in my application. This got rid of the reference to the System.Diagnostics.DiagnosticsSource dll and then my application started working normaly.

Upvotes: -1

user2453683
user2453683

Reputation: 91

Here's how I fixed mine.

  1. Find the NuGet package System.Diagnostics.DiagnosticSource installed in your web project. Mine was already at the latest version.
  2. Downgrade it to the last stable version. In my case, it was 4.4.0.
  3. Once downgrade is complete, upgrade it again to the latest version. Rebuild solution and check. My error went away.

The down/up grading process updated the items needed in web.config to make it work again.

Upvotes: 4

Mateus Cerqueira
Mateus Cerqueira

Reputation: 467

I started getting this message in the past two months or so and now i think i found the problem.

As you can see in this issue on Github it seems there's a problem when using ApplicationInsights v2.4.0 because it references a dll called System.Diagnostics.DiagnosticsSource (v4.4.0) and (as stated in the issue) this new reference causes the problem.

The date that they were copied to that folder was about two months ago (when this issue started to happen for me). And i coudn't reproduce this problem in DEV/QAS because the dll's were not "installed" in these environments.

When i removed these dll's from the bin folder of my app the problem was gone. Since my app didn't reference these dll's for nothing there was no problem removing them.

But if you can't remove them, it seems v4.5.0 of System.Diagnostics.DiagnosticsSource will fix this problem but it was not officially released yet. Keep track of the Github issue for more details.

Upvotes: 4

Peter Bannister
Peter Bannister

Reputation: 37

Just been through the pain of this message! We are using webroles on azure with RDLC's being part of key things such as invoice print.

For us the answer was to go to the properties of the webrole and TURN OFF "enable diagnostics".

ATM, this is still with MSFT support so cannot give you a reason why, but this fixed our issue of RDLC's crunching live ! Hope this helps someone Regards Peter

Upvotes: 2

aherrick
aherrick

Reputation: 20169

I fixed this by downgrading my NuGet package to:

Microsoft ReportViewer Runtime 2008 for Web Forms - 9.0.21022.8

Upvotes: -1

Related Questions