Testing EnterpriseLibrary under TestDriven.NET

Topics: Logging Application Block
Mar 6, 2009 at 7:29 PM
The Logging application block in 4.1 runs fine under a normal process, but when run under ProcessInvocation.exe an error shows up in the event log and no log is written.  In truth I don't know if this is a fault of the EL or TestDriven.Net.  One other important piece of info - this is running on a 64-bit version of Vista.

Log Name:      Application
Source:        Enterprise Library Logging
Date:          3/6/2009 11:18:00 AM
Event ID:      6352
Task Category: None
Level:         Error
Keywords:      Classic
User:          N/A
Computer:      Scott-Work
Description:
2009-03-06 11:18:00.826 [4584] Error  - Processing of the message failed. See summary information below for more information. Should this problem persist, stop the service and check the configuration file(s) for possible error(s) in the configuration of the categories and sinks.

Summary for Enterprise Library Distributor Service:
======================================
-->
Message:
Timestamp: 3/6/2009 7:18:00 PM
Message: A OK
Category: TLAB
Priority: -1
EventId: 0
Severity: Information
Title:
Machine: SCOTT-WORK
App Domain: domain-nunit.addin.dll
ProcessId: 3296
Process Name: C:\Program Files (x86)\TestDriven.NET 2.0\ProcessInvocation.exe
Thread Name: TestRunnerThread
Win32 ThreadId:4584
Extended Properties:
--> MachineName: SCOTT-WORK
--> TimeStamp: 3/6/2009 7:18:00 PM
--> FullName: Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
--> AppDomainName: domain-nunit.addin.dll
--> WindowsIdentity: Scott-Work\Scott

Exception Information Details:
======================================
Exception Type: System.AccessViolationException
Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Data: System.Collections.ListDictionaryInternal
TargetSite: System.Security.Principal.WindowsImpersonationContext RevertExistingImpersonation()
HelpLink: NULL
Source: Microsoft.Practices.EnterpriseLibrary.Logging

StackTrace Information Details:
======================================
   at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.RevertExistingImpersonation()
   at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.ProcessLog(LogEntry log)
   at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.Write(LogEntry log)
Event Xml:
<Event xmlns="http://schemas.microsoft.com/win/2004/08/events/event">
  <System>
    <Provider Name="Enterprise Library Logging" />
    <EventID Qualifiers="0">6352</EventID>
    <Level>2</Level>
    <Task>0</Task>
    <Keywords>0x80000000000000</Keywords>
    <TimeCreated SystemTime="2009-03-06T19:18:00.000Z" />
    <EventRecordID>6576</EventRecordID>
    <Channel>Application</Channel>
    <Computer>Scott-Work</Computer>
    <Security />
  </System>
  <EventData>
    <Data>2009-03-06 11:18:00.826 [4584] Error  - Processing of the message failed. See summary information below for more information. Should this problem persist, stop the service and check the configuration file(s) for possible error(s) in the configuration of the categories and sinks.

Summary for Enterprise Library Distributor Service:
======================================
--&gt;
Message:
Timestamp: 3/6/2009 7:18:00 PM
Message: A OK
Category: TLAB
Priority: -1
EventId: 0
Severity: Information
Title:
Machine: SCOTT-WORK
App Domain: domain-nunit.addin.dll
ProcessId: 3296
Process Name: C:\Program Files (x86)\TestDriven.NET 2.0\ProcessInvocation.exe
Thread Name: TestRunnerThread
Win32 ThreadId:4584
Extended Properties:
--&gt; MachineName: SCOTT-WORK
--&gt; TimeStamp: 3/6/2009 7:18:00 PM
--&gt; FullName: Microsoft.Practices.EnterpriseLibrary.Logging, Version=4.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35
--&gt; AppDomainName: domain-nunit.addin.dll
--&gt; WindowsIdentity: Scott-Work\Scott

Exception Information Details:
======================================
Exception Type: System.AccessViolationException
Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
Data: System.Collections.ListDictionaryInternal
TargetSite: System.Security.Principal.WindowsImpersonationContext RevertExistingImpersonation()
HelpLink: NULL
Source: Microsoft.Practices.EnterpriseLibrary.Logging

StackTrace Information Details:
======================================
   at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.RevertExistingImpersonation()
   at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.ProcessLog(LogEntry log)
   at Microsoft.Practices.EnterpriseLibrary.Logging.LogWriter.Write(LogEntry log)</Data>
  </EventData>
</Event>

Mar 9, 2009 at 6:38 AM
Hi,

Does this always happen everytime you'll try a run? Have you tried this on other machine (32bit)? 


Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com
Mar 9, 2009 at 7:17 AM

Yes it happens every time, and it works fine on a 32-bit machine.

Is the bug yours or TestDriven.Net's do you think?

-Scott

From: AvanadeSupport [mailto:notifications@codeplex.com]
Sent: Sunday, March 08, 2009 10:38 PM
To: scott@brainhzsoftware.com
Subject: Re: Testing EnterpriseLibrary under TestDriven.NET [entlib:49456]

From: AvanadeSupport

Hi,

Does this always happen everytime you'll try a run? Have you tried this on other machine (32bit)?


Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Read the full discussion online.

To add a post to this discussion, reply to this email (entlib@discussions.codeplex.com)

To start a new discussion for this project, email entlib@discussions.codeplex.com

You are receiving this email because you subscribed to this discussion on CodePlex. You can unsubscribe on codePlex.com.

Please note: Images and attachments will be removed from emails. Any posts to this discussion will also be available online at codeplex.com

Mar 9, 2009 at 8:39 AM
I'm not sure about it. But maybe you could try building the assemblies with 64bit as target platform and see if it helps. Anyway, I ask the Ent lib team regarding this matter and get back to you.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com
Sep 13, 2009 at 12:13 AM

Hi,

any news here?

I have the same problem as initially described. The exception occurs on a x64 system whenever i run the app from within visual studio (vshost). On x86 an when i run the app out of visual studio on x64, everything works as expected (= no exception, logging works fine).

Any ideas?

Sep 14, 2009 at 8:21 AM

Hi,

This is still waiting for a answer from the ent lib team. We'll get back to you as soon as the ent lib team answers.

Valiant Dudan
Global Technology and Solutions
Avanade, Inc.
entlib.support@avanade.com

Sep 19, 2009 at 5:50 AM

Valiant, I'm not sure what happened, but I never saw your support request. You might want to get together with your management and go over the process for raising issues back to us; something's not working.

As for the original question - well, I run TestDriven.NET as well when developing Entlib. I've never seen this particular error. What version of TD.NET are you running? There are some tests that do fail under TD.NET that work fine under the built-in VS test runner; mostly they have to do with WMI. But I've never seen an access violation.

-Chris

 

Sep 23, 2009 at 12:20 PM

Question: Do you have TypeMock installed? If you do this happens when you try to run tests using TestDriven in an x64 process. You don't have to use TypeMock in the affected test. It is enough that it is installed to make entlib explode. Clearly objectbuilder2 does something TypeMock doesn't handle very well. See here: http://www.typemock.com/community/viewtopic.php?t=1079.

Sep 23, 2009 at 1:38 PM

For me, i can says the following:

- Yes, i have TypeMock installed

- I do NOT have TestDriven installed

- Error occurs on normal execution from within the IDE (no Tests involved).

Sep 23, 2009 at 9:48 PM

I suggested TestDriven.NET because it will start and attach TypeMock to the process if TypeMock is installed and  ProcessInvocation.exe is the name of x64 exe of TestDriven.NET. Gallio test runner will also attach TypeMock and with the mstest runner TypeMock will probably do it itself inside Visual Studio (but this I don't know for sure).

TypeMock is alot more agressive than other mocking framework by attaching itself to the running program and altering it in realtime as it runs. TypeMock has had several issues on x64 in the past and currently it has issues with EntLib if run in a 64bit process and Gallio on x64 systems when TypeMock is newer than v 5.2.3.

Try uninstalling TypeMock and run one of the tests again. TypeMock might seem very unrelated if you're not using it where you are currently experiencing problems, but the aggressive way it works makes it able to do it's magic and also very prone to creating odd conflicts.

If things start working after you uninstall TypeMock the solution is to run ProcessInvocation as a 32bit process. Do this with "corflags ProcessInvocation.exe /32bit+" if you have an early version of TestDriven or of your version is one of the new ones you can choose between x86 and x64 in Tools->Options->TestDriven.NET in Visual Studio.  If you are not running TestDriven you need to figure out what runs your tests and make it run in 32bit mode.

Sep 30, 2009 at 10:32 PM

Just installed Typemock Isolator 5.3.5 and - believe me or not - everything is fine. Can't reproduce the problem anymore.

Any explanation for that?

Oct 1, 2009 at 6:41 PM

Cool, could mean they've fixed it in 5.3.5. Too bad I can't use 5.3.5 (or 5.3.4) as that version doesn't work with Gallio/MbUnit3 on x64 Windows. Maybe 5.3.6 will be a winner...