Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Weird warnings in VS

I have got lots of warnings like this one and I have not got a clue what they mean.

Does anyone know what this is?

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

I should also point out that it relates to "c:\Windows\Microsoft.NET\Framework\v4.0.30319\Microsoft.Common.targets"

like image 669
James Avatar asked May 23 '12 10:05

James


2 Answers

You can use Type Library Importer (tblimp) to import the DLL outside Visual Studio and use the generated reference instead of letting Visual Studio create it, hence removing the warnings.

like image 84
mattytommo Avatar answered Oct 20 '22 15:10

mattytommo


Nice explanation of situation can be found here:

You can safely ignore these warnings. You can find out more about this issue by consulting this page: http://msdn.microsoft.com/en-us/library/aa289520%28v=vs.71%29.aspx

The "In/Out C-Style Arrays" section is particularly relevant. Bottom-line : if the returned buffer of the specified methods in the warnings were accepting "in" values, you would have to apply the modifications in the article. But since all the listed methods only handle out buffers, the warnings are of no consequence to you nor the framework.

However, if you want to permanently get rid of the warnings (when you do a "Rebuild All" for instance), you will have no choice to proceed as described in the article. You will have to disassemble the interop wrapper (with ildasm), edit the IL and reassemble (with ilasm). This process is also called "creative round tripping".

like image 33
Petr Abdulin Avatar answered Oct 20 '22 17:10

Petr Abdulin