Troubleshooting Exceptions: System.NotSupportedException
A NotSupportedException exception is thrown when an invoked method is not supported, or when there is an attempt to read, seek, or write to a stream that does not support the invoked functionality.
When working with the .NET Compact Framework and using P/Invoke on a native function, this exception may be thrown if:
The declaration in managed code is incorrect.
The .NET Compact Framework does not support what you are trying to do.
The DLL names are mangled on export.
In such a case, check:
For any violations of the .NET Compact Framework P/Invoke restrictions.
For any arguments that require pre-allocated memory. If these exist, you should pass a reference to an existing variable.
That the names of the exported functions are correct. This can be verified with DumpBin.exe.
That you are not attempting to pass too many arguments.