hiding unmanaged types in metadata

F

Fedor Buyakov

hello all

i have a specific question according hiding unmanaged (native) types
in metadata for assemblies generated by c++ with managed extensions. i
understand what these types are nedeed in metadata for runtime but why
to do it public?

is code will run correctly if i make these types private for assembly?

there is no way to do so from IDE or by some compiler option but i can
edit assembly file directly in hex editor and change flag according
specified type.

all unmanaged types in metadata have flags 0x109, ie:
"public sealed class <UNMANAGED TYPE NAME> : System.ValueType".
if i replace bytes 09 01 for 10 01 for specified type's flag i will
have:
"private sealed class <UNMANAGED TYPE NAME> : System.ValueType".

hurrah! we have a hidden type but it's still present in the manifest
and i think this will no break runtime (my first experience shows what
all is ok).

this workaround will especially useful for component developers who
need to wrap some native (eg. win32api) code to .Net interface.

any comments?
 
L

Lee Alexander

Unmanaged types in the manifest appeared in version 7.1 of Dev Studio. I'm
guessing that MS did it as some kind of workaround for problems they were
having with the debugger. I had lots of instances where I couldn't see the
contents of unmanaged classes in 7.0 whilst debugging. There is no reason
why we should see private types exposed in the manifest so hopefully MS will
fix it at some point.

Personally I would like to see another point release / service pack as 7.1
is still a bit flaky especially the Windows forms designer.

Regards
Lee
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top