-
Notifications
You must be signed in to change notification settings - Fork 67
-
Notifications
You must be signed in to change notification settings - Fork 67
Adding ApplicationInsights to Asp.Net project that uses MSReportViewer breaks reports #684
Comments
@lmolkova can you help take a look here? |
Hello @elexisvenator I'm not sure VerificationException is related to the fact Activity is Serializable or uses guids during static initialization. Serialization attribute was only applied on .NET 4.5, but not on other .NET versions. The VerificationException happens presumably because your app runs in partially trusted mode and perhaps some security attributes are missing on Activity. Could you please check this article and try to configure different trust levels for report viewer? Thanks, |
Hi @lmolkova I don't believe that the issue is trust related, the application is currently running in Full trust mode. (No strong names in use etc.) Here is the full stack trace of all inner exceptions, I didn't realise that the screenshot didn't include everything. The very bottom of the stack trace is why I suspect serialization of Activity might be the issue:
|
@elexisvenator You can validate serialization assumption by trying DiagnosticSource 4.5.0 (latest) from https://dotnet.myget.org/F/dotnet-core/api/v3/index.json nuget source. Activity is no longer serializable even on 4.5: dotnet/corefx@cb1c1df#diff-e4e08aebec9253d67b26eda5bbb91353 Note that according to https://msdn.microsoft.com/en-us/library/hh286315.aspx ReportViewer control runs in the partial trust mode. Thanks for the full stack trace, it seems that System.Diagnostics.Activity.GetRandomNumber() misses some security related attribute. I'll check on that. But it would really help if you try to change the trust level on the report viewer to validate security assumption? |
Hi @lmolkova Regarding trusts, The ReportViewer control that I am using is run in full trust as I am using local processing mode. Any other trust level will cause a security exception. I didn't know this myself until trying to change the trust using the msdn article you linked. (see the important message at the top of the article). |
interesting! Thanks for checking. Then what happened on net 4.7? Was it the same issue? Would you be able to use 4.5.0 from the myget feed? There were no considerable changes from 4.4.0 except serialization, so if you stick to the particular version of 4.5.0 (e.g. current), it should be as stable as 4.4.0. There might be some workarounds for the issue with 4.4.0. Would you be able to provide repro app so I try to find some workarounds? Thanks, |
Hi @lmolkova The stack trace is the same for .net 4.7. I am having trouble creating a repro app that encounters the issue, my guess is there is some other library or configuration in our main app that combines with 4.4.0 to create the perfect storm, but I haven't found a way to isolate it yet. I will keep trying. In the meantime I have tweaked our build to support restoring packages from the myget source. Thanks for the help, |
Upgrading to DiagnosticsSource 4.4.1 (stable) fixed this error for me on NET47. |
.net 4.5.2 (also affects up to 4.7)
Microsoft.AspNet.Mvc 5.2.0 (also affects 5.2.3)
ApplicationInsights 2.4.1 (Issue present as of 2.4.0)
Our application uses MsReportViewer to render .rdlc files. As of ApplicationInsights v2.4.0, there is now a reference to System.Diagnostics.DiagnosticsSource. This new reference appears to be causing issues when rendering rdlc files, see below.
What I believe is happening is CreateSnapshot() is attempting to serialise the report and its configuration, but at some point a System.Diagnostics.Activity instance has been attached. This happens regardless of whether Application Insights is enabled, it only needs to be installed.
Activity.cs contains a number of fields that are initialized by generating a new Guids, which I believe is the ultimate cause of the exception. I cant find any way of preventing Activity objects being created when in the reporting requests so for now I have a choice of either having AppInsights logging or having reporting.
Possible fixes (assuming I was right about the cause):
The text was updated successfully, but these errors were encountered: