How can we help you today? How can we help you today?

"Operation could destabilize the runtime"

Using the latest ANTS Performance Profiler together with this small console program:
namespace AntsHtmlAgilityPackTests
{
    using HtmlAgilityPack; // Included via NuGet package.

    internal static class Program
    {
        private static void Main()
        {
            new HtmlDocument();
        }
    }
}
An error occurs when running inside ANTS Performance Profiler with highest profiling mode (line-level timings):
System.Security.VerificationException: Operation could destabilize the runtime
The stack trace is:
at HtmlAgilityPack.HtmlDocument..ctor() in D:SVN_CHECKOUThtmlagilitypackTrunkHtmlAgilityPackHtmlDocument.cs:Line 26.
at AntsHtmlAgilityPackTests.Program.Main() in c:UsersukeimTestsMain.cs:Line 12.
When running in a lower profiling mode ("orange", method-level timings), no error occurs.

My question:

How can I work-around this issue?

(I need to have line-level profiler results so switching to a lower mode is not an option)
Uwe Keim
0

Comments

3 comments

  • Uwe Keim
    Using ILSpy, I found this to be the constructor of HtmlAgilityPack that crashes:
    public HtmlDocument()
    {
    	this._documentnode = this.CreateNode(HtmlNodeType.Document, 0);
    	this.OptionDefaultStreamEncoding = Encoding.Default;
    }
    
    I see no special behaviour here.

    Would be interesting to see the "instrumented" code of this constructor after it goes through ANTS Profiler.
    Uwe Keim
    0
  • dom.smith
    Hi,

    Please try adding HtmlAgilityPack.HtmlDocument to the line-level timings block list. For more information, see: http://documentation.red-gate.com/display/APP9/Profiling+SecurityTransparent+and+partially-trusted+assemblies#ProfilingSecurityTransparentandpartially-trustedassemblies-block-list

    Dom.
    dom.smith
    0
  • Uwe Keim
    Thanks a lot, that did the trick.

    I've added
    <assemblyName>HtmlAgilityPack</assemblyName>
    
    to the file
    "C:UsersukeimAppDataLocalRed GateANTS Performance Profiler 9LineLevelBlacklist.xml"
    and restarted the profiler.

    After that, the profiling succeeds without any errors, even in line level mode.
    Uwe Keim
    0

Add comment

Please sign in to leave a comment.