Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/mcs
diff options
context:
space:
mode:
authorAleksey Kliger (λgeek) <akliger@gmail.com>2015-12-22 15:33:03 +0300
committerAleksey Kliger (λgeek) <akliger@gmail.com>2015-12-22 15:33:03 +0300
commit5c7b6ea2200218f57e4feb657dc2926ca30a31e9 (patch)
treec06c93c3efa76c7d8a38b8a252c1d40de7d7d739 /mcs
parentb362500d857a4a03cbdc38a4dc7a3755d768afb9 (diff)
parentf92547dc16e17e05ce0b89be3119bedc9e43828c (diff)
Merge pull request #2374 from lambdageek/dev/bug-37035
[WCF] ServiceHost should look for inherited ServiceBehaviorAttribute
Diffstat (limited to 'mcs')
-rw-r--r--mcs/class/System.ServiceModel/System.ServiceModel/ServiceHost.cs2
-rw-r--r--mcs/class/System.ServiceModel/Test/System.ServiceModel/ServiceHostTest.cs32
2 files changed, 32 insertions, 2 deletions
diff --git a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHost.cs b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHost.cs
index 2fed9fb3cdb..e438c8f5b71 100644
--- a/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHost.cs
+++ b/mcs/class/System.ServiceModel/System.ServiceModel/ServiceHost.cs
@@ -151,7 +151,7 @@ namespace System.ServiceModel
TAttr PopulateAttribute<TAttr> ()
{
- object [] atts = service_type.GetCustomAttributes (typeof (TAttr), false);
+ object [] atts = service_type.GetCustomAttributes (typeof (TAttr), true);
return (TAttr) (atts.Length > 0 ? atts [0] : Activator.CreateInstance (typeof (TAttr)));
}
diff --git a/mcs/class/System.ServiceModel/Test/System.ServiceModel/ServiceHostTest.cs b/mcs/class/System.ServiceModel/Test/System.ServiceModel/ServiceHostTest.cs
index a120402ff7c..c93c7953d49 100644
--- a/mcs/class/System.ServiceModel/Test/System.ServiceModel/ServiceHostTest.cs
+++ b/mcs/class/System.ServiceModel/Test/System.ServiceModel/ServiceHostTest.cs
@@ -353,6 +353,29 @@ namespace MonoTests.System.ServiceModel
}
}
+ [Test]
+ public void InstanceWithSingletonMode_InheritServiceBehavior ()
+ {
+ // # 37035
+
+ var ep = NetworkHelpers.LocalEphemeralEndPoint ().ToString ();
+
+ ChildSingletonService instance = new ChildSingletonService ();
+ ServiceHost host = new ServiceHost (instance);
+
+ host.AddServiceEndpoint (typeof (SingletonService),
+ new BasicHttpBinding (),
+ new Uri ("http://" + ep + "/s3"));
+
+ try {
+ host.Open ();
+ } catch (InvalidOperationException ex) {
+ Assert.Fail ("InstanceContextMode was not inherited from parent, exception was: {0}", ex);
+ } finally {
+ host.Close ();
+ }
+ }
+
[ServiceContract]
interface IBar
{
@@ -446,7 +469,14 @@ namespace MonoTests.System.ServiceModel
public class SingletonService
{
[OperationContract]
- public void Process (string input)
+ public virtual void Process (string input)
+ {
+ }
+ }
+
+ public class ChildSingletonService : SingletonService
+ {
+ public override void Process (string input)
{
}
}