You've already forked linux-packaging-mono
Imported Upstream version 4.3.2.467
Former-commit-id: 9c2cb47f45fa221e661ab616387c9cda183f283d
This commit is contained in:
@@ -75,7 +75,7 @@ using System.Runtime.InteropServices;
|
||||
[assembly: InternalsVisibleTo ("System.ServiceModel.Discovery, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")] // AnnouncementChannelEndpointElementCollection requires it.
|
||||
#endif
|
||||
|
||||
#if NET_4_0 && HAS_ACTIVATION
|
||||
#if HAS_ACTIVATION
|
||||
|
||||
[assembly: TypeForwardedTo (typeof (System.ServiceModel.ServiceHostingEnvironment))]
|
||||
[assembly: TypeForwardedTo (typeof (System.ServiceModel.Activation.ServiceHostFactory))]
|
||||
|
@@ -147,14 +147,15 @@ namespace System.Collections.Generic
|
||||
InsertItem (index, item);
|
||||
}
|
||||
|
||||
[MonoTODO ("should we lock and remove item without invoking RemoveItem() instead?")]
|
||||
public bool Remove (T item)
|
||||
{
|
||||
int index = IndexOf (item);
|
||||
if (index < 0)
|
||||
return false;
|
||||
RemoveAt (index);
|
||||
return true;
|
||||
lock (root) {
|
||||
int index = IndexOf (item);
|
||||
if (index < 0)
|
||||
return false;
|
||||
RemoveAt (index);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public void RemoveAt (int index)
|
||||
|
@@ -48,24 +48,29 @@ namespace System.ServiceModel.Channels.Http
|
||||
Entries = new List<HttpChannelListenerEntry> ();
|
||||
}
|
||||
|
||||
public List<HttpChannelListenerEntry> Entries { get; private set; }
|
||||
protected List<HttpChannelListenerEntry> Entries { get; private set; }
|
||||
object entries_lock = new object ();
|
||||
|
||||
public abstract void RegisterListener (ChannelDispatcher channel, HttpTransportBindingElement element, TimeSpan timeout);
|
||||
public abstract void UnregisterListener (ChannelDispatcher channel, TimeSpan timeout);
|
||||
|
||||
protected void RegisterListenerCommon (ChannelDispatcher channel, TimeSpan timeout)
|
||||
{
|
||||
Entries.Add (new HttpChannelListenerEntry (channel, new AutoResetEvent (false)));
|
||||
lock (entries_lock) {
|
||||
Entries.Add (new HttpChannelListenerEntry (channel, new AutoResetEvent (false)));
|
||||
|
||||
Entries.Sort (HttpChannelListenerEntry.CompareEntries);
|
||||
Entries.Sort (HttpChannelListenerEntry.CompareEntries);
|
||||
}
|
||||
}
|
||||
|
||||
protected void UnregisterListenerCommon (ChannelDispatcher channel, TimeSpan timeout)
|
||||
{
|
||||
var entry = Entries.First (e => e.ChannelDispatcher == channel);
|
||||
Entries.Remove (entry);
|
||||
lock (entries_lock) {
|
||||
var entry = Entries.First (e => e.ChannelDispatcher == channel);
|
||||
Entries.Remove (entry);
|
||||
|
||||
entry.WaitHandle.Set (); // make sure to finish pending requests.
|
||||
entry.WaitHandle.Set (); // make sure to finish pending requests.
|
||||
}
|
||||
}
|
||||
|
||||
public void ProcessNewContext (HttpContextInfo ctxi)
|
||||
@@ -79,9 +84,11 @@ namespace System.ServiceModel.Channels.Http
|
||||
|
||||
HttpChannelListenerEntry SelectChannel (HttpContextInfo ctx)
|
||||
{
|
||||
foreach (var e in Entries)
|
||||
if (e.FilterHttpContext (ctx))
|
||||
return e;
|
||||
lock (entries_lock) {
|
||||
foreach (var e in Entries)
|
||||
if (e.FilterHttpContext (ctx))
|
||||
return e;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -90,7 +97,10 @@ namespace System.ServiceModel.Channels.Http
|
||||
DateTime start = DateTime.Now;
|
||||
|
||||
context = null;
|
||||
var ce = Entries.FirstOrDefault (e => e.ChannelDispatcher == channel);
|
||||
HttpChannelListenerEntry ce = null;
|
||||
lock (entries_lock) {
|
||||
ce = Entries.FirstOrDefault (e => e.ChannelDispatcher == channel);
|
||||
}
|
||||
if (ce == null)
|
||||
return false;
|
||||
lock (ce.RetrieverLock) {
|
||||
|
@@ -92,8 +92,8 @@ namespace System.ServiceModel.Channels.Http
|
||||
AbortConnections (timeout);
|
||||
// FIXME: this wait is sort of hack (because it should not be required), but without it some tests are blocked.
|
||||
// This hack even had better be moved to base.CancelAsync().
|
||||
if (CurrentAsyncResult != null)
|
||||
CurrentAsyncResult.AsyncWaitHandle.WaitOne (TimeSpan.FromMilliseconds (300));
|
||||
// if (CurrentAsyncResult != null)
|
||||
// CurrentAsyncResult.AsyncWaitHandle.WaitOne (TimeSpan.FromMilliseconds (300));
|
||||
return base.CancelAsync (timeout);
|
||||
}
|
||||
|
||||
@@ -104,12 +104,15 @@ namespace System.ServiceModel.Channels.Http
|
||||
}
|
||||
|
||||
bool close_started;
|
||||
object close_lock = new object ();
|
||||
|
||||
protected override void OnClose (TimeSpan timeout)
|
||||
{
|
||||
if (close_started)
|
||||
return;
|
||||
close_started = true;
|
||||
lock (close_lock) {
|
||||
if (close_started)
|
||||
return;
|
||||
close_started = true;
|
||||
}
|
||||
DateTime start = DateTime.Now;
|
||||
|
||||
// FIXME: consider timeout
|
||||
|
@@ -135,9 +135,18 @@ namespace System.ServiceModel.Channels.NetTcp
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
|
||||
bool close_started;
|
||||
object close_lock = new object ();
|
||||
|
||||
protected override void OnClose (TimeSpan timeout)
|
||||
{
|
||||
lock (close_lock) {
|
||||
if (close_started)
|
||||
return;
|
||||
close_started = true;
|
||||
}
|
||||
|
||||
client.Close ();
|
||||
client = null;
|
||||
base.OnClose (timeout);
|
||||
|
@@ -87,15 +87,16 @@ namespace System.ServiceModel.Channels
|
||||
|
||||
protected override void OnClose (TimeSpan timeout)
|
||||
{
|
||||
if (CurrentAsyncThread != null)
|
||||
if (currentAsyncThreads.Count > 0)
|
||||
if (!CancelAsync (timeout))
|
||||
CurrentAsyncThread.Abort ();
|
||||
foreach (Thread asyncThread in currentAsyncThreads)
|
||||
asyncThread.Abort ();
|
||||
}
|
||||
|
||||
public virtual bool CancelAsync (TimeSpan timeout)
|
||||
{
|
||||
// FIXME: It should wait for the actual completion.
|
||||
return CurrentAsyncResult == null;
|
||||
return currentAsyncResults.Count > 0;
|
||||
//return CurrentAsyncResult == null || CurrentAsyncResult.AsyncWaitHandle.WaitOne (timeout);
|
||||
}
|
||||
|
||||
@@ -111,18 +112,18 @@ namespace System.ServiceModel.Channels
|
||||
TryReceiveDelegate try_recv_delegate;
|
||||
|
||||
object async_result_lock = new object ();
|
||||
protected Thread CurrentAsyncThread { get; private set; }
|
||||
protected IAsyncResult CurrentAsyncResult { get; private set; }
|
||||
HashSet<Thread> currentAsyncThreads = new HashSet<Thread>();
|
||||
HashSet<IAsyncResult> currentAsyncResults = new HashSet<IAsyncResult>();
|
||||
|
||||
public virtual IAsyncResult BeginTryReceiveRequest (TimeSpan timeout, AsyncCallback callback, object state)
|
||||
{
|
||||
if (CurrentAsyncResult != null)
|
||||
throw new InvalidOperationException ("Another async TryReceiveRequest operation is in progress");
|
||||
IAsyncResult result = null;
|
||||
|
||||
if (try_recv_delegate == null)
|
||||
try_recv_delegate = new TryReceiveDelegate (delegate (TimeSpan tout, out RequestContext ctx) {
|
||||
lock (async_result_lock) {
|
||||
if (CurrentAsyncResult != null)
|
||||
CurrentAsyncThread = Thread.CurrentThread;
|
||||
if (currentAsyncResults.Contains (result))
|
||||
currentAsyncThreads.Add (Thread.CurrentThread);
|
||||
}
|
||||
try {
|
||||
return TryReceiveRequest (tout, out ctx);
|
||||
@@ -143,19 +144,19 @@ namespace System.ServiceModel.Channels
|
||||
//the whole app. Ignore for now
|
||||
} finally {
|
||||
lock (async_result_lock) {
|
||||
CurrentAsyncResult = null;
|
||||
CurrentAsyncThread = null;
|
||||
currentAsyncResults.Remove (result);
|
||||
currentAsyncThreads.Remove (Thread.CurrentThread);
|
||||
}
|
||||
}
|
||||
ctx = null;
|
||||
return false;
|
||||
});
|
||||
RequestContext dummy;
|
||||
IAsyncResult result;
|
||||
lock (async_result_lock) {
|
||||
result = CurrentAsyncResult = try_recv_delegate.BeginInvoke (timeout, out dummy, callback, state);
|
||||
result = try_recv_delegate.BeginInvoke (timeout, out dummy, callback, state);
|
||||
currentAsyncResults.Add (result);
|
||||
}
|
||||
// Note that at this point CurrentAsyncResult can be null here if delegate has run to completion
|
||||
// Note that at this point result can be missing from currentAsyncResults here if delegate has run to completion
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@@ -139,6 +139,45 @@ namespace System.ServiceModel.Description
|
||||
return ret;
|
||||
}
|
||||
|
||||
internal static Type GetContractAssignableToInterfaces(Type given, Type [] givenInterfaces)
|
||||
{
|
||||
if ((given != null) && (givenInterfaces.Count() < 1))
|
||||
return null;
|
||||
Dictionary<Type,int> interfaceGraph = new Dictionary<Type,int> ();
|
||||
foreach (var smaller in givenInterfaces) {
|
||||
interfaceGraph [smaller] = 0;
|
||||
foreach (var bigger in givenInterfaces) {
|
||||
if (smaller.IsAssignableFrom (bigger)) {
|
||||
interfaceGraph [smaller]++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<Type> possibleInterfaces = new List<Type> ();
|
||||
foreach (var node in interfaceGraph) {
|
||||
if (node.Value == 1) {
|
||||
possibleInterfaces.Add(node.Key);
|
||||
}
|
||||
}
|
||||
// For this purpose a contract is a set of interfaces. it is necessary to find the interface representative of rest of the set. It will be assignable to all of
|
||||
// the others but can only be assigned to by itself. This will give it count of ! in its slot in the interfaceGraph. To be a valid set there can be only one with a count of one
|
||||
// in its slot. More results in InvalidOperation exceptioni with ambigours error message, less means that the interface we want is the one passed in by the parameter given
|
||||
// and by returning null we give the callign method permission to use it..
|
||||
switch (possibleInterfaces.Count())
|
||||
{
|
||||
case 0:
|
||||
break;
|
||||
case 1:
|
||||
return possibleInterfaces [0];
|
||||
break;
|
||||
default:
|
||||
if (!given.IsInterface)
|
||||
throw new InvalidOperationException ("The contract type of " + given + " is ambiguous: can be either " + possibleInterfaces[0] + " or " + possibleInterfaces[1]);
|
||||
break;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
internal static ContractDescription GetContractInternal (Type givenContractType, Type givenServiceType, Type serviceTypeForCallback)
|
||||
{
|
||||
if (givenContractType == null)
|
||||
@@ -153,16 +192,12 @@ namespace System.ServiceModel.Description
|
||||
exactContractType = givenContractType;
|
||||
sca = contracts [givenContractType];
|
||||
} else {
|
||||
foreach (Type t in contracts.Keys)
|
||||
if (t.IsAssignableFrom(givenContractType)) {
|
||||
if (t.IsAssignableFrom (exactContractType)) // exact = IDerived, t = IBase
|
||||
continue;
|
||||
if (sca != null && (exactContractType == null || !exactContractType.IsAssignableFrom (t))) // t = IDerived, exact = IBase
|
||||
throw new InvalidOperationException ("The contract type of " + givenContractType + " is ambiguous: can be either " + exactContractType + " or " + t);
|
||||
exactContractType = t;
|
||||
sca = contracts [t];
|
||||
}
|
||||
Type[] contractTypes = contracts.Keys.ToArray() as Type [];
|
||||
exactContractType = GetContractAssignableToInterfaces(givenContractType, contractTypes);
|
||||
if (exactContractType != null)
|
||||
sca = contracts[exactContractType];
|
||||
}
|
||||
|
||||
if (exactContractType == null)
|
||||
exactContractType = givenContractType;
|
||||
if (sca == null) {
|
||||
@@ -171,6 +206,7 @@ namespace System.ServiceModel.Description
|
||||
else
|
||||
return null; // no contract
|
||||
}
|
||||
|
||||
string name = sca.Name ?? exactContractType.Name;
|
||||
string ns = sca.Namespace ?? "http://tempuri.org/";
|
||||
|
||||
@@ -197,17 +233,18 @@ namespace System.ServiceModel.Description
|
||||
*/
|
||||
|
||||
var inherited = new Collection<ContractDescription> ();
|
||||
foreach (var it in cd.ContractType.GetInterfaces ()) {
|
||||
var interfaces = cd.ContractType.GetInterfaces ();
|
||||
foreach (var it in interfaces ) {
|
||||
var icd = GetContractInternal (it, givenServiceType, null);
|
||||
if (icd != null)
|
||||
inherited.Add (icd);
|
||||
}
|
||||
|
||||
foreach (var icd in inherited) {
|
||||
foreach (var od in icd.Operations)
|
||||
if (!cd.Operations.Any(o => o.Name == od.Name && o.SyncMethod == od.SyncMethod &&
|
||||
o.BeginMethod == od.BeginMethod && o.InCallbackContract == od.InCallbackContract))
|
||||
foreach (var od in icd.Operations) {
|
||||
if (!cd.Operations.Any (o => o.Name == od.Name && o.SyncMethod == od.SyncMethod && o.BeginMethod == od.BeginMethod && o.InCallbackContract == od.InCallbackContract))
|
||||
cd.Operations.Add (od);
|
||||
}
|
||||
}
|
||||
|
||||
FillOperationsForInterface (cd, cd.ContractType, givenServiceType, false);
|
||||
|
@@ -455,8 +455,11 @@ namespace System.ServiceModel.Dispatcher
|
||||
public void CloseInput ()
|
||||
{
|
||||
foreach (var ch in channels.ToArray ()) {
|
||||
if (ch.State == CommunicationState.Closed)
|
||||
RemoveChannel (ch);
|
||||
if (ch.State == CommunicationState.Closed) {
|
||||
lock (channels) {
|
||||
RemoveChannel (ch);
|
||||
}
|
||||
}
|
||||
else {
|
||||
try {
|
||||
ch.Close (close_timeout - (DateTime.Now - close_started));
|
||||
|
@@ -38,6 +38,7 @@ using System.ServiceModel.Channels;
|
||||
using System.ServiceModel.Description;
|
||||
using System.Text;
|
||||
using System.Xml;
|
||||
using System.Xml.Schema;
|
||||
using System.Xml.Serialization;
|
||||
|
||||
namespace System.ServiceModel.Dispatcher
|
||||
@@ -135,6 +136,11 @@ namespace System.ServiceModel.Dispatcher
|
||||
|
||||
protected override void OnWriteBodyContents (XmlDictionaryWriter writer)
|
||||
{
|
||||
if (writer.WriteState == WriteState.Element) {
|
||||
writer.WriteXmlnsAttribute ("xsi", XmlSchema.InstanceNamespace);
|
||||
writer.WriteXmlnsAttribute ("xsd", XmlSchema.Namespace);
|
||||
}
|
||||
|
||||
serializer.Serialize (writer, body);
|
||||
}
|
||||
}
|
||||
|
@@ -953,3 +953,64 @@ System.ServiceModel/WSHttpBindingBase.cs
|
||||
System.ServiceModel/WSHttpSecurity.cs
|
||||
System.ServiceModel/X509CertificateEndpointIdentity.cs
|
||||
System.ServiceModel/XmlSerializerFormatAttribute.cs
|
||||
|
||||
System.ServiceModel.Channels/IHttpCookieContainer.cs
|
||||
System.ServiceModel.Channels/HttpCookieContainerBindingElement.cs
|
||||
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/Atom10FeedFormatter.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/Atom10FeedFormatter_1.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/Atom10ItemFormatter.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/Atom10ItemFormatter_1.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/AtomPub10CategoriesDocumentFormatter.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/AtomPub10ServiceDocumentFormatter.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/AtomPub10ServiceDocumentFormatter_1.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/CategoriesDocument.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/CategoriesDocumentFormatter.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/ISyndicationElement.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/InlineCategoriesDocument.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/ReferencedCategoriesDocument.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/ResourceCollectionInfo.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/Rss20FeedFormatter.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/Rss20FeedFormatter_1.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/Rss20ItemFormatter.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/Rss20ItemFormatter_1.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/ServiceDocument.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/ServiceDocumentFormatter.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationCategory.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationContent.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationElementExtension.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationElementExtensionCollection.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationExtensions.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationFeed.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationFeedFormatter.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationItem.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationItemFormatter.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationLink.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationPerson.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/SyndicationVersions.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/TextSyndicationContent.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/TextSyndicationContentKind.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/UrlSyndicationContent.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/Workspace.cs
|
||||
../System.ServiceModel.Web/System.ServiceModel.Syndication/XmlSyndicationContent.cs
|
||||
../System.ServiceModel.Web/System/UriTemplate.cs
|
||||
../System.ServiceModel.Web/System/UriTemplateEquivalenceComparer.cs
|
||||
../System.ServiceModel.Web/System/UriTemplateMatch.cs
|
||||
../System.ServiceModel.Web/System/UriTemplateMatchException.cs
|
||||
../System.ServiceModel.Web/System/UriTemplateTable.cs
|
||||
|
||||
System.ServiceModel/HttpBindingBase.cs
|
||||
System.ServiceModel/BasicHttpBinding_4_5.cs
|
||||
System.ServiceModel/BasicHttpsBinding.cs
|
||||
System.ServiceModel/BasicHttpsSecurity.cs
|
||||
System.ServiceModel/NetHttpBinding.cs
|
||||
System.ServiceModel/NetHttpMessageEncoding.cs
|
||||
System.ServiceModel.Channels/CompressionFormat.cs
|
||||
System.ServiceModel.Channels/WebSocketTransportSettings.cs
|
||||
System.ServiceModel.Channels/WebSocketTransportUsage.cs
|
||||
System.ServiceModel.Configuration/BasicHttpBindingElement_4_5.cs
|
||||
System.ServiceModel.Configuration/HttpBindingBaseElement.cs
|
||||
System.ServiceModel.Configuration/BasicHttpsBindingElement.cs
|
||||
System.ServiceModel.Configuration/BasicHttpsSecurityElement.cs
|
||||
System.ServiceModel.Configuration/BasicHttpsBindingCollectionElement.cs
|
||||
|
||||
|
@@ -43,7 +43,8 @@ namespace System.ServiceModel
|
||||
int max_conn;
|
||||
OptionalReliableSession reliable_session;
|
||||
NetTcpSecurity security;
|
||||
XmlDictionaryReaderQuotas reader_quotas;
|
||||
XmlDictionaryReaderQuotas reader_quotas
|
||||
= new XmlDictionaryReaderQuotas ();
|
||||
bool transaction_flow;
|
||||
TransactionProtocol transaction_protocol;
|
||||
TcpTransportBindingElement transport;
|
||||
|
@@ -101,7 +101,9 @@ namespace System.ServiceModel
|
||||
ContractDescription cd = GetExistingContract (implementedContract);
|
||||
if (cd == null) {
|
||||
cd = ContractDescription.GetContract (implementedContract);
|
||||
contracts.Add (cd.ContractType.FullName, cd);
|
||||
if (!contracts.ContainsKey (cd.ContractType.FullName)) {
|
||||
contracts.Add (cd.ContractType.FullName, cd);
|
||||
}
|
||||
}
|
||||
|
||||
return AddServiceEndpointCore (cd, binding, ea, listenUri);
|
||||
@@ -121,7 +123,8 @@ namespace System.ServiceModel
|
||||
contracts = new Dictionary<string,ContractDescription> ();
|
||||
implementedContracts = contracts;
|
||||
ServiceDescription sd;
|
||||
foreach (ContractDescription cd in GetServiceContractDescriptions())
|
||||
IEnumerable<ContractDescription> contractDescriptions = GetServiceContractDescriptions ();
|
||||
foreach (ContractDescription cd in contractDescriptions)
|
||||
contracts.Add (cd.ContractType.FullName, cd);
|
||||
|
||||
if (SingletonInstance != null) {
|
||||
@@ -148,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)));
|
||||
}
|
||||
|
||||
|
@@ -39,10 +39,7 @@ using System.Xml;
|
||||
using NUnit.Framework;
|
||||
|
||||
using MonoTests.Helpers;
|
||||
|
||||
#if NET_4_0
|
||||
using System.Security.Authentication.ExtendedProtection;
|
||||
#endif
|
||||
|
||||
namespace MonoTests.System.ServiceModel.Channels
|
||||
{
|
||||
@@ -471,10 +468,8 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
http_binding_element.TransferMode = TransferMode.Streamed;
|
||||
http_binding_element.UnsafeConnectionNtlmAuthentication = !http_binding_element.UnsafeConnectionNtlmAuthentication;
|
||||
http_binding_element.UseDefaultWebProxy = !http_binding_element.UseDefaultWebProxy;
|
||||
#if NET_4_0
|
||||
http_binding_element.DecompressionEnabled = !http_binding_element.DecompressionEnabled;
|
||||
http_binding_element.ExtendedProtectionPolicy = new ExtendedProtectionPolicy (PolicyEnforcement.WhenSupported);
|
||||
#endif
|
||||
|
||||
//
|
||||
// Actual call to ExportPolicy
|
||||
|
@@ -107,11 +107,9 @@ namespace MonoTests.System.ServiceModel.Channels
|
||||
binding_element.TimeToLive = TimeSpan.FromSeconds (60);
|
||||
binding_element.UseMsmqTracing = !binding_element.UseMsmqTracing;
|
||||
binding_element.UseSourceJournal = !binding_element.UseSourceJournal;
|
||||
#if NET_4_0
|
||||
// This ones haven't been implemented yet, so comment them for now.
|
||||
//binding_element.ReceiveContextEnabled = !binding_element.ReceiveContextEnabled;
|
||||
//binding_element.ValidityDuration = TimeSpan.FromSeconds (30);
|
||||
#endif
|
||||
|
||||
binding_element.MsmqTransportSecurity.MsmqAuthenticationMode = MsmqAuthenticationMode.Certificate;
|
||||
binding_element.MsmqTransportSecurity.MsmqEncryptionAlgorithm = MsmqEncryptionAlgorithm.Aes;
|
||||
|
@@ -25,7 +25,6 @@
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#if NET_4_0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -52,4 +51,3 @@ namespace MonoTests.System.ServiceModel.Configuration
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -1009,5 +1009,82 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
[MyWebGet]
|
||||
string Get ();
|
||||
}
|
||||
|
||||
public interface IA1 : IB1, IB2
|
||||
{
|
||||
void MethodA1 ();
|
||||
}
|
||||
|
||||
public interface IA2 : IB1, IB2
|
||||
{
|
||||
void MethodA2 ();
|
||||
}
|
||||
|
||||
[ServiceContract]
|
||||
public interface IB1 : IC1, IC2
|
||||
{
|
||||
[OperationContract]
|
||||
void MethodB1 ();
|
||||
}
|
||||
|
||||
[ServiceContract]
|
||||
public interface IB2 : IC1, IC2
|
||||
{
|
||||
[OperationContract]
|
||||
void MethodB2 ();
|
||||
}
|
||||
|
||||
public interface IC1 {}
|
||||
public interface IC2 {}
|
||||
|
||||
[ServiceContract]
|
||||
public interface IS : IA1, IA2
|
||||
{
|
||||
[OperationContract]
|
||||
void MethodS() ;
|
||||
}
|
||||
|
||||
public class S : IS
|
||||
{
|
||||
#region IS implementation
|
||||
public void MethodS ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#endregion
|
||||
#region IA2 implementation
|
||||
public void MethodA2 ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#endregion
|
||||
#region IA1 implementation
|
||||
public void MethodA1 ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#endregion
|
||||
#region IB2 implementation
|
||||
public void MethodB2 ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#endregion
|
||||
#region IB1 implementation
|
||||
public void MethodB1 ()
|
||||
{
|
||||
throw new NotImplementedException ();
|
||||
}
|
||||
#endregion
|
||||
|
||||
}
|
||||
[Test]
|
||||
public void DualSpreadingInheritanceTest()
|
||||
{
|
||||
var cd = ContractDescription.GetContract (typeof(S));
|
||||
Assert.IsNotNull(cd);
|
||||
Assert.IsTrue (cd.Name == "IS");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@@ -38,21 +38,13 @@ using System.ServiceModel.Dispatcher;
|
||||
using System.Text;
|
||||
|
||||
using NUnit.Framework;
|
||||
using MonoTests.Helpers;
|
||||
|
||||
namespace MonoTests.System.ServiceModel.Description
|
||||
{
|
||||
[TestFixture]
|
||||
public class MetadataExchangeBindingsTest
|
||||
{
|
||||
Uri CreateUri (string uriString)
|
||||
{
|
||||
var uri = new Uri (uriString);
|
||||
var l = new TcpListener (uri.Port);
|
||||
l.Start ();
|
||||
l.Stop ();
|
||||
return uri;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void CreateMexHttpBinding ()
|
||||
{
|
||||
@@ -69,7 +61,7 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
Assert.AreEqual (MessageVersion.Soap12WSAddressing10, b.GetProperty<MessageVersion> (new BindingParameterCollection ()), "#6");
|
||||
|
||||
var host = new ServiceHost (typeof (MetadataExchange));
|
||||
host.AddServiceEndpoint (typeof (IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding (), CreateUri ("http://localhost:30158"));
|
||||
host.AddServiceEndpoint (typeof (IMetadataExchange), MetadataExchangeBindings.CreateMexHttpBinding (), "http://localhost:" + NetworkHelpers.FindFreePort ());
|
||||
host.Open ();
|
||||
try {
|
||||
// it still does not rewrite MessageVersion.None. It's rather likely ServiceMetadataExtension which does overwriting.
|
||||
@@ -96,7 +88,7 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
Assert.AreEqual(Uri.UriSchemeHttps, b.Scheme, "#8");
|
||||
|
||||
var host = new ServiceHost(typeof(MetadataExchange));
|
||||
host.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpsBinding(), CreateUri("https://localhost:30158"));
|
||||
host.AddServiceEndpoint(typeof(IMetadataExchange), MetadataExchangeBindings.CreateMexHttpsBinding(), "https://localhost:" + NetworkHelpers.FindFreePort ());
|
||||
host.Open();
|
||||
try
|
||||
{
|
||||
|
@@ -57,18 +57,9 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
}
|
||||
}
|
||||
|
||||
Uri CreateUri (string uriString)
|
||||
{
|
||||
var uri = new Uri (uriString);
|
||||
var l = new TcpListener (uri.Port);
|
||||
l.Start ();
|
||||
l.Stop ();
|
||||
return uri;
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void InitializeRuntime1 () {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:" + NetworkHelpers.FindFreePort ()))) {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()))) {
|
||||
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "e1");
|
||||
|
||||
Assert.AreEqual (0, host.ChannelDispatchers.Count, "ChannelDispatchers.Count #1");
|
||||
@@ -105,7 +96,7 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
|
||||
[Test]
|
||||
public void InitializeRuntime2 () {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:" + NetworkHelpers.FindFreePort ()))) {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()))) {
|
||||
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
|
||||
host.Description.Behaviors.Remove<ServiceDebugBehavior> ();
|
||||
|
||||
@@ -124,7 +115,7 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
|
||||
[Test]
|
||||
public void InitializeRuntime3 () {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:" + NetworkHelpers.FindFreePort ()))) {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:" + NetworkHelpers.FindFreePort ()))) {
|
||||
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
|
||||
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageEnabled = false;
|
||||
|
||||
@@ -143,7 +134,7 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
[Test]
|
||||
public void InitializeRuntime4 () {
|
||||
int port = NetworkHelpers.FindFreePort ();
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:" + port))) {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:" + port))) {
|
||||
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
|
||||
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:" + port + "/help");
|
||||
|
||||
@@ -190,7 +181,7 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
[Test]
|
||||
public void ServiceMetadataExtension1 () {
|
||||
int port = NetworkHelpers.FindFreePort ();
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:" + port))) {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:" + port))) {
|
||||
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
|
||||
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:" + port + "/help");
|
||||
try {
|
||||
@@ -207,9 +198,9 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
[Test]
|
||||
public void ServiceMetadataExtension2 () {
|
||||
int port = NetworkHelpers.FindFreePort ();
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), CreateUri ("http://localhost:" + port))) {
|
||||
using (ServiceHost host = new ServiceHost (typeof (MyService), new Uri ("http://localhost:" + port))) {
|
||||
host.AddServiceEndpoint (typeof (IMyContract), new BasicHttpBinding (), "");
|
||||
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = CreateUri ("http://localhost:" + port + "/help");
|
||||
host.Description.Behaviors.Find<ServiceDebugBehavior> ().HttpHelpPageUrl = new Uri ("http://localhost:" + port + "/help");
|
||||
|
||||
ServiceMetadataExtension extension = new ServiceMetadataExtension ();
|
||||
host.Extensions.Add (extension);
|
||||
|
@@ -25,7 +25,6 @@
|
||||
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
||||
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
//
|
||||
#if NET_4_0
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -54,4 +53,3 @@ namespace MonoTests.System.ServiceModel.Description
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@@ -23,6 +23,7 @@
|
||||
// THE SOFTWARE.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Runtime.Serialization;
|
||||
using System.ServiceModel;
|
||||
@@ -62,16 +63,24 @@ namespace MonoTests.System.ServiceModel.Dispatcher
|
||||
var client = new TempConvertSoapClient (binding, remoteAddress);
|
||||
|
||||
var wait = new ManualResetEvent (false);
|
||||
|
||||
Exception error = null;
|
||||
string result = null;
|
||||
|
||||
client.CelsiusToFahrenheitCompleted += delegate (object o, CelsiusToFahrenheitCompletedEventArgs e) {
|
||||
if (e.Error != null)
|
||||
throw e.Error;
|
||||
Assert.AreEqual ("76.1", e.Result, "#1");
|
||||
wait.Set ();
|
||||
try {
|
||||
error = e.Error;
|
||||
result = e.Error == null ? e.Result : null;
|
||||
} finally {
|
||||
wait.Set ();
|
||||
}
|
||||
};
|
||||
|
||||
client.CelsiusToFahrenheitAsync ("24.5");
|
||||
if (!wait.WaitOne (TimeSpan.FromSeconds (20)))
|
||||
Assert.Fail ("timeout");
|
||||
|
||||
Assert.IsTrue (wait.WaitOne (TimeSpan.FromSeconds (20)), "timeout");
|
||||
Assert.IsNull (error, "#1, inner exception: {0}", error);
|
||||
Assert.AreEqual ("76.1", result, "#2");
|
||||
} finally {
|
||||
serviceHost.Close ();
|
||||
}
|
||||
@@ -81,16 +90,16 @@ namespace MonoTests.System.ServiceModel.Dispatcher
|
||||
{
|
||||
public FahrenheitToCelsiusResponse FarenheitToCelsius (FahrenheitToCelsiusRequest request)
|
||||
{
|
||||
var farenheit = double.Parse (request.Body.Fahrenheit);
|
||||
var farenheit = double.Parse (request.Body.Fahrenheit, CultureInfo.InvariantCulture);
|
||||
var celsius = ((farenheit - 32) / 9) * 5;
|
||||
return new FahrenheitToCelsiusResponse (new FahrenheitToCelsiusResponseBody (celsius.ToString ()));
|
||||
return new FahrenheitToCelsiusResponse (new FahrenheitToCelsiusResponseBody (celsius.ToString (CultureInfo.InvariantCulture)));
|
||||
}
|
||||
|
||||
public CelsiusToFahrenheitResponse CelsiusToFarenheit (CelsiusToFahrenheitRequest request)
|
||||
{
|
||||
var celsius = double.Parse (request.Body.Celsius);
|
||||
var celsius = double.Parse (request.Body.Celsius, CultureInfo.InvariantCulture);
|
||||
var farenheit = ((celsius * 9) / 5) + 32;
|
||||
return new CelsiusToFahrenheitResponse (new CelsiusToFahrenheitResponseBody (farenheit.ToString ()));
|
||||
return new CelsiusToFahrenheitResponse (new CelsiusToFahrenheitResponseBody (farenheit.ToString (CultureInfo.InvariantCulture)));
|
||||
}
|
||||
|
||||
Func<FahrenheitToCelsiusRequest,FahrenheitToCelsiusResponse> farenheitToCelsius;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user