What does "cannot be marshaled by the runtime marshaler" mean?
Asked Answered
U

3

18

I am getting strange warnings out of Visual Studio 2008 when compiling a C# ASP.NET application. Could anyone point me to an explanation (in words of few syllables, if possible) of what this warning means?

At least one of the arguments for 'IasHelper.Process' cannot be marshaled by the runtime marshaler. Such arguments will therefore be passed as a pointer and may require unsafe code to manipulate.

Uncommitted answered 7/10, 2011 at 8:35 Comment(0)
A
10

The Marshal class is responsible to convert unmanaged code/classes to managed classes and vice versa. See the msdn documentation of the Marshal Class.

If you include some interop assembly to access COM object or such it may happen that the Marshal(l)er cannot take care of the operation. Thus you have quasi-unmanaged parts running in your program which in turn can cause nasty things like buffers overruns and such. You thereby leave the safe, cozy world of managed code and enter the drafty, dangerous realm of C/C++ and their dreaded brethren. :-)

Arther answered 7/10, 2011 at 8:44 Comment(1)
Thank you. That reference links to (justlikeamagic.com/2010/03/09/marshaling) which is comprehensive.Uncommitted
F
9

Sounds like you're referencing an ActiveX object and its giving the tlbimp.exe a tough time marshaling the arguments of some of the methods and structure members between COM and .NET.

this maybe happening during clean builds as that's the only time tlbimp has to run. try to do a normal build where you didn't not clean first.

Fixer answered 7/10, 2011 at 8:48 Comment(1)
Thanks for that. I have just stumbled upon this thread (social.msdn.microsoft.com/forums/en-US/netfxbcl/thread/…) where a fellow had the same problem. Rather worrying, isn't it?Uncommitted
L
0

Just in case this helps someone and a future note to myself, if you're building a VSTO add-io, make sure there are no unnecessary COM DLLs referenced by your project. In my case, I had ExcelAdaptorLib added in the References section. Removing it got rid of all the 18 warnings and I now have a clean build.

Lunde answered 9/8, 2024 at 5:25 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.