Skip navigation.

"Unable to generate a temporary class" with SWExplorerAutomation...

.NET | web testing tools
[textile]While helping someone get started with evaluating "SWExplorerAutomation":http://home.comcast.net/~furmana/SWIEAutomation.htm (I'll call it SEA if you don't mind) on a client's site, we encountered an error almost as soon as we tried to use it... but it turned out that it had nothing to do with the tool and everything to do with a bug in an MS Security Patch... "read on to find out more":http://www.testingreflections.com/node/view/2592

h2. About SWExplorerAutomation

"SWExplorerAutomation (SEA)":http://home.comcast.net/~furmana/SWIEAutomation.htm is a tool + library to programmatically control Internet Explorer. Like "Watir":http://wtr.rubyforge.org/ and "SAMIE":http://samie.sourceforge.net/ it accesses IE's API to control it.

It includes a simple script designer and recorder GUI to interactively build the 'script' and generates either C# or VB.NET. The benefit of this in a Microsoft development environment, is that (in theory) this code can be incorporated into unit tests (e.g. using NUnit) or acceptance tests (e.g. using FIT) to test complex Javascript/DHTML UI widgets by rendering them in the browser and interacting with them. This becomes part of your standard suite of unit tests and be incorporated into your Continuous Integration builds.

Check out this "Flash Demo of SWExplorerAutomation":http://home.comcast.net/~furmana/SWExplorerAutomation.html to get an idea of how it works...

h2. The Problem

Unfortunately, it didn't work in this case... To 'record' a script you have to start IE from SEA's "Run Internet Explorer" command. Normally, this starts IE, resizes the SEA designer to a thin window on the left and resizes IE to occupy the remaining space on the screen.

This time, it resized itself but when it tried to resize IE, we got this error:

@Unable to generate a temporary class (result=1).@ (see below for full trace)

After investigation on a couple of the client's machines (all Windows 2000), a vanilla build of Win2k I happened to have on one of my machines and searching the web, I found the cause...

The problem relates to a bug in a security patch applied to .NET 1.1 to close a vulnerability. If the patch is applied to .NET 1.1 SP1 then it all works fine but if the non-SP1 configuration is used, you get the same error.

It turns out that there are actually two patches to close the vulnerability. One that is applied to .NET 1.1 (KB886904) and another that should be used if you have .NET 1.1 SP1 (KB886903).

So...

* .NET 1.1 + KB886904 = above error!
* .NET 1.1 (SP1) + KB886903 = OK!

h2. The Solution

On this site, they happened to have the first configuration (.NET 1.1 + KB886904) on Windows 2000.

The solution is as simple as:

* Uninstall KB886904
* Install .NET 1.1 SP1
* Install KB886903

Full details are available in this "Microsoft article":http://support.microsoft.com/default.aspx?scid=kb;en-us;895242. This also affects SQL Server 2000 Reporting services.

----
Full Stack Trace (to help Googlers & MSNSearchers find this article):

Message:

Unable to generate a temporary class (result=1).
error CS1514: { expected
error CS1001: Identifier expected
error CS1031: Type expected
error CS1519: Invalid token '{' in class, struct, or interface member declaration
error CS1514: { expected
error CS1001: Identifier expected
error CS1031: Type expected
error CS1519: Invalid token '{' in class, struct, or interface member declaration

----------------
Exception Detail:

System.InvalidOperationException: Unable to generate a temporary class (result=1).
error CS1514: { expected
error CS1001: Identifier expected
error CS1031: Type expected
error CS1519: Invalid token '{' in class, struct, or interface member declaration
error CS1514: { expected
error CS1001: Identifier expected
error CS1031: Type expected
error CS1519: Invalid token '{' in class, struct, or interface member declaration

at System.Xml.Serialization.Compiler.Compile(Assembly parent, String ns, CompilerParameters parameters, Evidence evidence)
at System.Xml.Serialization.TempAssembly.GenerateAssembly(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, Evidence evidence, CompilerParameters parameters, Assembly assembly, Hashtable assemblies)
at System.Xml.Serialization.TempAssembly..ctor(XmlMapping[] xmlMappings, Type[] types, String defaultNamespace, String location, Evidence evidence)
at System.Xml.Serialization.XmlSerializer.GenerateTempAssembly(XmlMapping xmlMapping, Type type, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type, String defaultNamespace)
at System.Xml.Serialization.XmlSerializer..ctor(Type type)
at SWExplorerAutomation.Client.ExplorerManager.GetExplorerWindows()
at a1.k()
at a1.a(Rectangle A_0)
at b.a(EventArgs A_0)
at System.Windows.Forms.Control.OnSizeChanged(EventArgs e)
at System.Windows.Forms.Control.UpdateBounds(Int32 x, Int32 y, Int32 width, Int32 height, Int32 clientWidth, Int32 clientHeight)
at System.Windows.Forms.Control.UpdateBounds()
at System.Windows.Forms.Control.WmWindowPosChanged(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.ContainerControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmWindowPosChanged(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Testing your web UI using SWExplorerAutomation and NUnit

TrackBack from testingReflections.com:

In my previous posts about SWExplorerAutomation, I addressed a couple of initial problems with getting

SWExplorerAutomation v1.4.1.4 incompatability with MSN Desktop S

TrackBack from testingReflections.com:

In a prior post about SWExplorerAutomation I mentioned a problem (and solution) that occurs if you have applied .NET framework patches in the wrong or

Comment viewing options

Select your preferred way to display the comments and click 'Save settings' to activate your changes.