NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

Compiler Error CS0634

'arg' : argument only valid for marshal of type System.Interop.UnmanagedType.CustomMarshaller

One of the arguments that was passed to the marshal attribute can only be used when the marshal format is System.Interop.UnmanagedType.CustomMarshaller.

The following sample generates CS0634:

class MyCustomMarshallerClass {  
}

public class C {
   [dllimport("MyDll.dll")]
   public static extern void MyFunc(
   [marshal(System.Interop.UnmanagedType.I4, ComType="MyProgId")]   // CS0634

   // try the following instead
   // [marshal(System.Interop.UnmanagedType.CustomMarshaler, 
   //   ComType="MyProgId", 
   //   Marshaller=typeof(MyCustomMarshallerClass))
   // ]

   object o);
   public static void Main() {
   }
}