So I google for a while and found this error only occurs in the following situation:
- When we are interop debugging. For example when you are invoking Win32 APIs from managed codes
- When does a "property eval" of a method that contains a breakpoint. For example when you are "watching" some variables in the debugger.
I totally match above situations, I am interop debugging and there IS a breakpoint on it. So I simply remove the breakpoint, and the clinet works fine.
There are 3 workarounds to this problem:
- Remove breakpoints
- Disable automatic property eval(ToolsOptions menu in VS2005). Remember that VS automatically calls ToString() method and property getters, so when your watch window is opened, or when you quick watch the code, this will happen.
- Use managed debugging only