Please COM down

As part of our VB to C# conversion, we created an assembly compiling with the .NET 4.0 Framework.  One method in the converted class had a signature like:

void MethodName(ref object p1, ref object p2, ref object p3, ref object p4)

The first two paramenters are input parameters and the latter two are output.  p1 and p3 are really arrays of strings, and p2 and p4 are two dimensional arrays of strings, 16 and 32 bit ints, date/time, and potentially null values.  The ASP code worked fine on top of this.

Then, we realized we want to use this component from an ASP.NET site currently compiling with the .NET 3.5 Framework.  We weren't using any 4.0 specific code so simply changed the compile type, deployed and regasm'ed the new assembly.  Strangely, when the ASP code tries to call the method above, it occasionally chokes, claiming that the "Variable uses an Automation type not supported in VBScript" followed by the method name.  What's odd is that it doesn't always blow up - only sometimes.  Also, the method signature and code didn't change.  Why would .NET 4.0 framework and regasm work fine while .NET 3.5 framework with the 2.0 regasm not?

Well, it's still a mystery but the one clue is this - the second input to this function is an output param of a previous function.  The nulls that it contains aren't really "null" but DBNull.Value.  Perhaps the 2.0 regasm is somehow typing these in a different way than 4.0...

We're open to suggestions but at this point will compile the assembly as 4.0 and have the ASP.NET 3.5 site access it via COM, unfortunately.

Comments

Popular posts from this blog

Managing to Lead

Moving up

Please properly dispose old knowledge