error running test on vs 2008

Jul 22, 2009 at 10:16 PM
Edited Jul 23, 2009 at 1:50 AM

Hi, thanks Eric, for this very useful code.

Unfortunately, I unpacked the download, opened the project in VS2008 (I get an error that this is untrusted code), and execute "Test", I get the three buttons, but clicking on any of the three returns the same error:

                _activescript = _engine as IActiveScript;


                _activeparser = _engine as IActiveScriptParse;      

                _activeparser.InitNew(); // error on this line


System.NullReferenceException was unhandled
  Message="Object reference not set to an instance of an object."
       at System.Scripting.ActiveScript.ScriptHost.Open() in C:\Users\Hugh\Documents\Visual Studio 2008\Projects\HTMLScrub\ActiveScript\ActiveScript\System.Scripting.ActiveScript\ScriptHost.cs:line 137
       at System.Scripting.ActiveScript.ScriptLanguageBase.Open() in C:\Users\Hugh\Documents\Visual Studio 2008\Projects\HTMLScrub\ActiveScript\ActiveScript\System.Scripting.ActiveScript\ScriptLanguageBase.cs:line 77
       at Test.Form1.btnHelloWorld_Click(Object sender, EventArgs e) in C:\Users\Hugh\Documents\Visual Studio 2008\Projects\HTMLScrub\ActiveScript\ActiveScript\Test\Form1.cs:line 25

I see others are using this successfully, but I thought I'd check to see if anyone else had experienced this?  I haven't modified the project at all.  I turned off virus protection just in case but that didn't make a difference.

Thanks for any help!

Jul 23, 2009 at 2:29 AM

Hmm I haven't experienced that yet. Any more details you can give? OS version etc...?



Jul 23, 2009 at 2:32 AM
Edited Jul 23, 2009 at 2:33 AM

Thanks for the reply... It must have to do with the error... it actually says "project location is not trusted"... I'm looking at some KB articles on how to add the project location as a "trusted" location... it seems crazily obscure.

I'm on 64-bit Windows Vista, btw... I'll let you know what I figure out.

Jul 23, 2009 at 2:48 AM

Shoot, fixed the "The Project Location is Not Trusted" error message... it was related to the files coming from an "untrusted" zip file... you just have to get properties on the zip and click "Unblock"...  but that did not solve the problem. 

Hmm, I don't know, maybe it's a 64 bit windows problem?

Windows Home Premium 64bit, Visual Studio 2008 sp1, Windows Script Host Version 5.7

Jul 23, 2009 at 3:37 AM

Sure enough, works fine on my Vista Ultimate 32 bit machine, maybe a 64-bit problem then... though I suppose it could be some crazy arbitrary difference between home/ultimate?  Both are WSH 5.7.

Jul 23, 2009 at 3:42 AM

Ah ha:

IActiveScriptParse and x64

The IActiveScriptParse interface on x86 is mapped to IActiveScriptParse32 with the ClassID BB1A2AE2-A4F9-11cf-8F20-00805F2CD064. The easiest way to get it working on x64 was to mark the assemby as x86. You can do this with the target platform property in your Visual Studio project or by using the corflags.exe:

Sorry if the running dialog is getting irritating, but I didn't want anyone to waste their time as I figured things out.

I'll let you know if I get it working!