Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WCF - FaultException with FaultCode causes CommunicationException on client #12995

Closed
dalefugier opened this issue Feb 14, 2019 · 15 comments · Fixed by #18154
Closed

WCF - FaultException with FaultCode causes CommunicationException on client #12995

dalefugier opened this issue Feb 14, 2019 · 15 comments · Fixed by #18154

Comments

@dalefugier
Copy link

dalefugier commented Feb 14, 2019

If a WCF server, running on Windows, throws a FaultException that contains a FaultCode to a WCF client, running on macOS, a CommunicationException is caught, not the expected FaultException.

Note, this is a regression an earlier version of Mono. I've tested against Version 4.0.2.

Steps to Reproduce

You can find source to a simple example that reproduces his behavior here:

https://github.com/dalefugier/Echo

Current Behavior

A FaultException that contains a FaultCode, thrown by a server, is caught as a CommunicationException on a client.

Expected Behavior

A FaultException that contains a FaultCode, thrown by a server, should be caught as a FaultException on a client.

On which platforms did you notice this

[X] macOS
[ ] Linux
[ ] Windows

Version Used:

Mono Version 5.16.0.220

Stacktrace

{System.ServiceModel.CommunicationException: Received an invalid SOAP Fault message ---
> System.Xml.XmlException: Content cannot be converted to the type
System.Xml.XmlQualifiedName. Line 1, position 78. ---> System.FormatException: The ':'
character, hexadecimal value 0x3A, cannot be included in a name.
@dalefugier
Copy link
Author

dalefugier commented Feb 14, 2019

If you'd rather not clone the repo, that contains the sample that replicates the issue, here is the solution:

Echo.zip

Thanks,

-- Dale

@EgorBo
Copy link
Member

EgorBo commented Feb 14, 2019

Duplicates #10304

@dalefugier
Copy link
Author

@EgorBo , @marek-safar, I'm hoping I can get come clarification on why the issue was marked as Duplicate and Closed. The linked issue (10304) is related to Android, not macOS. And I'm using a fairly new, stable version of Mono. Is it possible to get someone to to test my Echo test harness with Xamarin.Mac 5.7 and confirm? If not, how can I get Xamarin.Mac 5.7?

Thanks,

-- Dale

@EgorBo
Copy link
Member

EgorBo commented Feb 15, 2019

@dalefugier the linked issue is cross-platform including Xamarin.Mac, see #10304 (comment)
I'll check your repro case just in case

@dalefugier
Copy link
Author

@EgorBo, did you ever have a chance to look at the example I posted?

@dan-rigdon-bel
Copy link

@marek-safar When can we expect a fix for this bug to make its way into stable Mono? It looks like this and #10304 are fixed and in preview versions of Mono, but it would be helpful to know an approximate time period for graduating to stable. Thanks.

@marek-safar
Copy link
Member

@dbelcher the fix should be available in stable Mono versions since Mono 5.20

@dan-rigdon-bel
Copy link

@marek-safar Thank you for the reply and the help interpreting this one. We are using the Visual Studio for Mac channel for our embedded Mono, so that explains it. Looking forward to seeing this one. Much appreciated.

@dalefugier
Copy link
Author

@EgorBo, @marek-safar, we just tested the above code with Mono MDK 5.20.1.19, and the issue still exists. Can you re-open this issue?

@marek-safar
Copy link
Member

@dalefugier are you saying it's not duplicate of the issue mentioned above or both of them are still failing with 5.20 ?

@dalefugier
Copy link
Author

dalefugier commented May 2, 2019

@marek-safar, we have no way of testing the linked issue, (10304), as it relates to Android and we don't develop for that platform. That said, we can still repeat the bug reported in this issue, (12995), with Mono MDK 5.20.1.19. I can only assume this issue is not a duplicate of the linked issue...

@dan-rigdon-bel
Copy link

Hi @marek-safar Is there any reasonable expectation that this could get fixed soon?
This remains an issue for us with Mono 6.4.0.198. The bug on our end that is a symptom of this bug:
https://mcneel.myjetbrains.com/youtrack/issue/RH-49443
remains a major annoyance for our users.

@marek-safar
Copy link
Member

@steveisok please allocate some time to estimate fixes for this issue

@steveisok
Copy link
Contributor

steveisok commented Dec 11, 2019

Appears our faultcode parsing was too 'by the book' as it tried to read the content as an XmlQualifiedName. This meant that <faultcode>s:1</faultcode> was being flagged as invalid because the xml spec says that the NameStartChar cannot be a number.

https://www.w3.org/TR/REC-xml/#NT-Name

I fixed this locally by taking the .net framework block that reads in the fault code. It's much more forgiving ;-). Only problem is I need to determine if I broke anything else.

steveisok pushed a commit to steveisok/mono that referenced this issue Dec 12, 2019
The mono implementation was reading the faultcode content as an XmlQualifiedName, which applied the rule where you could not
start a name with a number. This caused interoperability problems with the .net framework because their parsing just looks
for <namespace>:<name>, where name can be any string.

Example:

<faultcode>s:1</faultcode>

On mono, a soap response that contains a fault code name of 1 will throw an error.  If you run the same code on the .net framework, it will not.

Fixes mono#12995
akoeplinger pushed a commit that referenced this issue Dec 13, 2019
* Relax faultcode parsing for Soap11 message errors.

The mono implementation was reading the faultcode content as an XmlQualifiedName, which applied the rule where you could not
start a name with a number. This caused interoperability problems with the .net framework because their parsing just looks
for <namespace>:<name>, where name can be any string.

Example:

<faultcode>s:1</faultcode>

On mono, a soap response that contains a fault code name of 1 will throw an error.  If you run the same code on the .net framework, it will not.

Fixes #12995

* [csproj] Update project files
monojenkins pushed a commit to monojenkins/mono that referenced this issue Dec 13, 2019
The mono implementation was reading the faultcode content as an XmlQualifiedName, which applied the rule where you could not
start a name with a number. This caused interoperability problems with the .net framework because their parsing just looks
for <namespace>:<name>, where name can be any string.

Example:

<faultcode>s:1</faultcode>

On mono, a soap response that contains a fault code name of 1 will throw an error.  If you run the same code on the .net framework, it will not.

Fixes mono#12995
@dan-rigdon-bel
Copy link

Thanks @steveisok! Great to see a fix was found. Can you help us understand which version of Mono this fix will go into? (Sorry, I'm not up-to-date with the release cycle tempo).

akoeplinger pushed a commit that referenced this issue Dec 13, 2019
* Relax faultcode parsing for Soap11 message errors.

The mono implementation was reading the faultcode content as an XmlQualifiedName, which applied the rule where you could not
start a name with a number. This caused interoperability problems with the .net framework because their parsing just looks
for <namespace>:<name>, where name can be any string.

Example:

<faultcode>s:1</faultcode>

On mono, a soap response that contains a fault code name of 1 will throw an error.  If you run the same code on the .net framework, it will not.

Fixes #12995

* [csproj] Update project files
jonpryor pushed a commit to xamarin/xamarin-android that referenced this issue Jan 30, 2020
Changes: mono/api-snapshot@6f14e43...8ea1d66

	$ git diff --shortstat 6f14e433...8ea1d663
	 21 files changed, 719 insertions(+), 444 deletions(-)

Changes: mono/boringssl@4ca62c5...d7b108e

	$ git diff --shortstat 4ca62c57...d7b108ee
	 1 file changed, 1 insertion(+)

Changes: dotnet/cecil@cb6c1ca...a6a7f5c

	$ git diff --shortstat cb6c1ca9...a6a7f5c0
	 47 files changed, 587 insertions(+), 444 deletions(-)

Changes: mono/corefx@10a41e9...5940515

	$ git diff --shortstat 10a41e9f...59405155
	 55 files changed, 1382 insertions(+), 369 deletions(-)

Changes: mono/mono@18920a8...2edccc5

	$ git diff --shortstat 18920a83...2edccc52
        1393 files changed, 44742 insertions(+), 90381 deletions(-)

Context: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1005448
Context: https://dev.azure.com/devdiv/DevDiv/_workitems/edit/1005448
Context: KSP-CKAN/CKAN#2881
Context: mono/mono#10559
Context: mono/mono#12249
Context: mono/mono#12337
Context: mono/mono#12995
Context: mono/mono#13777
Context: mono/mono#15006
Context: mono/mono#15010
Context: mono/mono#15181
Context: mono/mono#15805
Context: mono/mono#15845
Context: mono/mono#16026
Context: mono/mono#16206
Context: mono/mono#16410
Context: mono/mono#16513
Context: mono/mono#16557
Context: mono/mono#16588
Context: mono/mono#16632
Context: mono/mono#16701
Context: mono/mono#16778
Context: mono/mono#17053
Context: mono/mono#17084
Context: mono/mono#17133
Context: mono/mono#17151
Context: mono/mono#17161
Context: mono/mono#17190
Context: mono/mono#17278
Context: mono/mono#17278
Context: mono/mono#17317
Context: mono/mono#17367
Context: mono/mono#17389
Context: mono/mono#17546
Context: mono/mono#17549
Context: mono/mono#17569
Context: mono/mono#17601
Context: mono/mono#17665
Context: mono/mono#17687
Context: mono/mono#17737
Context: mono/mono#17790
Context: mono/mono#17869
Context: mono/mono#17878
Context: mono/mono#17916
Context: mono/mono#17924
Context: mono/mono#17926
Context: mono/mono#17931
Context: mono/mono#18213
Context: mono/mono#18221
Context: mono/mono#18273
Context: mono/mono#18276
Context: mono/mono#18317
Context: mono/mono#18388
Context: mono/mono#18455
jonpryor pushed a commit to xamarin/xamarin-android that referenced this issue Mar 13, 2020
Changes: mono/api-snapshot@53a841f...5b8247e

	$ git diff --shortstat 53a841ff...5b8247e2
	 9 files changed, 572 insertions(+), 13 deletions(-)

Changes: mono/corefx@1cdb9c2...7c9e215

	$ git diff --shortstat 1cdb9c20...7c9e2158
	 24 files changed, 2393 insertions(+), 396 deletions(-)

Changes: dotnet/cecil@a6a7f5c...8021f3f

	$ git diff --shortstat a6a7f5c0...8021f3fb
	 16 files changed, 98 insertions(+), 25 deletions(-)

Changes: dotnet/linker@e8d054b...e1c7a72

	$ git diff --shortstat e8d054bf...e1c7a729
	 220 files changed, 9758 insertions(+), 3165 deletions(-)

Changes: mono/mono@2ff8988...d90665a

	$ git diff --shortstat 2ff89885...d90665a4
	 612 files changed, 20193 insertions(+), 10239 deletions(-)

Context: mono/mono#9726
Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1048838
Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1050615
Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1069059
Context: mono/mono#10643
Context: mono/mono#10651
Context: mono/mono#12022
Context: mono/mono#12995
Context: mono/mono#15612
Context: mono/mono#16513
Context: mono/mono#16588
Context: mono/mono#16778
Context: mono/mono#16969
Context: mono/mono#17140
Context: mono/mono#17601
Context: mono/mono#17869
Context: mono/mono#17878
Context: mono/mono#17916
Context: mono/mono#17926
Context: mono/mono#17980
Context: mono/mono#18006
Context: mono/mono#18019
Context: mono/mono#18020
Context: mono/mono#18030
Context: mono/mono#18061
Context: mono/mono#18064
Context: mono/mono#18106
Context: mono/mono#18120
Context: mono/mono#18191
Context: mono/mono#18202
Context: mono/mono#18213
Context: mono/mono#18221
Context: mono/mono#18247
Context: mono/mono#18273
Context: mono/mono#18276
Context: mono/mono#18317
Context: mono/mono#18323
Context: mono/mono#18364
Context: mono/mono#18370
Context: mono/mono#18417
Context: mono/mono#18418
Context: mono/mono#18455
Context: mono/mono#18506
Context: mono/mono#18524
Context: mono/mono#18530
Context: mono/mono#18554
Context: mono/mono#18572
Context: mono/mono#18578
Context: mono/mono#18584
Context: mono/mono#18612
Context: mono/mono#18614
Context: mono/mono#18675
Context: mono/mono#18676
Context: mono/mono#18925
Context: mono/mono#19009
Context: https://issuetracker.unity3d.com/issues/unity-physics-collisions-do-not-work-and-errors-are-thrown-when-entering-play-mode
Context: https://xamarin.github.io/bugzilla-archives/20/20233/bug.html
jonpryor pushed a commit to xamarin/xamarin-android that referenced this issue Mar 15, 2020
Changes: mono/api-snapshot@53a841f...5b8247e

	$ git diff --shortstat 53a841ff...5b8247e2
	 9 files changed, 572 insertions(+), 13 deletions(-)

Changes: mono/corefx@1cdb9c2...7c9e215

	$ git diff --shortstat 1cdb9c20...7c9e2158
	 24 files changed, 2393 insertions(+), 396 deletions(-)

Changes: dotnet/cecil@a6a7f5c...8021f3f

	$ git diff --shortstat a6a7f5c0...8021f3fb
	 16 files changed, 98 insertions(+), 25 deletions(-)

Changes: dotnet/linker@e8d054b...e1c7a72

	$ git diff --shortstat e8d054bf...e1c7a729
	 220 files changed, 9758 insertions(+), 3165 deletions(-)

Changes: mono/mono@2ff8988...d90665a

	$ git diff --shortstat 2ff89885...d90665a4
	 612 files changed, 20193 insertions(+), 10239 deletions(-)

Context: mono/mono#9726
Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1048838
Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1050615
Context: https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1069059
Context: mono/mono#10643
Context: mono/mono#10651
Context: mono/mono#12022
Context: mono/mono#12995
Context: mono/mono#15612
Context: mono/mono#16513
Context: mono/mono#16588
Context: mono/mono#16778
Context: mono/mono#16969
Context: mono/mono#17140
Context: mono/mono#17601
Context: mono/mono#17869
Context: mono/mono#17878
Context: mono/mono#17916
Context: mono/mono#17926
Context: mono/mono#17980
Context: mono/mono#18006
Context: mono/mono#18019
Context: mono/mono#18020
Context: mono/mono#18030
Context: mono/mono#18061
Context: mono/mono#18064
Context: mono/mono#18106
Context: mono/mono#18120
Context: mono/mono#18191
Context: mono/mono#18202
Context: mono/mono#18213
Context: mono/mono#18221
Context: mono/mono#18247
Context: mono/mono#18273
Context: mono/mono#18276
Context: mono/mono#18317
Context: mono/mono#18323
Context: mono/mono#18364
Context: mono/mono#18370
Context: mono/mono#18417
Context: mono/mono#18418
Context: mono/mono#18455
Context: mono/mono#18506
Context: mono/mono#18524
Context: mono/mono#18530
Context: mono/mono#18554
Context: mono/mono#18572
Context: mono/mono#18578
Context: mono/mono#18584
Context: mono/mono#18612
Context: mono/mono#18614
Context: mono/mono#18675
Context: mono/mono#18676
Context: mono/mono#18925
Context: mono/mono#19009
Context: https://issuetracker.unity3d.com/issues/unity-physics-collisions-do-not-work-and-errors-are-thrown-when-entering-play-mode
Context: https://xamarin.github.io/bugzilla-archives/20/20233/bug.html
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants