“无法由运行时封送拆收器封送”是什么意思?意思是?
编译 C# ASP.NET 应用程序时,我从 Visual Studio 2008 中收到奇怪的警告。谁能给我解释一下(如果可能的话,用几个音节的话)这个警告的含义?
“IasHelper.Process”的至少一个参数不能是 由运行时封送器封送。因此,此类论点将是 作为指针传递,可能需要不安全的代码来操作。
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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
Marshal 类负责将非托管代码/类转换为托管类,反之亦然。请参阅Marshal 类的 msdn 文档。
如果您包含一些互操作程序集来访问 COM 对象等,则可能会发生 Marshal(l)er 无法处理该操作的情况。因此,您的程序中运行着准非托管部分,这反过来又可能导致令人讨厌的事情,例如缓冲区溢出等。因此,您离开了安全、舒适的托管代码世界,进入了 C/C++ 及其可怕同类的通风、危险领域。 :-)
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. :-)
听起来您正在引用一个 ActiveX 对象,并且它使 tlbimp.exe 在整理 COM 和 .NET 之间的某些方法和结构成员的参数时遇到了困难。
这可能发生在干净构建期间,因为这是 tlbimp 必须运行的唯一时间。尝试进行正常的构建,其中您没有首先清理。
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.
以防万一这对某人和我自己有帮助,如果您正在构建 VSTO add-io,请确保您的项目没有引用不必要的 COM DLL。就我而言,我在
References
部分中添加了ExcelAdaptorLib
。删除它就消除了所有 18 个警告,现在我有了一个干净的构建。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 theReferences
section. Removing it got rid of all the 18 warnings and I now have a clean build.