I have a Xamarin.Android app that uses WCF to connect to a SOAP web service. I need to have a message inspector added so that it can supply headers to all requests before sending. The code to apply the inspector is the following:
public void ApplyClientBehavior(ServiceEndpoint endpoint, ClientRuntime clientRuntime)
{
clientRuntime.ClientMessageInspectors.Add(this);
}
The app compiles and runs, but when calling this the getter for ClientMessageInspectors
I get a System.NotImplementedException
:
at System.ServiceModel.Dispatcher.ClientRuntime.get_ClientMessageInspectors () [0x00000] in /Users/builder/jenkins/workspace/archive-mono/2020-02/android/release/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/ClientRuntime.cs:108
After checking the Mono file referenced in the exception stack trace, I have found that ClientMessageInspectors
is not implemented, but MessageInspectors
is exposed, when I try to use MessageInspectors instead in the app, it does not compile.
What can I do to fix this issue?
CodePudding user response:
I managed to fix it by removing the project that contains the shared code and only use a single Android project inside the solution. After that I added System.ServiceModel version 2.0.5 from Mono and it worked fine.