100% processor utilization when run against .vb files


When run against .vb files, the processor spikes to 100% during a call to OrganizeWithRegions and VS locks and becomes non-responsive. This perhaps happens on other main methods as well, this is just the one I have tested against.
I have isolated the cause to the call the following line:
Source file: ClassOrganizer.cs
Source function: ApplyEdits
Source line: textDocument.Format( );
As there is nothing special going on at this line (in re: ClassCleaner), I am assuming this is actually a bug in the DXCore libraries but you might want to confirm this.
Since it doesn't occur when run against classes in .cs files, I am theorizing that the issue is that the VS2005 background compiler for VB is trying to background-compile at the same time DXCore is attempting to reformat the source code document via the call to .Format( ). Since C# lacks the background comiler of VB,NET, this doesn't manifest itself under C#.
I have (hacked) a fix in the form of a simple...
if (!CodeRush.Langugae.IsBasic) {...}
...wrapper around the call to textDocument.Format( ); but this is of course an ugly solution :)
PS: I recompiled the CR_ClassCleaner against DXCore 2.2.2 and the same results were observed.
(modified ClassOrganizer.cs file attached,

file attachments

Closed Jun 9, 2007 at 3:57 PM by JoLu1977
Checkin 23471 has the fix for this issue. It looked like there was a deadlock being caused in VB.NET when the document was locked and then a call to format was called. I moved the format call to after the document was unlocked.