chevron-thin-right chevron-thin-left brand cancel-circle search youtube-icon google-plus-icon linkedin-icon facebook-icon twitter-icon toolbox download check linkedin phone twitter-old google-plus facebook profile-male chat calendar profile-male
Welcome to Typemock Community! Here you can ask and receive answers from other community members. If you liked or disliked an answer or thread: react with an up- or downvote.
0 votes
Somebody already had the problem but their was with a different version and seemed to involve NCover.
I am using version v5.4.5.0. I have both the 32-bit and 64-bit versions installed on my box, because different launching programs seem to need different versions. When running from inside VisualStudio through ReSharper everything works fine, however when running from Nant I get:
[gallio] System.AccessViolationException: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
[gallio] at System.ServiceModel.Description.ConfigLoader.CheckAccess(IConfigurationContextProviderInternal element)
[gallio] at System.ServiceModel.Description.ConfigLoader.LookupService(String serviceConfigurationName)
[gallio] at System.ServiceModel.ServiceHostBase.LoadConfigurationSectionInternal(ConfigLoader configLoader, ServiceDescription description, String configurationName)
[gallio] at System.ServiceModel.ServiceHostBase.ApplyConfiguration()
[gallio] at System.ServiceModel.ServiceHostBase.InitializeDescription(UriSchemeKeyedCollection baseAddresses)
[gallio] at System.ServiceModel.ServiceHost..ctor(Object singletonInstance, Uri[] baseAddresses)
[gallio] at ControllerTest.ControllerServiceTest.SetUp() in d:ControllerTestControllerServiceTest.cs:line 56
asked by ScottR (840 points)

19 Answers

0 votes
Hi Scott,

Can you please give me more details about the run?
What exactly are you running? (Test runner, coverage tool etc.)
Can you please post the part of the script that runs with the Isolator?

Also note that you on Isolator versions before version 6.0 you can not use the 32 bit installer on 64 bit machines.
From version 6.0 there is one installer for both platforms.
answered by ohad (35.4k points)
0 votes
Sorry for the late response, I assumed that when I clicked "watch this topic" that it would send me an e-mail when it changed. I was just stopping by to check how long it had been when I noticed your response.

Here is an excerpt of the script:
<target name="gallio" failonerror="true">
<!-- Dynamically load TypeMock task. -->
<loadtasks assembly="${typeMockTasks}" />
<typemockregister company="<deleted>" license="<deleted>" autodeploy="true"/>
<!-- Dynamically load Gallio task. -->
<loadtasks assembly="${gallioNantTasks}" />

<gallio report-directory="BuildResults"
report-name-format="T6000NativeTest"
report-types="Xml-Inline;Html"
show-reports="${showReports}"
result-property="ExitCode1"
failonerror="false">
<plugin-directories>
<include name="${gallioBase}" />
</plugin-directories>
<files>
<include name="InstrumentUtilitiesTestin${flavor}InstrumentUtilitiesTest.dll" />
</files>
</gallio>

<gallio runner-type="TypeMock"
report-directory="BuildResults"
report-name-format="T6000MockedTest"
report-types="Xml-Inline;Html"
show-reports="${showReports}"
result-property="ExitCode2"
failonerror="false">
<plugin-directories>
<include name="${gallioBase}" />
</plugin-directories>
<files>
<include name="ControllerTestin${flavor}ControllerTest.dll" />
</files>
</gallio>
<fail if="${ExitCode1 != '0'}" >The return code should have been 0!</fail>
<fail if="${ExitCode2 != '0'}" >The return code should have been 0!</fail>
<typemockstop undeploy="true" />
</target>



With these defines:
<property name="gallioBase" value="${project::get-base-directory()}..ExternalGallio3.1.397.0" />
<property name="gallioNantTasks" value="${gallioBase}Gallio.NAntTasks.dll" />
<property name="typeMockBase" value="${project::get-base-directory()}..ExternalTypeMock5.4.5.0" />
<property name="typeMockTasks" value="${typeMockBase}TypeMock.NAntBuild.dll" />


Also you are right about the installed versions the other version looks like an orpahned directory.
answered by ScottR (840 points)
0 votes
Hi,

What version of NCover are you using?

Regards,
Elisha,
Typemock Support
answered by Elisha (12k points)
0 votes
I have not linked TypeMock with NCover.
answered by ScottR (840 points)
0 votes
Hi,

Forget about the NCover question, I confused it with the comment from the first post :)

This issue happens most likely due to a mismatch between x86 & x64 processes. I would like to try something in order to see if this is the problem.

Set Nant to run in 32bit mode (in VS command prompt: corflags /32bit+ NAnt.exe). Then, run again the build script using that Nant.exe and let me know if the script runs correctly.

Regards,
Elisha,
Typemock Support
answered by Elisha (12k points)
0 votes
That might have helped (I forgot to grab a before snapshot), but I still have at least 8 failing unit tests with the same error. Could it be something related to Gallio?

[loadtasks] Scanning assembly "Gallio.NAntTasks" for extensions.
[gallio] Gallio NAnt Task - Version 3.1 build 397
[gallio] Start time: 1:10 PM
[gallio] Stop time: 1:10 PM (Total execution time: 18.881 seconds)
[gallio] Gallio NAnt Task - Version 3.1 build 397
[gallio] Start time: 1:10 PM
[gallio] Starting TypeMock.
[gallio] [failed] Test ControllerTest/BiosensorWorkflowTest/TestSaveSpectralD
ata/TestSaveSpectralData(true)
[gallio] Execute
[gallio] System.AccessViolationException: Attempted to read or write protecte
d memory. This is often an indication that other memory is corrupt.
answered by ScottR (840 points)
0 votes
Any word on this?
answered by ScottR (840 points)
0 votes
Hi Scott,

Sorry for not answering you sooner, Is it possible to create a simple test project we can run on our side and investigate this issue?
answered by dhelper (11.9k points)
0 votes
Sorry for not replying for a while, I had some other higher priority issues that came up. Could this have something to do with the following dialog:
Version mismatch the installed version (5.2.3.0) differs from the loaded version (5.4.5.0).

The crazy thing is that I don't (as far as I can tell) have 5.2.3.0 installed anywhere on this machine. However I am pretty sure that 5.2.3 was the originally licensed version by the company that I am currently working with. Unfortunately that didn't work for me, because I have a 64-bit system. Is the licensed version somehow cached? Do I need to clear out something?
answered by ScottR (840 points)
0 votes
Hi Scott,

This indeed could be the problem source.
This exception can happen when you have older TypeMock.dll in the GAC or when an older version of TypeMock.dll is in the build directory. Than at runtime the older version gets loaded. This can create unpredictable results and for that reason the Isolator tries to detects this scenario.

The solution is simple:
First check the GAC at this path: "c:Windowsssembly"
If you have more than one TypeMock.dll in gac please remove the older one.
Check the local directory and see if you have older version of TypeMock.dll
If you find one remove it than make sure you are referencing the new version and rebuild.

Please let me know if that solves your problem.
answered by ohad (35.4k points)
...