Bug 46917 - Incorrect validation checks in message formater
Summary: Incorrect validation checks in message formater
Status: RESOLVED FIXED
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies (show other bugs)
Version: master
Hardware: All All
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
URL:
Depends on:
Blocks:
 
Reported: 2016-11-13 13:06 UTC by Andoni Morales
Modified: 2018-04-19 11:54 UTC (History)
2 users (show)

Tags:
Is this bug a regression?: ---
Last known good build:

Notice (2018-05-24): bugzilla.xamarin.com is now in read-only mode.

Please join us on Visual Studio Developer Community and in the Xamarin and Mono organizations on GitHub to continue tracking issues. Bugzilla will remain available for reference in read-only mode. We will continue to work on open Bugzilla bugs, copy them to the new locations as needed for follow-up, and add the new items under Related Links.

Our sincere thanks to everyone who has contributed on this bug tracker over the years. Thanks also for your understanding as we make these adjustments and improvements for the future.


Please create a new report on GitHub or Developer Community with your current version information, steps to reproduce, and relevant error messages or log files if you are hitting an issue that looks similar to this resolved bug and you do not yet see a matching new report.

Related Links:
Status:
RESOLVED FIXED

Description Andoni Morales 2016-11-13 13:06:50 UTC
The BaseMessagesFormater contains incorrect validation check for messages, throwing exceptions for a valid protocol like Onvif media service.

The Onvif WSDL defines the following protocol interface:

[System.CodeDom.Compiler.GeneratedCodeAttribute("System.ServiceModel", "4.0.0.0")]
[System.ServiceModel.ServiceContractAttribute(Namespace = "http://www.onvif.org/ver10/media/wsdl", ConfigurationName = "Media.Media")]
public interface Media
{
        // CODEGEN: Parameter 'VideoSources' requires additional schema information that cannot be captured using the parameter mode. The specific attribute is 'System.Xml.Serialization.XmlElementAttribute'.
	[System.ServiceModel.OperationContractAttribute(Action = "http://www.onvif.org/ver10/media/wsdl/GetVideoSources/")]
	[System.ServiceModel.XmlSerializerFormatAttribute(SupportFaults = true)]
	[System.ServiceModel.ServiceKnownTypeAttribute(typeof(ConfigurationEntity))]
	[System.ServiceModel.ServiceKnownTypeAttribute(typeof(DeviceEntity))]
	[return: System.ServiceModel.MessageParameterAttribute(Name = "VideoSources")]
	Onvif.Media.GetVideoSourcesResponse GetVideoSources(Onvif.Media.GetVideoSourcesRequest request);

	[System.ServiceModel.OperationContractAttribute(Action = "http://www.onvif.org/ver10/media/wsdl/GetVideoSources/")]
	System.Threading.Tasks.Task<Onvif.Media.GetVideoSourcesResponse> GetVideoSourcesAsync(Onvif.Media.GetVideoSourcesRequest request);
}


Trying to call GetVideoSourcesAsync raise an InvalidOperationException

Unhandled Exception:
System.InvalidOperationException: Operation 'GetVideoSourcesAsync' contains a message with parameters. Strongly-typed or untyped message can be paired only with strongly-typed, untyped or void message.
  at System.ServiceModel.Dispatcher.OperationFormatter.Validate (System.ServiceModel.Description.OperationDescription od, System.Boolean isRpc, System.Boolean isEncoded) [0x0005a] in /opt/oneplay-build_darwin_darwin_x86_64/sources/darwin_x86_64/mono-4.6.0/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs:79 
  at System.ServiceModel.Dispatcher.OperationFormatter..ctor (System.ServiceModel.Description.OperationDescription od, System.Boolean isRpc, System.Boolean isEncoded) [0x00006] in /opt/oneplay-build_darwin_darwin_x86_64/sources/darwin_x86_64/mono-4.6.0/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/BaseMessagesFormatter.cs:55 
  at System.ServiceModel.Dispatcher.EndpointDispatcher.PopulateDispatchOperation (System.ServiceModel.Dispatcher.DispatchRuntime db, System.ServiceModel.Description.OperationDescription od) [0x00208] in /opt/oneplay-build_darwin_darwin_x86_64/sources/darwin_x86_64/mono-4.6.0/mcs/class/System.ServiceModel/System.ServiceModel.Dispatcher/EndpointDispatcher.cs:178


I have created the following PR to fix it: https://github.com/mono/mono/compare/master...ylatuya:ws-client-fix?expand=1
Comment 1 Alexander Köplinger [MSFT] 2018-04-19 11:54:59 UTC
Fixed with https://github.com/mono/mono/pull/3772, sorry for the long delay.