Item 12 of 51 Previous | Next

1
Vote

CachedTypeResolver is broken/Fails to create .NET types

description

The CachedTypeResolver is being asked to cache bogus type names. For example, subsequent calls to ResolveType are being passed as:

Sys,prototype
Sys,prototypeSys,prototype
Sys,prototypeSys,prototypeSys,prototype
Sys,prototypeSys,prototypeSys,prototypeSys,prototypewindow.external

I managed to fix the problem I was having by changing this code in ExecutionVisitor.Visit(Identifier):

// Try to record full path in case it's a type
if (Result == null)
{
//typeFullname.Length = 0; // Uncomment this new line to clear the StringBuilder
typeFullname.Append(propertyName);
}

I also found I could solve the problem by putting that new line at the end of ExecutionVisitor.EnsureIdentifierIsDefined() instead.
Not sure if either of these are the best places for the fix.

Cheers
Simon

PS Incidentally, I noticed typeFullname = new StringBuilder(); in a number of places in ExecutionVisitor. Setting Length = 0 achieves the same and allows a single instance of typeFullName to be ReadOnly

No files are attached

comments