Bug 51430 - ServiceHost constructor infinitely recurses with certain interface inheritance
Summary: ServiceHost constructor infinitely recurses with certain interface inheritance
Status: NEW
Alias: None
Product: Class Libraries
Classification: Mono
Component: WCF assemblies ()
Version: 4.6.0 (C8)
Hardware: PC Linux
: --- normal
Target Milestone: Untriaged
Assignee: Bugzilla
Depends on:
Reported: 2017-01-11 22:23 UTC by Jason Roberts
Modified: 2017-09-06 16:55 UTC (History)
1 user (show)

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

A sample project illustrating the issue. (2.29 KB, application/x-7z-compressed)
2017-01-11 22:23 UTC, Jason Roberts

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 for Bug 51430 on GitHub or Developer Community if you have new information to add and do not yet see a matching new report.

If the latest results still closely match this report, you can use the original description:

  • Export the original title and description: GitHub Markdown or Developer Community HTML
  • Copy the title and description into the new report. Adjust them to be up-to-date if needed.
  • Add your new information.

In special cases on GitHub you might also want the comments: GitHub Markdown with public comments

Related Links:

Description Jason Roberts 2017-01-11 22:23:55 UTC
Created attachment 19238 [details]
A sample project illustrating the issue.

Inside ContractDescriptionGenerator the method GetContractInternal calls into GetContractAssignableToInterfaces with the first parameter being of the given type that is being checked.

GetContractAssignableToInterfaces however doesn't actually look at the given type. So if you have a class that uses ServiceContractAttribute who implements another interface that does *not* use ServiceContractAttribute, the ContractDescriptionGenerator will iterate to the non-service interface, call GetContractAssignableToInterfaces with that type and then recurse forever.

This behavior only occurs in the mono library. We have verified that it does not occur in MS .NET implementation.  Have attached a sample project where the bug occurs.