Richard Szalay

Monday, January 25, 2010

Massive SUO file causes Visual Studio to hang when doing pretty much anything

I've been dealing with horribly slow performance from Visual Studio 2008 (SP1) for a few weeks now. We're talking seriously slow performance. Like 30-40 seconds of unresponsiveness to save the solution; 20-30 seconds of unresponsiveness after compilation if there were any errors.

Today, after taking a few memory dumps to send to Microsoft, I set out to look for network references (an idea from a workmate). I didn't find any (nor did I expect to), but I did find a 250MB (!) SUO (Solution User Options) file.

I have no idea how the SUO file got so large, but deleting completly fixed the problem. Visual Studio has returned to it's usual speediness. I do regret, though, not making a copy of the SUO to send to Microsoft. Next time, perhaps.

Labels:

Thursday, October 22, 2009

Executing Powershell from CruiseControl.NET on 64-bit Windows

If you try to execute a Powershell script from a CruiseControl.NET build on a 64-bit OS, you'll get the following error:

File ~filename~.ps1 cannot be loaded because the execution of scripts is disabled on this system. Please see "get-help about_signing" for more details.

If you google around, you'll be told to execute Set-ExecutionPolicy. Unfortunately, on 64-bit, that won't fix your problem.

The issue is that CruiseControl.NET is 32-bit and the default powershell on 64-bit Windows is 64-bit. When a 32-bit process accesses SOFTWARE registry keys, the request gets redirected to HKLM\Software\Wow6432Node. This results in powershell looking for the wrong key and thus getting the default value.

To work around the problem, execute the following at an elevated command prompt:

%windir%\SysWOW64\WindowsPowerShell\v1.0\powershell.exe "Set-ExecutionPolicy RemoteSigned"

In finding this solution it prompted me to realise that, in 64-bit Windows, c:\windows\system32 is 64-bit and c:\windows\SysWOW64 is 32-bit. And then my head exploded.

Labels: , ,

Sunday, August 30, 2009

Hosts File Manager extension for IIS 7

I've just released the first version of my new side project, the Hosts File Manager extension for IIS 7. The extension does pretty much what it says on the can, providing a user interface to edit the local hosts file from within IIS Manager. Running from within IIS gives me a few other benefits, too, like auto-elevation and providing me easy access to local website information.

For now, there's only a global view (accessible from the default "server" view in IIS Manager), but I have more features planned for future releases. You can read about these on the Codeplex project page.

To download it, head over the Downloads page on Codeplex. I've released both x86 and x64 versions, but all my testing has been done with the x64 installer (since I'm running 64-bit Win7). Please log any x86 or Vista issues with the Issue Tracker.

Thursday, August 27, 2009

Debugging IIS 7 extensions in Windows 7

I came across some curious behavior when trying to debug an IIS extension that I'm working on. When I went to select "InetMgr.exe" as the startup program, it wasn't there. I checked the folder using Windows Explorer and, sure enough, there it was. Even entering the path manually resulted in "The external program cannot be found".

So, what was the problem? Well, as far as I can tell, it appears that because InetMgr.exe is an auto-elevated process it is only accessible to other auto-elevated processes. This is quite possibly a post RC solution to the flaw in UAC found during the betas, though I'm just speculating.

Luckily, with a bit of experimenting, I was able to find a solution. By enabling remote debugging ("Use remote machine") and setting the value to localhost, I was able to circumvent whatever was blocking the call. See the below screenshot for clarification.


Debug settings for InetMgr.exe

I am now happily debugging my extension without hassles.

Monday, August 24, 2009

Enable net.pipes in IIS 7 on Windows 7 Professional

I recently went to configure a net pipes service in Windows 7 (Professional 64-bit) and found that it wasn't available. I quickly proceeded to "Turn Windows features on or off", but couldn't find it there either. I eventually found the answer in the Microsoft article WAS Activation Architecture and have simplified the steps below:

  1. Open %windir%\system32\inetsrv\config\applicationHost.config with (elevated) notepad
  2. Find the <listenerAdapters> element
  3. Add a new <add> element with a name attribute of "net.pipe"

The final element should look like this (assuming you have no other listener adapters enabled):

    <listenerAdapters>
        <add name="http" />
        <add name="net.pipe" />
    </listenerAdapters>

Edit: While the above solution enabled net.pipe in the bindings dialog in IIS, it didn't actually enable net pipes in IIS. I did, however, find the correct way of enabling them:

Simply install "Windows Communication Foundation Non-HTTP Activation" from the "Microsoft .NET 3.5.1" section in the "Turn Windows features on or off" dialog.

Tuesday, February 17, 2009

ASMock Beta 2 Released with Tutorial Series

ASMock beta 2 has been released and, other than Flash 10 Vector support, is largely a bugfix release. I've also added a seven part tutorial series on how to use the framework.

As always, any feedback can be added to the bug database or feature request trackers. Additionally, any feedback to the tutorial series (or requested examples) can be added to the SourceForge forum for the project.

The ASMock binary, source and FlexUnit samples can all be downloaded from the downloads page.

Labels: , ,

Wednesday, February 11, 2009

Generics (Vector) in the AVM2

So I finally got around to looking at vector's in the AVM2 yesterday (for asmock) after someone logged a bug and found that the Flash 10 features are not actually documented in the AVM2 Overview document. Fortunately, after some digging around, I uncovered enough to implement support. Here's what I found:

References to a typed generic type (Vector.<int> as opposed to Vector.<*>) are referenced by a new multiname kind (0x1D), which I call GenericName. GenericName has a format like so:

[Kind] [TypeDefinition] [ParamCount] [Param1] [Param2] [ParamN]

Where:
[TypeDefinition] is a U30 into the multiname table
[ParamCount] is a U8 (U30?) of how many parameters there are
[ParamX] is a U30 into the multiname table.

Obviously generics are not generally supported yet, so ParamCount will always be 1 (for Vector.<*>).

The other interesting thing is how instances of the class are created. A new opcode was added in Flash 10 (0x53), which I will call MakeGenericType. MakeGenericType is declared with the following stack:

TypeDefinition, ParameterType1, ParameterTypeN -> GenericType

It also has one parameter, a U8 (U30?) specifying how many parameters are on the stack. You will generally see MakeGenericType being used like this:

GetLex [TypeDefinitionMultiname]
GetLex [ParameterTypeMultiname]
MakeGeneric [ParamCount]
Coerce [GenericNameMultiname]
Construct [ConstructorParamCount]

So if you had the following...

GetLex __AS3__.vec::Vector
GetLex int
MakeGeneric 1
Coerce __AS3__.vec::Vector.<int>
Construct 0

You would now have an instance of Vector.<int>

Labels: , ,