.netwcfwcf-discovery

WCF discovery: Interface not found exception


I'm trying to use .net 4's discovery in WCF. But no matter what I do, I'm getting this not very useful exception:

System.ArgumentException crossed a native/managed boundary
  Message=Interface not found.
  Source=mscorlib
  StackTrace:
       at System.RuntimeTypeHandle.VerifyInterfaceIsImplemented(RuntimeTypeHandle handle, RuntimeTypeHandle interfaceHandle)
       at System.RuntimeType.GetInterfaceMap(Type ifaceType)
       at Microsoft.VisualStudio.Diagnostics.ServiceModelSink.ServiceMethodResolver.ResolveMethodInfo(Type implementationType, MethodInfo contractMethod)
       at Microsoft.VisualStudio.Diagnostics.ServiceModelSink.ServiceMethodResolver..ctor(ContractDescription contract, DispatchRuntime runtime, Message request, InstanceContext instanceContext)
  InnerException: 
 

(Stack trace is actually empty.)

Hitting "continue", the program chokes for a few seconds, then continues and displays correct results. This happens even in Microsoft's supplied WCF examples. I made sure that only unhandled exceptions are displayed in the exceptions window in VS 2010.

I've got no idea what might be causing this, especially considering the fact that the program does work perfectly except for short break caused by the exception.

The exception occurs in every project that uses Discovery, both those created by me and those supplied by Microsoft in the official WCF examples. It happens only on my machine, it works fine on my co-worker's box.

In my desperation I cross-posted at http://social.msdn.microsoft.com/Forums/en-US/wcf/thread/8e326b48-232c-4510-8194-aa9d4ba36829


Solution

  • I was facing exactly the same problem with VS2015 update 3

    What worked for me, was enabling the visual studio hosting process in the offending project properties, debug section

    I tried toggling this checkbox a few times, and the behavior was consistent.