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)));
}
}
}
+ [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
{
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)
{
}
}