0

I have an unhandled exception in my code which:

  • crashes my testhost.exe process
  • and fails my azure pipeline build (exactly within the VSTest task).

Exception: 0xC0000005: Access violation read location 0xFFFFFFFFFFFFFFFF

After analyzing the dump file of the crash, I found that:

  • this exception appears when I try to save my pdf document in the specified stream using the "save" method of the PdfManager class, I am using the Select.Pdf.x64 library.

For information: I'm migrating my build from xaml builds to azure pipeline builds with upgrading the test framework from MSTest to MSTestV2, I'm building my projects using the MSBuild task with the "release" configuration and with "Any CPU" as a platform,for "VSTest" Task I'm using "x64" as a build platform, "release" as a configuration, MSTest.TestAdapter.2.1.1 as a test adapter, I'm using VS 2019 and here is the runsetting file:


<?xml version="1.0" encoding="utf-8"?>
<RunSettings>
  <!-- Configurations that affect the Test Framework -->
  <RunConfiguration> 
    <MaxCpuCount>0</MaxCpuCount>
    <ResultsDirectory>.\TestResults</ResultsDirectory>
    <TargetPlatform>x64</TargetPlatform>
    <TargetFrameworkVersion>.NETFramework,Version=v4.7.2</TargetFrameworkVersion>
    <DisableParallelization>false</DisableParallelization> 
  </RunConfiguration>
  <MSTest>
    <TestTimeout>360000</TestTimeout>
    <Parallelize>
      <Workers>10</Workers>
      <Scope>MethodLevel</Scope>
    </Parallelize>
  </MSTest>
  <DataCollectionRunSettings>
    <DataCollectors>
      <DataCollector friendlyName="blame" enabled="True">
        <Configuration>
          <ResultsDirectory>.\TestResults</ResultsDirectory>
          <CollectDump />
          <CollectDump />
        </Configuration>
      </DataCollector>
    </DataCollectors>
  </DataCollectionRunSettings>
  <LoggerRunSettings>
    <Loggers>
      <Logger friendlyName="blame" enabled="True" />
    </Loggers>
  </LoggerRunSettings>
</RunSettings>

--------------------------------------------------------------------------------------------------

I have tried to catch the exception with decorating the method responsible for the exception using the decorators "[HandleProcessCorruptedStateExceptions, SecurityCritical] but without success :( .

Anyone have a solution ?

mrtig
  • 2,217
  • 16
  • 26
hergli sedki
  • 65
  • 2
  • 4

3 Answers3

0

testhost.exe crush with access violation exception

There is a know issue starting from Visual Studio 2019 16.4.3.

To resolve this issue, please try to update your Visual Studio 2019 to the latest version.

Leo Liu
  • 71,098
  • 10
  • 114
  • 135
  • 1
    I updated the VS to 16.4.3, the issue still appear within the Select.PDF.x64 library. – hergli sedki Aug 17 '20 at 07:56
  • @herglisedki, OK, I will look further to see if there are other reasons for this error. Also, if you have any new developments, please let me know for free. – Leo Liu Aug 19 '20 at 09:09
0

Downgrading to mstest v1 everything works fine, it seems related to the QTAgent process because only mstest v1 launch QTAgent process through testhost process. ​ ​Thks for help :)

hergli sedki
  • 65
  • 2
  • 4
-2

This issue mostly occurs while wrong declaration classes or some wrong pattern fallows in syntax which may cause access violation.

Problem:
testhost.exe crashes with access violation and webdriver/browser is not initiating.

solution:
Check your classes and function calling declaration method and check is it properly compatible/fallows to your texthost.exe rules.

Tyler2P
  • 2,324
  • 26
  • 22
  • 31
EhsanAlam
  • 1
  • 3