How Windows Vista Security helped us make a Faster Application

Part of the coming TypeMock.NET version, we completed our support for Vista Machines.

TypeMock.NET has been compatible with Windows Vista for quite some time now, the only feature that was missing was the Tracer.
Although the Tracer is not required to run tests using TypeMock, it is very handy when your mocks are not working well.

Using the Tracer it is possible to see the expectations the instances of the mocked types and where the code didn’t meet the expectations.

Shared Memory

In .NET 1.1 we used a Shared Memory Paradigm to pass information from the test to the tracer. This worked very well, but in Windows Vista, you have to be an administrator to create a global shared memory. This is not always possible, we need to be able to test an application in normal scenarios and we don’t want to be forced to be an administrator. I am not really sure why there is such a security issue with creating a global shared memory, I will be happy to hear for you.
Since .NET 2.0, there is support for IPC (Inter-Process Communication) Remoting using named pipes, we decided to use this option. We decided to try to use the shared memory implementation first, and if we fail to create the memory we will use the IPC. This way we won’t have the problem of the Tracer running in .NET 1.1 and listening to the shared memory, while the tests are running in .NET 2.0 and are sending trace information over IPC.

After some testing and refactoring, the tracer worked on Vista, but we had a suprise.
We found that using IPC was 3 times faster!!! then our shared memory implementation.

We changed the code. This time the tracer will listen to both the shared memory and the IPC port. TypeMock will then first try to communicate using IPC, if it fails it will try using the shared memory.

One comment

Add Comment

Required fields are marked *. Your email address will not be published.