Note that there are some explanatory texts on larger screens.

plurals
  1. POReportViewer locking up for quite a while on GetDefaultPageSettings()
    text
    copied!<p>I recently encountered a very weird problem with report viewer (Windows Forms). Normally the reportviewer behaves very well, loads fast and shows the reports nicely. But, we encountered a certain <em>scenario</em> in which it to takes ages to show the report. I cannot post the whole code as it is not clear what causes the problem.</p> <h3>The problem</h3> <p>The following method call causes the problem (again, only in a very specific scenario):</p> <pre><code>reportViewer.LocalReport.GetDefaultPageSettings() </code></pre> <p>It can take up to 10 minutes for the application get past this line and in fact, if this line is commented out then everything starts working perfectly.</p> <h3>The <code>special</code> scenario</h3> <p>The only difference in the special scenario that causes the problem is that right before showing the report some python code gets executed before the report is shown (via IronPython and in the same AppDomain, the python code does not reference anything even close to reporting).</p> <h3>Profiler, anyone?</h3> <p>Ok, so I run this scenario with a profiler (Xte) and noticed that the method <code>IronPython.Runtime.PythonContext.LoadAssemblyFromFile</code> is the one that freezes up. There is no explicit assembly-loads in python code we are running, so this is an automated assembly load.</p> <h3>The weird part</h3> <p>So, the weird part that I cannot get is how are those two things connected? I took a look at the <code>GetDefaultPageSettings()</code> in ILSpy and saw this:</p> <pre><code>public override ReportPageSettings GetDefaultPageSettings() { object syncObject; Monitor.Enter(syncObject = this.m_syncObject); ReportPageSettings pageProperties; try { this.EnsureExecutionSession(); pageProperties = this.m_pageProperties; } finally { Monitor.Exit(syncObject); } return pageProperties; } </code></pre> <p>And I can only guess that its the lock that is causing this method to hang, but I cannot understand how executing python affects this lock. I mean, it is absolutely clear that if I do not run the python code then this method executes perfectly fine without delays.</p> <p>And by the way - after approx. 10 minutes the thing shows the report. It just locks up for 10 minutes and then continues normally.</p> <h3>Suggestions on where to go from here?</h3> <p>So, I would really appreciate if anyone can give me any info on there should I go now. At the moment I am trying to isolate the case in a separate clean project and as soon as I succeed I will post it here.</p> <p>Thanks!</p> <h3>Update 1: Python script example</h3> <p>So far I only got one piece of additional information - this problem occurs even if you run a minimal script. So, even executing script <code>0</code> (which just returns 0) the problem will occur.</p> <h3>Update 2: Running in a separate domain</h3> <p>Running python in a separate domain did not help. The issue is still present.</p> <h3>Update 3: CurrentUICulture is involved!</h3> <p>During my debugging sessions I noticed at some point that in the problematic scenario AppDomain tries and fails to resolve the following resource assemblies:</p> <pre><code>mscorlib.resources, Version=4.0.0.0, Culture=fi, PublicKeyToken=b77a5c561934e089 mscorlib.resources, Version=4.0.0.0, Culture=fi-FI, PublicKeyToken=b77a5c561934e089 </code></pre> <p>This is the reason for the 10-minute delay - it just tries to load that assembly over and over again (both <code>CurrentCulture</code> and <code>CurrentUICulture</code> are set to <code>fi-FI</code>). If, however, I change the <code>CurrentUICulture</code> to <code>en-US</code> then the problem disappears (as it not longer needs that assembly.</p> <p>But again - the mystery still remains - if the <code>CurrentUICulture</code> is set to <code>fi-FI</code> and I execute any script via IronPython it will desperately try to load this resources file and fail all the time. If anyone is able to explain this to me - please do :)</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload