hmmm, the MS Outlook Newsreader has trouble seeing all the items in this
thread, so sorry for not replying where i should.
thanks for all the ideas. i'm swamped at the moment or i would have
responded earlier and won't manage a careful, complete example of what i
mean this week, but i can sketch one that people could flesh out if they
find time.
i think the problem is that the COM+ object, written in VB and compiled
quite a few years ago, has a different understanding of what a legal
"string" is than C#/DotNet2/CLR(/...?) does. it returns strings which
contain sequences of bytes which are not legal UTF characters. this tupel of
bytes is in effect smuggled into DotNet as a string. since it's a string i
can convert it to a character array (in general with losses of data -- the
illegal byte combinations), but not to a byte array (which i guess is
considered a no-no in the modern, protected world.)
i'm sorry but I don't know whether the "string" that comes from COM+ is a
0-terminated sequence of non-0 bytes or a (size, array-of-bytes) pair --
haven't needed badly enough to "look under the hood" in DotNet, not even
sure whether I can.
sorry i can't give you more than these vague descriptions. we will find
other ways to deal with our problem so it will become academic to me at some
point. (the data should have been binary in the DB and array-of-bytes or
equivalent in DotNet anyway, we just have no way to make it that in this
case at this time.)
cheers,
Tim
"tbh" <femdev@newsgroups.nospamwrote in message
news:%23N964Qk1GHA.4748@TK2MSFTNGP04.phx.gbl...
Quote:
for historical reasons i need to be able to call, from C# under DotNet 2,
as COM+ DLL function that returns a "string" which is really an array of
seemingly arbitrary bytes (presumably non-zero). however, C# treats this
as a string and the only ways i have found to convert it to a byte array
lose data (apparently in those cases when the "characters" are not legal
UTF values).
>
in this case (a program i only need to run once) i would be willing to
tolerate an unsafe solution, but i haven't been able to find one, despite
fairly extensive searching.
>
is this not possible or have i just not found the right trick yet?
>
Tim Hanson
>