Tuesday, September 11, 2007

Got it!

Apparently the scripting hosts were sending the strings over in ANSI format rather than Unicode. I'm not quite sure why this causes an out of memory error (maybe something was trying to copy the string and misread the initial characters as a size parameter?). Changing the MarshalAs attribute in the declaration of IActiveScript solved the problem.

1 comment:

Aaron said...

It's possible of the unlikely event that the ANSI string null terminator was immediately followed by lots of other useful data (i understand scripting languages tend to generate a lot of garbage), so the marshalling engine starts looking for the byte sequence "\0\0" on a 2-byte aligned boundary, but instead finds "hello world\0ab92n!@3mdqop\x90\xe5\x88\x79191\0ablq" and so forth.

Just a theory.

Oh, and your blog rocks so I've been wading through the back issues. :-)