state: socket);
}
- public static Task ConnectAsync(this Socket socket, EndPoint remoteEndPoint)
+ public static Task ConnectAsync(this Socket socket, EndPoint remoteEP)
{
return Task.Factory.FromAsync(
(targetEndPoint, callback, state) => ((Socket)state).BeginConnect(targetEndPoint, callback, state),
asyncResult => ((Socket)asyncResult.AsyncState).EndConnect(asyncResult),
- remoteEndPoint,
+ remoteEP,
state: socket);
}
this Socket socket,
ArraySegment<byte> buffer,
SocketFlags socketFlags,
- EndPoint remoteEndPoint)
+ EndPoint remoteEP)
{
return Task<int>.Factory.FromAsync(
(targetBuffer, flags, endPoint, callback, state) => ((Socket)state).BeginSendTo(
asyncResult => ((Socket)asyncResult.AsyncState).EndSendTo(asyncResult),
buffer,
socketFlags,
- remoteEndPoint,
+ remoteEP,
state: socket);
}
}
ProjectRootElement.Create (XmlReader.Create (new StringReader (" <root/>")));
Assert.Fail ("should throw InvalidProjectFileException");
} catch (InvalidProjectFileException ex) {
- #if NET_4_5
Assert.AreEqual (1, ex.LineNumber, "#1");
// it is very interesting, but unlike XmlReader.LinePosition it returns the position for '<'.
Assert.AreEqual (2, ex.ColumnNumber, "#2");
- #endif
}
}
ProjectRootElement.Create (xml);
Assert.Fail ("should throw InvalidProjectFileException");
} catch (InvalidProjectFileException ex) {
- #if NET_4_5
Assert.AreEqual (1, ex.LineNumber, "#1");
// unlike unexpected element case which returned the position for '<', it does return the name start char...
Assert.AreEqual (70, ex.ColumnNumber, "#2");
- #endif
}
}
{
var g = ProjectCollection.GlobalProjectCollection;
Assert.AreEqual (0, g.GlobalProperties.Count, "#1");
- #if NET_4_5
Assert.IsTrue (g.GlobalProperties.IsReadOnly, "#2");
- #endif
}
[Test]
var ts = new Toolset ("4.3", "c:\\", ProjectCollection.GlobalProjectCollection, null);
Assert.IsNotNull (ts.Properties, "#1");
Assert.AreEqual (0, ts.Properties.Count, "#2");
-#if NET_4_5
Assert.IsNull (ts.DefaultSubToolsetVersion, "#3");
Assert.IsNotNull (ts.SubToolsets, "#4");
Assert.AreEqual (0, ts.SubToolsets.Count, "#5");
-#endif
Assert.AreEqual ("c:\\", ts.ToolsPath, "#6");
Assert.AreEqual ("4.3", ts.ToolsVersion, "#7");
}
var root = ProjectRootElement.Create (xml);
root.FullPath = "ProjectInstanceTest.DependsOnTargets.proj";
var proj = new ProjectInstance (root);
-#if NET_4_5
Assert.AreEqual (2, proj.Targets.Count, "#1");
-#endif
Assert.IsFalse (proj.Build ("Bar", new ILogger [0]), "#2");
}
[TestFixture]
public class ProjectTaskInstanceTest
{
-#if NET_4_5
[Test]
public void OutputPropertyExists ()
{
Assert.AreEqual (string.Empty, foo.Outputs, "#6");
Assert.AreEqual ("True", proj.GetPropertyValue ("C"), "#7");
}
-#endif
}
}
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
-#if NET_4_5
[StateMachine (typeof (int))]
-#endif
public static void locals2<T> (string[] args, int arg, T t, ref string rs, ref AStruct astruct) {
long i = 42;
string s = "AB";
[MethodImplAttribute (MethodImplOptions.NoInlining)]
public static void unhandled_exception_user () {
-#if NET_4_5
System.Threading.Tasks.Task.Factory.StartNew (() => {
Throw ();
});
Thread.Sleep (10000);
-#endif
}
[MethodImplAttribute (MethodImplOptions.NoInlining)]
Assert.AreEqual ("Exception", ex.Exception.Type.Name);
}
-#if NET_4_5
// out argument
m = t.GetMethod ("invoke_out");
var out_task = this_obj.InvokeMethodAsyncWithResult (e.Thread, m, new Value [] { vm.CreateValue (1), vm.CreateValue (null) }, InvokeOptions.ReturnOutArgs);
out_task = this_obj.InvokeMethodAsyncWithResult (e.Thread, m, new Value [] { vm.CreateValue (1), vm.CreateValue (null) });
out_args = out_task.Result.OutArgs;
Assert.IsNull (out_args);
-#endif
// newobj
m = t.GetMethod (".ctor");
v = t.InvokeMethod (e.Thread, m, new Value [] { vm.RootDomain.CreateString ("ABC") }, InvokeOptions.Virtual);
AssertValue ("ABC", v);
-#if NET_4_5
// instance
m = t.GetMethod ("invoke_pass_ref");
var task = this_obj.InvokeMethodAsync (e.Thread, m, new Value [] { vm.RootDomain.CreateString ("ABC") });
m = t.GetMethod ("invoke_static_pass_ref");
task = t.InvokeMethodAsync (e.Thread, m, new Value [] { vm.RootDomain.CreateString ("ABC") });
AssertValue ("ABC", task.Result);
-#endif
// Argument checking
v = t.InvokeMethod (e.Thread, m, new Value [] { vm.CreateValue (1) });
AssertValue (1, (v as StructMirror)["i"]);
-#if NET_4_5
// Invoke a method which changes state
s = frame.GetArgument (1) as StructMirror;
t = s.Type;
m = vm.RootDomain.Corlib.GetType ("System.Object").GetMethod ("ToString");
v = s.InvokeMethod (e.Thread, m, null, InvokeOptions.Virtual);
AssertValue ("42", v);
-#endif
}
[Test]
vm = null;
}
-#if NET_4_5
[Test]
public void UnhandledExceptionUserCode () {
vm.Detach ();
vm.Exit (0);
vm = null;
}
-#endif
[Test]
public void GCWhileSuspended () {
namespace MonoTests.System.ComponentModel.DataAnnotations
{
-#if NET_4_5
[TestFixture]
public class CompareAttributeTest
{
Assert.IsNotNull (sla.GetValidationResult (DateTime.Now, ctx), "#B-4");
}
}
-#endif
}
namespace MonoTests.System.ComponentModel.DataAnnotations
{
-#if NET_4_5
[TestFixture]
public class CreditCardAttributeTest
{
Assert.IsFalse (sla.IsValid (DateTime.Now), "#A1-8");
}
}
-#endif
}
namespace MonoTests.System.ComponentModel.DataAnnotations
{
-#if NET_4_5
[TestFixture]
public class EmailAddressAttributeTest
{
Assert.IsFalse (sla.IsValid (InvalidAddresses[i]), "#B1-{0}", i);
}
}
-#endif
}
namespace MonoTests.System.ComponentModel.DataAnnotations
{
-#if NET_4_5
[TestFixture]
public class FileExtensionsAttributeTest
{
Assert.IsFalse (sla.IsValid (DateTime.Now), "#A1-8");
}
}
-#endif
}
namespace MonoTests.System.ComponentModel.DataAnnotations
{
-#if NET_4_5
[TestFixture]
public class PhoneAttributeTest
{
Assert.IsFalse (sla.IsValid (DateTime.Now), "#A1-7");
}
}
-#endif
}
using System;
using System.IO;
using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
using System.Collections;
using System.ComponentModel;
using System.Data;
throw new NotImplementedException ();
}
+ override public Task<T> GetFieldValueAsync<T> (int i, CancellationToken cancellationToken)
+ {
+ return base.GetFieldValueAsync<T> (i, cancellationToken);
+ }
+
+ override public Stream GetStream (int i)
+ {
+ return base.GetStream (i);
+ }
+ override public TextReader GetTextReader (int i)
+ {
+ return base.GetTextReader (i);
+ }
+
+ override public Task<bool> IsDBNullAsync (int i, CancellationToken cancellationToken)
+ {
+ return base.IsDBNullAsync (i, cancellationToken);
+ }
+
#endregion // Methods
}
}
{
}
- #if NET_4_5
[Test]
public void GetFieldValueTest ()
{
Assert.IsFalse (dataReader.Read (), "#5");
}
- #endif //NET_4_5
}
}
// BootstrapContextTest.cs - NUnit Test Cases for System.IdentityModel.Tokens.BootstrapContext
//
-#if NET_4_5
using System;
using System.IO;
using System.IdentityModel.Tokens;
}
}
}
-#endif
_params = new byte [0];
}
- public AlgorithmIdentifier (Oid algorithm)
+ public AlgorithmIdentifier (Oid oid)
{
- _oid = algorithm;
+ _oid = oid;
_params = new byte [0];
}
- public AlgorithmIdentifier (Oid algorithm, int keyLength)
+ public AlgorithmIdentifier (Oid oid, int keyLength)
{
- _oid = algorithm;
+ _oid = oid;
_length = keyLength;
_params = new byte [0];
}
{
}
- public ContentInfo (Oid oid, byte[] content)
+ public ContentInfo (Oid contentType, byte[] content)
{
- if (oid == null)
- throw new ArgumentNullException ("oid");
+ if (contentType == null)
+ throw new ArgumentNullException ("contentType");
if (content == null)
throw new ArgumentNullException ("content");
- _oid = oid;
+ _oid = contentType;
_content = content;
}
_uattribs = new CryptographicAttributeObjectCollection ();
}
- public EnvelopedCms (ContentInfo content) : this ()
+ public EnvelopedCms (ContentInfo contentInfo) : this ()
{
- if (content == null)
- throw new ArgumentNullException ("content");
+ if (contentInfo == null)
+ throw new ArgumentNullException ("contentInfo");
- _content = content;
+ _content = contentInfo;
}
public EnvelopedCms (ContentInfo contentInfo, AlgorithmIdentifier encryptionAlgorithm)
return new DefaultAddressHeader (value);
}
- public static AddressHeader CreateAddressHeader (object value, XmlObjectSerializer formatter)
+ public static AddressHeader CreateAddressHeader (object value, XmlObjectSerializer serializer)
{
- return new DefaultAddressHeader (value, formatter);
+ return new DefaultAddressHeader (value, serializer);
}
public static AddressHeader CreateAddressHeader (string name, string ns, object value)
}
public static AddressHeader CreateAddressHeader (string name, string ns, object value,
- XmlObjectSerializer formatter)
+ XmlObjectSerializer serializer)
{
- if (formatter == null)
- throw new ArgumentNullException ("formatter");
- return new DefaultAddressHeader (name, ns, value, formatter);
+ if (serializer == null)
+ throw new ArgumentNullException ("serializer");
+ return new DefaultAddressHeader (name, ns, value, serializer);
}
public override bool Equals (object obj)
return GetValue<T> (new DataContractSerializer (typeof (T)));
}
- public T GetValue<T> (XmlObjectSerializer formatter)
+ public T GetValue<T> (XmlObjectSerializer serializer)
{
- return (T) formatter.ReadObject (GetAddressHeaderReader ());
+ return (T) serializer.ReadObject (GetAddressHeaderReader ());
}
protected abstract void OnWriteAddressHeaderContents (XmlDictionaryWriter writer);
{
}
- public AddressHeaderCollection (IEnumerable<AddressHeader> headers)
- : base (GetList (headers))
+ public AddressHeaderCollection (IEnumerable<AddressHeader> addressHeaders)
+ : base (GetList (addressHeaders))
{
}
BindingElementCollection elements; // for internal use
public BindingContext (CustomBinding binding,
- BindingParameterCollection parms)
+ BindingParameterCollection parameters)
{
if (binding == null)
throw new ArgumentNullException ("binding");
- if (parms == null)
- throw new ArgumentNullException ("parms");
+ if (parameters == null)
+ throw new ArgumentNullException ("parameters");
this.binding = binding;
- parameters = new BindingParameterCollection ();
- foreach (var item in parms)
- parameters.Add (item);
+ this.parameters = new BindingParameterCollection ();
+ foreach (var item in parameters)
+ this.parameters.Add (item);
this.elements = new BindingElementCollection ();
foreach (var item in binding.Elements)
this.elements.Add (item);
}
[MonoTODO]
- protected BindingElement (BindingElement other)
+ protected BindingElement (BindingElement elementToBeCloned)
{
}
{
}
- public BindingElementCollection (BindingElement [] bindings)
+ public BindingElementCollection (BindingElement [] elements)
{
- AddRange (bindings);
+ AddRange (elements);
}
- public BindingElementCollection (IEnumerable<BindingElement> bindings)
+ public BindingElementCollection (IEnumerable<BindingElement> elements)
{
- foreach (BindingElement e in bindings)
+ foreach (BindingElement e in elements)
Add (e);
}
{
ChannelManagerBase manager;
- protected ChannelBase (ChannelManagerBase manager)
+ protected ChannelBase (ChannelManagerBase channelManager)
{
- this.manager = manager;
+ this.manager = channelManager;
}
protected internal override TimeSpan DefaultCloseTimeout {
}
public TChannel CreateChannel (
- EndpointAddress remoteAddress)
+ EndpointAddress address)
{
- if (remoteAddress == null)
- throw new ArgumentNullException ("remoteAddress");
- return CreateChannel (remoteAddress, remoteAddress.Uri);
+ if (address == null)
+ throw new ArgumentNullException ("address");
+ return CreateChannel (address, address.Uri);
}
public TChannel CreateChannel (
- EndpointAddress remoteAddress, Uri via)
+ EndpointAddress address, Uri via)
{
- if (remoteAddress == null)
- throw new ArgumentNullException ("remoteAddress");
+ if (address == null)
+ throw new ArgumentNullException ("address");
if (via == null)
throw new ArgumentNullException ("via");
ValidateCreateChannel ();
- var ch = OnCreateChannel (remoteAddress, via);
+ var ch = OnCreateChannel (address, via);
channels.Add (ch);
return ch;
}
protected abstract TChannel OnCreateChannel (
- EndpointAddress remoteAddress, Uri via);
+ EndpointAddress address, Uri via);
protected override void OnAbort ()
{
security = binding as ISecurityCapabilities;
}
- public CustomBinding (params BindingElement [] binding)
- : this ("CustomBinding", default_ns, binding)
+ public CustomBinding (params BindingElement [] bindingElementsInTopDownChannelStackOrder)
+ : this ("CustomBinding", default_ns, bindingElementsInTopDownChannelStackOrder)
{
}
- public CustomBinding (IEnumerable<BindingElement> bindingElements)
- : this (bindingElements, "CustomBinding", default_ns)
+ public CustomBinding (IEnumerable<BindingElement> bindingElementsInTopDownChannelStackOrder)
+ : this (bindingElementsInTopDownChannelStackOrder, "CustomBinding", default_ns)
{
}
public CustomBinding (string name, string ns,
- params BindingElement [] binding)
- : this (binding, name, ns)
+ params BindingElement [] bindingElementsInTopDownChannelStackOrder)
+ : this (bindingElementsInTopDownChannelStackOrder, name, ns)
{
}
[MonoTODO]
protected abstract bool OnTryCreateException (
- Message message, MessageFault fault, out Exception error);
+ Message message, MessageFault fault, out Exception exception);
[MonoTODO]
protected abstract bool OnTryCreateFaultMessage (
- Exception error, out Message message);
+ Exception exception, out Message message);
- public bool TryCreateException (Message message, MessageFault fault, out Exception error)
+ public bool TryCreateException (Message message, MessageFault fault, out Exception exception)
{
- return OnTryCreateException (message, fault, out error);
+ return OnTryCreateException (message, fault, out exception);
}
- public bool TryCreateFaultMessage (Exception error, out Message message)
+ public bool TryCreateFaultMessage (Exception exception, out Message message)
{
- return OnTryCreateFaultMessage (error, out message);
+ return OnTryCreateFaultMessage (exception, out message);
}
}
}
protected HttpTransportBindingElement (
- HttpTransportBindingElement other)
- : base (other)
+ HttpTransportBindingElement elementToBeCloned)
+ : base (elementToBeCloned)
{
- allow_cookies = other.allow_cookies;
- bypass_proxy_on_local = other.bypass_proxy_on_local;
- unsafe_ntlm_auth = other.unsafe_ntlm_auth;
- use_default_proxy = other.use_default_proxy;
- keep_alive_enabled = other.keep_alive_enabled;
- max_buffer_size = other.max_buffer_size;
- host_cmp_mode = other.host_cmp_mode;
- proxy_address = other.proxy_address;
- realm = other.realm;
- transfer_mode = other.transfer_mode;
+ allow_cookies = elementToBeCloned.allow_cookies;
+ bypass_proxy_on_local = elementToBeCloned.bypass_proxy_on_local;
+ unsafe_ntlm_auth = elementToBeCloned.unsafe_ntlm_auth;
+ use_default_proxy = elementToBeCloned.use_default_proxy;
+ keep_alive_enabled = elementToBeCloned.keep_alive_enabled;
+ max_buffer_size = elementToBeCloned.max_buffer_size;
+ host_cmp_mode = elementToBeCloned.host_cmp_mode;
+ proxy_address = elementToBeCloned.proxy_address;
+ realm = elementToBeCloned.realm;
+ transfer_mode = elementToBeCloned.transfer_mode;
// FIXME: it does not look safe
- timeouts = other.timeouts;
- auth_scheme = other.auth_scheme;
- proxy_auth_scheme = other.proxy_auth_scheme;
-
- DecompressionEnabled = other.DecompressionEnabled;
- LegacyExtendedProtectionPolicy = other.LegacyExtendedProtectionPolicy;
- ExtendedProtectionPolicy = other.ExtendedProtectionPolicy;
- cookie_manager = other.cookie_manager;
+ timeouts = elementToBeCloned.timeouts;
+ auth_scheme = elementToBeCloned.auth_scheme;
+ proxy_auth_scheme = elementToBeCloned.proxy_auth_scheme;
+
+ DecompressionEnabled = elementToBeCloned.DecompressionEnabled;
+ LegacyExtendedProtectionPolicy = elementToBeCloned.LegacyExtendedProtectionPolicy;
+ ExtendedProtectionPolicy = elementToBeCloned.ExtendedProtectionPolicy;
+ cookie_manager = elementToBeCloned.cookie_manager;
}
[DefaultValue (AuthenticationSchemes.Anonymous)]
}
protected HttpsTransportBindingElement (
- HttpsTransportBindingElement other)
- : base (other)
+ HttpsTransportBindingElement elementToBeCloned)
+ : base (elementToBeCloned)
{
- req_cli_cert = other.req_cli_cert;
+ req_cli_cert = elementToBeCloned.req_cli_cert;
}
public bool RequireClientCertificate {
return OnGetBody<T> (GetReaderAtBodyContents ());
}
- public T GetBody<T> (XmlObjectSerializer xmlFormatter)
+ public T GetBody<T> (XmlObjectSerializer serializer)
{
// FIXME: Somehow use OnGetBody() here as well?
- return (T)xmlFormatter.ReadObject (GetReaderAtBodyContents ());
+ return (T)serializer.ReadObject (GetReaderAtBodyContents ());
}
protected virtual T OnGetBody<T> (XmlDictionaryReader reader)
// 5)
public static Message CreateMessage (MessageVersion version,
- string action, object body, XmlObjectSerializer xmlFormatter)
+ string action, object body, XmlObjectSerializer serializer)
{
return body == null ?
CreateMessage (version, action) :
CreateMessage (
version, action,
- new XmlObjectSerializerBodyWriter (body, xmlFormatter));
+ new XmlObjectSerializerBodyWriter (body, serializer));
}
// 6)
[MonoTODO]
public
- MessageEncodingBindingElement (MessageEncodingBindingElement source)
+ MessageEncodingBindingElement (MessageEncodingBindingElement elementToBeCloned)
{
- MessageVersion = source.MessageVersion;
+ MessageVersion = elementToBeCloned.MessageVersion;
}
public abstract MessageEncoderFactory
public abstract MessageVersion MessageVersion { get; set; }
- public override T GetProperty<T> (BindingContext ctx)
+ public override T GetProperty<T> (BindingContext context)
{
if (typeof (T) == typeof (MessageVersion))
return (T) (object) MessageVersion;
- return ctx.GetInnerProperty<T> ();
+ return context.GetInnerProperty<T> ();
}
#if !MOBILE && !XAMMAC_4_5
return GetDetail<T> (new DataContractSerializer (typeof (T)));
}
- public T GetDetail<T> (XmlObjectSerializer formatter)
+ public T GetDetail<T> (XmlObjectSerializer serializer)
{
if (!HasDetail)
throw new InvalidOperationException ("This message does not have details.");
- return (T) formatter.ReadObject (GetReaderAtDetailContents ());
+ return (T) serializer.ReadObject (GetReaderAtDetailContents ());
}
public XmlDictionaryReader GetReaderAtDetailContents ()
return CreateHeader (name, ns, value, default_must_understand);
}
- public static MessageHeader CreateHeader (string name, string ns, object value, bool must_understand)
+ public static MessageHeader CreateHeader (string name, string ns, object value, bool mustUnderstand)
{
- return CreateHeader (name, ns, value, must_understand, default_actor);
+ return CreateHeader (name, ns, value, mustUnderstand, default_actor);
}
- public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer formatter)
+ public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer serializer)
{
- return CreateHeader (name, ns, value, formatter, default_must_understand,
+ return CreateHeader (name, ns, value, serializer, default_must_understand,
default_actor, default_relay);
}
public static MessageHeader CreateHeader (string name, string ns, object value,
- bool must_understand, string actor)
+ bool mustUnderstand, string actor)
{
- return CreateHeader (name, ns, value, must_understand, actor, default_relay);
+ return CreateHeader (name, ns, value, mustUnderstand, actor, default_relay);
}
- public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer formatter,
- bool must_understand)
+ public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer serializer,
+ bool mustUnderstand)
{
- return CreateHeader (name, ns, value, formatter, must_understand, default_actor, default_relay);
+ return CreateHeader (name, ns, value, serializer, mustUnderstand, default_actor, default_relay);
}
public static MessageHeader CreateHeader (string name, string ns, object value,
- bool must_understand, string actor, bool relay)
+ bool mustUnderstand, string actor, bool relay)
{
return CreateHeader (name, ns, value, new DataContractSerializer (value.GetType ()),
- must_understand, actor, relay);
+ mustUnderstand, actor, relay);
}
- public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer formatter,
- bool must_understand, string actor)
+ public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer serializer,
+ bool mustUnderstand, string actor)
{
- return CreateHeader (name, ns, value, formatter, must_understand, actor, default_relay);
+ return CreateHeader (name, ns, value, serializer, mustUnderstand, actor, default_relay);
}
- public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer formatter,
- bool must_understand, string actor, bool relay)
+ public static MessageHeader CreateHeader (string name, string ns, object value, XmlObjectSerializer serializer,
+ bool mustUnderstand, string actor, bool relay)
{
// FIXME: how to get IsReferenceParameter ?
- return new DefaultMessageHeader (name, ns, value, formatter, default_is_ref, must_understand, actor, relay);
+ return new DefaultMessageHeader (name, ns, value, serializer, default_is_ref, mustUnderstand, actor, relay);
}
- public virtual bool IsMessageVersionSupported (MessageVersion version)
+ public virtual bool IsMessageVersionSupported (MessageVersion messageVersion)
{
- if (version.Envelope == EnvelopeVersion.Soap12)
+ if (messageVersion.Envelope == EnvelopeVersion.Soap12)
if (Actor == EnvelopeVersion.Soap11.NextDestinationActorValue)
return false;
- if (version.Envelope == EnvelopeVersion.Soap11)
+ if (messageVersion.Envelope == EnvelopeVersion.Soap11)
if (Actor == EnvelopeVersion.Soap12.NextDestinationActorValue ||
Actor == EnvelopeVersion.Soap12UltimateReceiver)
return false;
return true;
}
- protected abstract void OnWriteHeaderContents (XmlDictionaryWriter writer, MessageVersion version);
+ protected abstract void OnWriteHeaderContents (XmlDictionaryWriter writer, MessageVersion messageVersion);
- protected virtual void OnWriteStartHeader (XmlDictionaryWriter writer, MessageVersion version)
+ protected virtual void OnWriteStartHeader (XmlDictionaryWriter writer, MessageVersion messageVersion)
{
var dic = Constants.SoapDictionary;
XmlDictionaryString name, ns;
writer.WriteStartElement (prefix, name, ns);
else
writer.WriteStartElement (prefix, this.Name, this.Namespace);
- WriteHeaderAttributes (writer, version);
+ WriteHeaderAttributes (writer, messageVersion);
}
public override string ToString ()
return sb.ToString ();
}
- public void WriteHeader (XmlDictionaryWriter writer, MessageVersion version)
+ public void WriteHeader (XmlDictionaryWriter writer, MessageVersion messageVersion)
{
if (writer == null)
throw new ArgumentNullException ("writer is null.");
- if (version == null)
- throw new ArgumentNullException ("version is null.");
+ if (messageVersion == null)
+ throw new ArgumentNullException ("messageVersion is null.");
- if (version.Envelope == EnvelopeVersion.None)
+ if (messageVersion.Envelope == EnvelopeVersion.None)
return;
- WriteStartHeader (writer, version);
- WriteHeaderContents (writer, version);
+ WriteStartHeader (writer, messageVersion);
+ WriteHeaderContents (writer, messageVersion);
writer.WriteEndElement ();
}
- public void WriteHeader (XmlWriter writer, MessageVersion version)
+ public void WriteHeader (XmlWriter writer, MessageVersion messageVersion)
{
- WriteHeader (XmlDictionaryWriter.CreateDictionaryWriter (writer), version);
+ WriteHeader (XmlDictionaryWriter.CreateDictionaryWriter (writer), messageVersion);
}
- protected void WriteHeaderAttributes (XmlDictionaryWriter writer, MessageVersion version)
+ protected void WriteHeaderAttributes (XmlDictionaryWriter writer, MessageVersion messageVersion)
{
var dic = Constants.SoapDictionary;
if (Id != null)
writer.WriteAttributeString ("u", dic.Add ("Id"), dic.Add (Constants.WsuNamespace), Id);
if (!String.IsNullOrEmpty (Actor)) {
- if (version.Envelope == EnvelopeVersion.Soap11)
- writer.WriteAttributeString ("s", dic.Add ("actor"), dic.Add (version.Envelope.Namespace), Actor);
+ if (messageVersion.Envelope == EnvelopeVersion.Soap11)
+ writer.WriteAttributeString ("s", dic.Add ("actor"), dic.Add (messageVersion.Envelope.Namespace), Actor);
- if (version.Envelope == EnvelopeVersion.Soap12)
- writer.WriteAttributeString ("s", dic.Add ("role"), dic.Add (version.Envelope.Namespace), Actor);
+ if (messageVersion.Envelope == EnvelopeVersion.Soap12)
+ writer.WriteAttributeString ("s", dic.Add ("role"), dic.Add (messageVersion.Envelope.Namespace), Actor);
}
// mustUnderstand is the same across SOAP 1.1 and 1.2
if (MustUnderstand == true)
- writer.WriteAttributeString ("s", dic.Add ("mustUnderstand"), dic.Add (version.Envelope.Namespace), "1");
+ writer.WriteAttributeString ("s", dic.Add ("mustUnderstand"), dic.Add (messageVersion.Envelope.Namespace), "1");
// relay is only available on SOAP 1.2
- if (Relay == true && version.Envelope == EnvelopeVersion.Soap12)
- writer.WriteAttributeString ("s", dic.Add ("relay"), dic.Add (version.Envelope.Namespace), "true");
+ if (Relay == true && messageVersion.Envelope == EnvelopeVersion.Soap12)
+ writer.WriteAttributeString ("s", dic.Add ("relay"), dic.Add (messageVersion.Envelope.Namespace), "true");
}
- public void WriteHeaderContents (XmlDictionaryWriter writer, MessageVersion version)
+ public void WriteHeaderContents (XmlDictionaryWriter writer, MessageVersion messageVersion)
{
- this.OnWriteHeaderContents (writer, version);
+ this.OnWriteHeaderContents (writer, messageVersion);
}
- public void WriteStartHeader (XmlDictionaryWriter writer, MessageVersion version)
+ public void WriteStartHeader (XmlDictionaryWriter writer, MessageVersion messageVersion)
{
- this.OnWriteStartHeader (writer, version);
+ this.OnWriteStartHeader (writer, messageVersion);
}
public override string Actor { get { return default_actor; }}
l.Add (header);
}
- public void CopyHeaderFrom (Message m, int index)
+ public void CopyHeaderFrom (Message message, int headerIndex)
{
- CopyHeaderFrom (m.Headers, index);
+ CopyHeaderFrom (message.Headers, headerIndex);
}
public void Clear ()
l.Clear ();
}
- public void CopyHeaderFrom (MessageHeaders headers, int index)
+ public void CopyHeaderFrom (MessageHeaders collection, int headerIndex)
{
- l.Add (headers [index]);
+ l.Add (collection [headerIndex]);
}
- public void CopyHeadersFrom (Message m)
+ public void CopyHeadersFrom (Message message)
{
- CopyHeadersFrom (m.Headers);
+ CopyHeadersFrom (message.Headers);
}
- public void CopyHeadersFrom (MessageHeaders headers)
+ public void CopyHeadersFrom (MessageHeaders collection)
{
- foreach (MessageHeaderInfo h in headers)
+ foreach (MessageHeaderInfo h in collection)
l.Add (h);
}
- public void CopyTo (MessageHeaderInfo [] dst, int index)
+ public void CopyTo (MessageHeaderInfo [] array, int index)
{
- l.CopyTo (dst, index);
+ l.CopyTo (array, index);
}
public int FindHeader (string name, string ns)
return GetHeader<T> (idx, serializer);
}
- public XmlDictionaryReader GetReaderAtHeader (int index)
+ public XmlDictionaryReader GetReaderAtHeader (int headerIndex)
{
- if (index >= l.Count)
- throw new ArgumentOutOfRangeException (String.Format ("Index is out of range. Current header count is {0}", index));
- MessageHeader item = (MessageHeader) l [index];
+ if (headerIndex >= l.Count)
+ throw new ArgumentOutOfRangeException (String.Format ("Index is out of range. Current header count is {0}", l.Count));
+ MessageHeader item = (MessageHeader) l [headerIndex];
XmlReader reader =
item is MessageHeader.XmlMessageHeader ?
throw new NotImplementedException ();
}
- public void Insert (int index, MessageHeader header)
+ public void Insert (int headerIndex, MessageHeader header)
{
- l.Insert (index, header);
+ l.Insert (headerIndex, header);
}
public void RemoveAll (string name, string ns)
l.RemoveAt (l.Count - 1);
}
- public void RemoveAt (int index)
+ public void RemoveAt (int headerIndex)
{
- l.RemoveAt (index);
+ l.RemoveAt (headerIndex);
}
IEnumerator IEnumerable.GetEnumerator ()
return ((IEnumerable) l).GetEnumerator ();
}
- public void WriteHeader (int index, XmlDictionaryWriter writer)
+ public void WriteHeader (int headerIndex, XmlDictionaryWriter writer)
{
if (version.Envelope == EnvelopeVersion.None)
return;
- WriteStartHeader (index, writer);
- WriteHeaderContents (index, writer);
+ WriteStartHeader (headerIndex, writer);
+ WriteHeaderContents (headerIndex, writer);
writer.WriteEndElement ();
}
- public void WriteHeader (int index, XmlWriter writer)
+ public void WriteHeader (int headerIndex, XmlWriter writer)
{
- WriteHeader (index, XmlDictionaryWriter.CreateDictionaryWriter (writer));
+ WriteHeader (headerIndex, XmlDictionaryWriter.CreateDictionaryWriter (writer));
}
- public void WriteHeaderContents (int index, XmlDictionaryWriter writer)
+ public void WriteHeaderContents (int headerIndex, XmlDictionaryWriter writer)
{
- if (index > l.Count)
- throw new ArgumentOutOfRangeException ("There is no header at position " + index + ".");
+ if (headerIndex > l.Count)
+ throw new ArgumentOutOfRangeException ("There is no header at position " + headerIndex + ".");
- MessageHeader h = l [index] as MessageHeader;
+ MessageHeader h = l [headerIndex] as MessageHeader;
h.WriteHeaderContents (writer, version);
}
- public void WriteHeaderContents (int index, XmlWriter writer)
+ public void WriteHeaderContents (int headerIndex, XmlWriter writer)
{
- WriteHeaderContents (index, XmlDictionaryWriter.CreateDictionaryWriter (writer));
+ WriteHeaderContents (headerIndex, XmlDictionaryWriter.CreateDictionaryWriter (writer));
}
- public void WriteStartHeader (int index, XmlDictionaryWriter writer)
+ public void WriteStartHeader (int headerIndex, XmlDictionaryWriter writer)
{
- if (index > l.Count)
- throw new ArgumentOutOfRangeException ("There is no header at position " + index + ".");
+ if (headerIndex > l.Count)
+ throw new ArgumentOutOfRangeException ("There is no header at position " + headerIndex + ".");
- MessageHeader h = l [index] as MessageHeader;
+ MessageHeader h = l [headerIndex] as MessageHeader;
h.WriteStartHeader (writer, version);
}
- public void WriteStartHeader (int index, XmlWriter writer)
+ public void WriteStartHeader (int headerIndex, XmlWriter writer)
{
- WriteStartHeader (index, XmlDictionaryWriter.CreateDictionaryWriter (writer));
+ WriteStartHeader (headerIndex, XmlDictionaryWriter.CreateDictionaryWriter (writer));
}
public string Action {
this.addressing = addressing;
}
- public static MessageVersion CreateVersion (EnvelopeVersion envelope_version)
+ public static MessageVersion CreateVersion (EnvelopeVersion envelopeVersion)
{
- return CreateVersion (envelope_version,
+ return CreateVersion (envelopeVersion,
AddressingVersion.WSAddressing10);
}
- public static MessageVersion CreateVersion (EnvelopeVersion envelope_version,
- AddressingVersion addressing_version)
+ public static MessageVersion CreateVersion (EnvelopeVersion envelopeVersion,
+ AddressingVersion addressingVersion)
{
- if (envelope_version == EnvelopeVersion.None && addressing_version == AddressingVersion.None)
+ if (envelopeVersion == EnvelopeVersion.None && addressingVersion == AddressingVersion.None)
return None;
- if (envelope_version == EnvelopeVersion.Soap11 && addressing_version == AddressingVersion.None)
+ if (envelopeVersion == EnvelopeVersion.Soap11 && addressingVersion == AddressingVersion.None)
return Soap11;
- if (envelope_version == EnvelopeVersion.Soap12 && addressing_version == AddressingVersion.WSAddressing10)
+ if (envelopeVersion == EnvelopeVersion.Soap12 && addressingVersion == AddressingVersion.WSAddressing10)
return Soap12WSAddressing10;
- if (envelope_version == EnvelopeVersion.Soap12 && addressing_version == AddressingVersion.None)
+ if (envelopeVersion == EnvelopeVersion.Soap12 && addressingVersion == AddressingVersion.None)
return Soap12;
- if (envelope_version == EnvelopeVersion.Soap11 && addressing_version == AddressingVersion.WSAddressing10)
+ if (envelopeVersion == EnvelopeVersion.Soap11 && addressingVersion == AddressingVersion.WSAddressing10)
return Soap11WSAddressing10;
- if (envelope_version == EnvelopeVersion.Soap11 && addressing_version == AddressingVersion.WSAddressingAugust2004)
+ if (envelopeVersion == EnvelopeVersion.Soap11 && addressingVersion == AddressingVersion.WSAddressingAugust2004)
return Soap11WSAddressingAugust2004;
- if (envelope_version == EnvelopeVersion.Soap12 && addressing_version == AddressingVersion.WSAddressingAugust2004)
+ if (envelopeVersion == EnvelopeVersion.Soap12 && addressingVersion == AddressingVersion.WSAddressingAugust2004)
return Soap12WSAddressingAugust2004;
- throw new ArgumentException (string.Format ("EnvelopeVersion {0} cannot be used with AddressingVersion {1}", envelope_version, addressing_version));
+ throw new ArgumentException (string.Format ("EnvelopeVersion {0} cannot be used with AddressingVersion {1}", envelopeVersion, addressingVersion));
}
- public override bool Equals (object value)
+ public override bool Equals (object obj)
{
- MessageVersion other = value as MessageVersion;
+ MessageVersion other = obj as MessageVersion;
if (other == null)
return false;
#endif
public static SecurityBindingElement
- CreateSecureConversationBindingElement (SecurityBindingElement binding)
+ CreateSecureConversationBindingElement (SecurityBindingElement bootstrapSecurity)
{
- return CreateSecureConversationBindingElement (binding, false);
+ return CreateSecureConversationBindingElement (bootstrapSecurity, false);
}
public static SecurityBindingElement
CreateSecureConversationBindingElement (
- SecurityBindingElement binding, bool requireCancellation)
+ SecurityBindingElement bootstrapSecurity, bool requireCancellation)
{
- return CreateSecureConversationBindingElement (binding, requireCancellation, null);
+ return CreateSecureConversationBindingElement (bootstrapSecurity, requireCancellation, null);
}
public static SecurityBindingElement
CreateSecureConversationBindingElement (
- SecurityBindingElement binding, bool requireCancellation,
- ChannelProtectionRequirements protectionRequirements)
+ SecurityBindingElement bootstrapSecurity, bool requireCancellation,
+ ChannelProtectionRequirements bootstrapProtectionRequirements)
{
#if !MOBILE && !XAMMAC_4_5
SymmetricSecurityBindingElement be =
new SymmetricSecurityBindingElement ();
be.ProtectionTokenParameters =
new SecureConversationSecurityTokenParameters (
- binding, requireCancellation, protectionRequirements);
+ bootstrapSecurity, requireCancellation, bootstrapProtectionRequirements);
return be;
#else
throw new NotImplementedException ();
}
protected TcpTransportBindingElement (
- TcpTransportBindingElement other)
- : base (other)
+ TcpTransportBindingElement elementToBeCloned)
+ : base (elementToBeCloned)
{
- listen_backlog = other.listen_backlog;
- port_sharing_enabled = other.port_sharing_enabled;
- pool.CopyPropertiesFrom (other.pool);
+ listen_backlog = elementToBeCloned.listen_backlog;
+ port_sharing_enabled = elementToBeCloned.port_sharing_enabled;
+ pool.CopyPropertiesFrom (elementToBeCloned.pool);
}
public TcpConnectionPoolSettings ConnectionPoolSettings {
}
protected TransportBindingElement (
- TransportBindingElement other)
- : base (other)
+ TransportBindingElement elementToBeCloned)
+ : base (elementToBeCloned)
{
- manual_addressing = other.manual_addressing;
- max_buffer_pool_size = other.max_buffer_pool_size;
- max_recv_message_size = other.max_recv_message_size;
+ manual_addressing = elementToBeCloned.manual_addressing;
+ max_buffer_pool_size = elementToBeCloned.max_buffer_pool_size;
+ max_recv_message_size = elementToBeCloned.max_recv_message_size;
}
public virtual bool ManualAddressing {
}
[MonoTODO]
- protected ClientCredentials (ClientCredentials source)
+ protected ClientCredentials (ClientCredentials other)
{
- userpass = source.userpass.Clone ();
- digest = source.digest.Clone ();
- initiator = source.initiator.Clone ();
- recipient = source.recipient.Clone ();
- windows = source.windows.Clone ();
+ userpass = other.userpass.Clone ();
+ digest = other.digest.Clone ();
+ initiator = other.initiator.Clone ();
+ recipient = other.recipient.Clone ();
+ windows = other.windows.Clone ();
#if !MOBILE
- issued_token = source.issued_token.Clone ();
- peer = source.peer.Clone ();
- support_interactive = source.support_interactive;
+ issued_token = other.issued_token.Clone ();
+ peer = other.peer.Clone ();
+ support_interactive = other.support_interactive;
#endif
}
[MonoTODO]
public virtual void ApplyClientBehavior (
- ServiceEndpoint endpoint, ClientRuntime behavior)
+ ServiceEndpoint serviceEndpoint, ClientRuntime behavior)
{
- if (endpoint == null)
- throw new ArgumentNullException ("endpoint");
+ if (serviceEndpoint == null)
+ throw new ArgumentNullException ("serviceEndpoint");
if (behavior == null)
throw new ArgumentNullException ("behavior");
public interface IContractBehavior
{
void AddBindingParameters (
- ContractDescription description,
+ ContractDescription contractDescription,
ServiceEndpoint endpoint,
- BindingParameterCollection parameters);
+ BindingParameterCollection bindingParameters);
void ApplyClientBehavior (
- ContractDescription description,
+ ContractDescription contractDescription,
ServiceEndpoint endpoint,
- ClientRuntime proxy);
+ ClientRuntime clientRuntime);
void ApplyDispatchBehavior (
- ContractDescription description,
+ ContractDescription contractDescription,
ServiceEndpoint endpoint,
- DispatchRuntime dispatch);
+ DispatchRuntime dispatchRuntime);
void Validate (
- ContractDescription description,
+ ContractDescription contractDescription,
ServiceEndpoint endpoint);
}
}
public interface IEndpointBehavior
{
void AddBindingParameters (ServiceEndpoint endpoint,
- BindingParameterCollection parameters);
- void ApplyDispatchBehavior (ServiceEndpoint serviceEndpoint,
- EndpointDispatcher dispatcher);
- void ApplyClientBehavior (ServiceEndpoint serviceEndpoint,
- ClientRuntime behavior);
- void Validate (ServiceEndpoint serviceEndpoint);
+ BindingParameterCollection bindingParameters);
+ void ApplyDispatchBehavior (ServiceEndpoint endpoint,
+ EndpointDispatcher endpointDispatcher);
+ void ApplyClientBehavior (ServiceEndpoint endpoint,
+ ClientRuntime clientRuntime);
+ void Validate (ServiceEndpoint endpoint);
}
}
public interface IOperationBehavior
{
void AddBindingParameters (
- OperationDescription description,
- BindingParameterCollection parameters);
+ OperationDescription operationDescription,
+ BindingParameterCollection bindingParameters);
void ApplyDispatchBehavior (
- OperationDescription description,
- DispatchOperation dispatch);
+ OperationDescription operationDescription,
+ DispatchOperation dispatchOperation);
void ApplyClientBehavior (
- OperationDescription description,
- ClientOperation proxy);
+ OperationDescription operationDescription,
+ ClientOperation clientOperation);
void Validate (
- OperationDescription description);
+ OperationDescription operationDescription);
}
}
{
public interface IClientMessageFormatter
{
- object DeserializeReply (Message message, object [] paremeters);
- Message SerializeRequest (MessageVersion version, object [] inputs);
+ object DeserializeReply (Message message, object [] parameters);
+ Message SerializeRequest (MessageVersion messageVersion, object [] parameters);
}
}
{
public interface IClientMessageInspector
{
- void AfterReceiveReply (ref Message message, object correlationState);
- object BeforeSendRequest (ref Message message, IClientChannel channel);
+ void AfterReceiveReply (ref Message reply, object correlationState);
+ object BeforeSendRequest (ref Message request, IClientChannel channel);
}
}
}
public SecureConversationSecurityTokenParameters (
- SecurityBindingElement element)
- : this (element, true)
+ SecurityBindingElement bootstrapSecurityBindingElement)
+ : this (bootstrapSecurityBindingElement, true)
{
}
public SecureConversationSecurityTokenParameters (
- SecurityBindingElement element,
+ SecurityBindingElement bootstrapSecurityBindingElement,
bool requireCancellation)
- : this (element, requireCancellation, null)
+ : this (bootstrapSecurityBindingElement, requireCancellation, null)
{
}
#if !MOBILE && !XAMMAC_4_5
public SecureConversationSecurityTokenParameters (
- SecurityBindingElement element,
+ SecurityBindingElement bootstrapSecurityBindingElement,
bool requireCancellation,
- ChannelProtectionRequirements requirements)
+ ChannelProtectionRequirements bootstrapProtectionRequirements)
{
- this.element = element;
+ this.element = bootstrapSecurityBindingElement;
this.cancellable = requireCancellation;
- if (requirements == null)
+ if (bootstrapProtectionRequirements == null)
this.requirements = new ChannelProtectionRequirements (default_channel_protection_requirements);
else
- this.requirements = new ChannelProtectionRequirements (requirements);
+ this.requirements = new ChannelProtectionRequirements (bootstrapProtectionRequirements);
}
#else
internal SecureConversationSecurityTokenParameters (
public class ActionNotSupportedException : CommunicationException
{
public ActionNotSupportedException () : base () {}
- public ActionNotSupportedException (string msg) : base (msg) {}
- public ActionNotSupportedException (string msg, Exception inner) : base (msg, inner) {}
+ public ActionNotSupportedException (string message) : base (message) {}
+ public ActionNotSupportedException (string message, Exception innerException) : base (message, innerException) {}
protected ActionNotSupportedException (SerializationInfo info, StreamingContext context) :
base (info, context) {}
}
get { return Endpoint.Binding.OpenTimeout; }
}
- protected virtual void ApplyConfiguration (string endpointConfig)
+ protected virtual void ApplyConfiguration (string configurationName)
{
- if (endpointConfig == null)
+ if (configurationName == null)
return;
#if MOBILE || XAMMAC_4_5
var cfg = new SilverlightClientConfigLoader ().Load (XmlReader.Create ("ServiceReferences.ClientConfig"));
SilverlightClientConfigLoader.ServiceEndpointConfiguration se = null;
- if (endpointConfig == "*")
+ if (configurationName == "*")
se = cfg.GetServiceEndpointConfiguration (Endpoint.Contract.Name);
if (se == null)
- se = cfg.GetServiceEndpointConfiguration (endpointConfig);
+ se = cfg.GetServiceEndpointConfiguration (configurationName);
if (se.Binding != null && Endpoint.Binding == null)
Endpoint.Binding = se.Binding;
else // ignore it
- Console.WriteLine ("WARNING: Configured binding not found in configuration {0}", endpointConfig);
+ Console.WriteLine ("WARNING: Configured binding not found in configuration {0}", configurationName);
if (se.Address != null && Endpoint.Address == null)
Endpoint.Address = se.Address;
else // ignore it
- Console.WriteLine ("WARNING: Configured endpoint address not found in configuration {0}", endpointConfig);
+ Console.WriteLine ("WARNING: Configured endpoint address not found in configuration {0}", configurationName);
} catch (Exception) {
// ignore it.
- Console.WriteLine ("WARNING: failed to load endpoint configuration for {0}", endpointConfig);
+ Console.WriteLine ("WARNING: failed to load endpoint configuration for {0}", configurationName);
}
#else
ChannelEndpointElement endpoint = null;
foreach (ChannelEndpointElement el in client.Endpoints) {
- if (el.Contract == contractName && (endpointConfig == el.Name || endpointConfig == "*")) {
+ if (el.Contract == contractName && (configurationName == el.Name || configurationName == "*")) {
if (endpoint != null)
throw new InvalidOperationException (String.Format ("More then one endpoint matching contract {0} was found.", contractName));
endpoint = el;
}
if (endpoint == null)
- throw new InvalidOperationException (String.Format ("Client endpoint configuration '{0}' was not found in {1} endpoints.", endpointConfig, client.Endpoints.Count));
+ throw new InvalidOperationException (String.Format ("Client endpoint configuration '{0}' was not found in {1} endpoints.", configurationName, client.Endpoints.Count));
var binding = String.IsNullOrEmpty (endpoint.Binding) ? null : ConfigUtil.CreateBinding (endpoint.Binding, endpoint.BindingConfiguration);
var contractType = ConfigUtil.GetTypeFromConfigString (endpoint.Contract, NamedConfigCategory.Contract);
}
protected void InitializeEndpoint (
- string endpointConfigurationName,
+ string configurationName,
EndpointAddress remoteAddress)
{
InitializeEndpoint (CreateDescription ());
if (remoteAddress != null)
service_endpoint.Address = remoteAddress;
- ApplyConfiguration (endpointConfigurationName);
+ ApplyConfiguration (configurationName);
}
protected void InitializeEndpoint (Binding binding,
- EndpointAddress remoteAddress)
+ EndpointAddress address)
{
InitializeEndpoint (CreateDescription ());
if (binding != null)
service_endpoint.Binding = binding;
- if (remoteAddress != null)
- service_endpoint.Address = remoteAddress;
+ if (address != null)
+ service_endpoint.Address = address;
}
protected void InitializeEndpoint (ServiceEndpoint endpoint)
{
}
- protected ChannelFactory (Type type)
+ protected ChannelFactory (Type channelType)
{
- if (type == null)
- throw new ArgumentNullException ("type");
- if (!type.IsInterface)
- throw new InvalidOperationException ("The type argument to the generic ChannelFactory constructor must be an interface type.");
+ if (channelType == null)
+ throw new ArgumentNullException ("channelType");
+ if (!channelType.IsInterface)
+ throw new InvalidOperationException ("The channelType argument to the generic ChannelFactory constructor must be an interface type.");
InitializeEndpoint (CreateDescription ());
}
public class CommunicationException : SystemException
{
public CommunicationException () : base () {}
- public CommunicationException (string msg) : base (msg) {}
- public CommunicationException (string msg, Exception inner) : base (msg, inner) {}
+ public CommunicationException (string message) : base (message) {}
+ public CommunicationException (string message, Exception innerException) : base (message, innerException) {}
protected CommunicationException (SerializationInfo info, StreamingContext context)
: base (info, context) {}
}
public class CommunicationObjectAbortedException : CommunicationException
{
public CommunicationObjectAbortedException () : base () {}
- public CommunicationObjectAbortedException (string msg) : base (msg) {}
- public CommunicationObjectAbortedException (string msg, Exception inner)
- : base (msg, inner) {}
+ public CommunicationObjectAbortedException (string message) : base (message) {}
+ public CommunicationObjectAbortedException (string message, Exception innerException)
+ : base (message, innerException) {}
protected CommunicationObjectAbortedException (SerializationInfo info,
StreamingContext context)
: base (info, context) {}
public class CommunicationObjectFaultedException : CommunicationException
{
public CommunicationObjectFaultedException () : base () {}
- public CommunicationObjectFaultedException (string msg) : base (msg) {}
- public CommunicationObjectFaultedException (string msg, Exception inner)
- : base (msg, inner) {}
+ public CommunicationObjectFaultedException (string message) : base (message) {}
+ public CommunicationObjectFaultedException (string message, Exception innerException)
+ : base (message, innerException) {}
protected CommunicationObjectFaultedException (SerializationInfo info, StreamingContext context)
: base (info, context) {}
}
Initialize (identity);
}
- public DnsEndpointIdentity (string dns)
- : this (Claim.CreateDnsClaim (dns))
+ public DnsEndpointIdentity (string dnsName)
+ : this (Claim.CreateDnsClaim (dnsName))
{
}
#else
- public DnsEndpointIdentity (string dns)
+ public DnsEndpointIdentity (string dnsName)
{
throw new NotImplementedException ();
}
{
public class DuplexClientBase<TChannel> : ClientBase<TChannel> where TChannel : class
{
- protected DuplexClientBase (object instance)
- : this (new InstanceContext (instance), (Binding) null, null)
+ protected DuplexClientBase (object callbackInstance)
+ : this (new InstanceContext (callbackInstance), (Binding) null, null)
{
}
- protected DuplexClientBase (object instance,
- Binding binding, EndpointAddress address)
- : this (new InstanceContext (instance), binding, address)
+ protected DuplexClientBase (object callbackInstance,
+ Binding binding, EndpointAddress remoteAddress)
+ : this (new InstanceContext (callbackInstance), binding, remoteAddress)
{
}
- protected DuplexClientBase (object instance,
- string configurationName)
- : this (new InstanceContext (instance), configurationName)
+ protected DuplexClientBase (object callbackInstance,
+ string endpointConfigurationName)
+ : this (new InstanceContext (callbackInstance), endpointConfigurationName)
{
}
- protected DuplexClientBase (object instance,
- string bindingConfigurationName, EndpointAddress address)
- : this (new InstanceContext (instance), bindingConfigurationName, address)
+ protected DuplexClientBase (object callbackInstance,
+ string bindingConfigurationName, EndpointAddress remoteAddress)
+ : this (new InstanceContext (callbackInstance), bindingConfigurationName, remoteAddress)
{
}
- protected DuplexClientBase (object instance,
+ protected DuplexClientBase (object callbackInstance,
string endpointConfigurationName, string remoteAddress)
- : this (new InstanceContext (instance), endpointConfigurationName, remoteAddress)
+ : this (new InstanceContext (callbackInstance), endpointConfigurationName, remoteAddress)
{
}
- protected DuplexClientBase (InstanceContext instance)
- : base (instance)
+ protected DuplexClientBase (InstanceContext callbackInstance)
+ : base (callbackInstance)
{
}
- protected DuplexClientBase (InstanceContext instance,
- Binding binding, EndpointAddress address)
- : base (instance, binding, address)
+ protected DuplexClientBase (InstanceContext callbackInstance,
+ Binding binding, EndpointAddress remoteAddress)
+ : base (callbackInstance, binding, remoteAddress)
{
}
- protected DuplexClientBase (InstanceContext instance,
- string configurationName)
- : base (instance, configurationName)
+ protected DuplexClientBase (InstanceContext callbackInstance,
+ string endpointConfigurationName)
+ : base (callbackInstance, endpointConfigurationName)
{
}
- protected DuplexClientBase (InstanceContext instance,
+ protected DuplexClientBase (InstanceContext callbackInstance,
string endpointConfigurationName, string remoteAddress)
- : base (instance, endpointConfigurationName, remoteAddress)
+ : base (callbackInstance, endpointConfigurationName, remoteAddress)
{
}
- protected DuplexClientBase (InstanceContext instance,
- string configurationName, EndpointAddress address)
- : base (instance, configurationName, address)
+ protected DuplexClientBase (InstanceContext callbackInstance,
+ string endpointConfigurationName, EndpointAddress address)
+ : base (callbackInstance, endpointConfigurationName, address)
{
}
- protected DuplexClientBase (object instance, ServiceEndpoint endpoint)
- : this (new InstanceContext (instance), endpoint)
+ protected DuplexClientBase (object callbackInstance, ServiceEndpoint endpoint)
+ : this (new InstanceContext (callbackInstance), endpoint)
{
}
- protected DuplexClientBase (InstanceContext instance, ServiceEndpoint endpoint)
- : base (instance, endpoint)
+ protected DuplexClientBase (InstanceContext callbackInstance, ServiceEndpoint endpoint)
+ : base (callbackInstance, endpoint)
{
}
{
}
- public EndpointAddress (Uri uri, params AddressHeader [] headers)
- : this (uri, null, new AddressHeaderCollection (headers), null, null) {}
+ public EndpointAddress (Uri uri, params AddressHeader [] addressHeaders)
+ : this (uri, null, new AddressHeaderCollection (addressHeaders), null, null) {}
- public EndpointAddress (Uri uri, EndpointIdentity identity, params AddressHeader [] headers)
- : this (uri, identity, new AddressHeaderCollection (headers), null, null) {}
+ public EndpointAddress (Uri uri, EndpointIdentity identity, params AddressHeader [] addressHeaders)
+ : this (uri, identity, new AddressHeaderCollection (addressHeaders), null, null) {}
public EndpointAddress (Uri uri, EndpointIdentity identity, AddressHeaderCollection headers)
: this (uri, identity, headers, null, null) {}
public class EndpointNotFoundException : CommunicationException
{
public EndpointNotFoundException () : base () {}
- public EndpointNotFoundException (string msg) : base (msg) {}
- public EndpointNotFoundException (string msg, Exception inner) : base (msg, inner) {}
+ public EndpointNotFoundException (string message) : base (message) {}
+ public EndpointNotFoundException (string message, Exception innerException) : base (message, innerException) {}
protected EndpointNotFoundException (SerializationInfo info, StreamingContext context) :
base (info, context) {}
}
{
}
- public FaultCode (string name, FaultCode subcode)
- : this (name, String.Empty, subcode)
+ public FaultCode (string name, FaultCode subCode)
+ : this (name, String.Empty, subCode)
{
}
- public FaultCode (string name, string ns, FaultCode subcode)
+ public FaultCode (string name, string ns, FaultCode subCode)
{
this.name = name;
this.ns = ns;
- this.subcode = subcode;
+ this.subcode = subCode;
}
public bool IsPredefinedFault {
get { return subcode; }
}
- public static FaultCode CreateReceiverFaultCode (FaultCode subcode)
+ public static FaultCode CreateReceiverFaultCode (FaultCode subCode)
{
- return new FaultCode ("Receiver", subcode);
+ return new FaultCode ("Receiver", subCode);
}
public static FaultCode CreateReceiverFaultCode (string name, string ns)
return CreateReceiverFaultCode (new FaultCode (name, ns));
}
- public static FaultCode CreateSenderFaultCode (FaultCode subcode)
+ public static FaultCode CreateSenderFaultCode (FaultCode subCode)
{
- return new FaultCode ("Sender", subcode);
+ return new FaultCode ("Sender", subCode);
}
public static FaultCode CreateSenderFaultCode (string name, string ns)
}
[MonoTODO]
- public static FaultException CreateFault (MessageFault fault, params Type [] details)
+ public static FaultException CreateFault (MessageFault messageFault, params Type [] faultDetailTypes)
{
throw new NotImplementedException ();
}
public class InvalidMessageContractException : SystemException
{
public InvalidMessageContractException () : base () {}
- public InvalidMessageContractException (string msg) : base (msg) {}
- public InvalidMessageContractException (string msg, Exception inner) : base (msg, inner) {}
+ public InvalidMessageContractException (string message) : base (message) {}
+ public InvalidMessageContractException (string message, Exception innerException) : base (message, innerException) {}
protected InvalidMessageContractException (SerializationInfo info, StreamingContext context) :
base (info, context) {}
}
public class MessageHeaderException : ProtocolException
{
public MessageHeaderException () : this ("Message header exception") {}
- public MessageHeaderException (string msg) : this (msg, null) {}
- public MessageHeaderException (string msg, Exception inner) : base (msg, inner) {}
+ public MessageHeaderException (string message) : this (message, null) {}
+ public MessageHeaderException (string message, Exception innerException) : base (message, innerException) {}
protected MessageHeaderException (SerializationInfo info, StreamingContext context) :
base (info, context)
{
{
}
- public MessageHeader (T content, bool must_understand, string actor, bool relay)
+ public MessageHeader (T content, bool mustUnderstand, string actor, bool relay)
{
this.content = content;
- this.must_understand = must_understand;
+ this.must_understand = mustUnderstand;
this.actor = actor;
this.relay = relay;
}
public class ProtocolException : CommunicationException
{
public ProtocolException () : base () {}
- public ProtocolException (string msg) : base (msg) {}
- public ProtocolException (string msg, Exception inner)
- : base (msg, inner) {}
+ public ProtocolException (string message) : base (message) {}
+ public ProtocolException (string message, Exception innerException)
+ : base (message, innerException) {}
protected ProtocolException (SerializationInfo info,
StreamingContext context)
: base (info, context) {}
public class QuotaExceededException : SystemException
{
public QuotaExceededException () : base () {}
- public QuotaExceededException (string msg) : base (msg) {}
- public QuotaExceededException (string msg, Exception inner)
- : base (msg, inner) {}
+ public QuotaExceededException (string message) : base (message) {}
+ public QuotaExceededException (string message, Exception innerException)
+ : base (message, innerException) {}
protected QuotaExceededException (SerializationInfo info,
StreamingContext context)
: base (info, context) {}
public class ServerTooBusyException : CommunicationException
{
public ServerTooBusyException () : base () {}
- public ServerTooBusyException (string msg) : base (msg) {}
- public ServerTooBusyException (string msg, Exception inner)
- : base (msg, inner) {}
+ public ServerTooBusyException (string message) : base (message) {}
+ public ServerTooBusyException (string message, Exception innerException)
+ : base (message, innerException) {}
protected ServerTooBusyException (SerializationInfo info,
StreamingContext context)
: base (info, context) {}
public class ServiceActivationException : CommunicationException
{
public ServiceActivationException () : base () {}
- public ServiceActivationException (string msg) : base (msg) {}
- public ServiceActivationException (string msg, Exception inner)
- : base (msg, inner) {}
+ public ServiceActivationException (string message) : base (message) {}
+ public ServiceActivationException (string message, Exception innerException)
+ : base (message, innerException) {}
protected ServiceActivationException (SerializationInfo info,
StreamingContext context)
: base (info, context) {}
Initialize (identity);
}
- public SpnEndpointIdentity (string spn)
- : this (Claim.CreateSpnClaim (spn))
+ public SpnEndpointIdentity (string spnName)
+ : this (Claim.CreateSpnClaim (spnName))
{
}
#else
- public SpnEndpointIdentity (string spn)
+ public SpnEndpointIdentity (string spnName)
{
throw new NotImplementedException ();
}
Initialize (identity);
}
- public UpnEndpointIdentity (string upn)
- : this (Claim.CreateUpnClaim (upn))
+ public UpnEndpointIdentity (string upnName)
+ : this (Claim.CreateUpnClaim (upnName))
{
}
#else
- public UpnEndpointIdentity (string upn)
+ public UpnEndpointIdentity (string upnName)
{
throw new NotImplementedException ();
}
AuthenticationSchemes.Ntlm, label);
}
-#if NET_4_5
[Test]
public virtual void BasicHttps ()
{
WSMessageEncoding.Text, HttpClientCredentialType.None,
AuthenticationSchemes.Anonymous, label);
}
-#endif
[Test]
public virtual void NetTcp ()
return exporter.GetGeneratedMetadata ();
}
-#if NET_4_5
[MetadataSample]
public static MetadataSet BasicHttps ()
{
return exporter.GetGeneratedMetadata ();
}
-#endif
[MetadataSample]
public static MetadataSet NetTcp ()
}
}
-#if NET_4_5
[Test]
public void Protect ()
{
MachineKey.Unprotect (encryptedBytes, oneUsage),
"Single purpose working when multiple supplied");
}
-#endif
}
}
-#if NET_4_5
using System.ComponentModel.DataAnnotations;
using System.Linq;
}
}
}
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_5
using System;
using System.Threading.Tasks;
}
}
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_5
using System;
using System.IO;
}
}
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_5
using System;
using System.Threading;
}
}
-#endif
using System.Xml;\r
using System.Xml.Schema;\r
using System.Xml.XPath;\r
-#if NET_4_5\r
using System.Threading;\r
using System.Threading.Tasks;\r
-#endif\r
\r
using NUnit.Framework;\r
\r
Assert.AreEqual ((UInt64) 1, xr.ReadContentAs (typeof (UInt64), null), "#8");\r
}\r
\r
-#if NET_4_5\r
[Test]\r
[ExpectedException(typeof(InvalidOperationException))]\r
public void MustSetAsyncFlag ()\r
if (task.Result != null)\r
throw task.Result;\r
}\r
-#endif\r
}\r
}\r
Assert.AreEqual ("urn:foo", r.BaseURI);
}
-#if NET_4_5
[Test]
[ExpectedException (typeof (XmlException))]
public void ReadonlyAsync ()
var r2 = XmlReader.Create (r, c);
Assert.IsTrue (r2.Settings.Async);
}
-#endif
}
}
Assert.IsTrue (u2.IsAbsoluteUri, "null,absolute/file");
}
-#if NET_4_5
class AsyncXmlResolver : XmlResolver
{
public override object GetEntity (Uri absoluteUri, string role, Type ofObjectToReturn)
var uri = new Uri ("http://www.mono-project.com");
ar.GetEntityAsync (uri, null, typeof(string));
}
-#endif
}
}
Assert.IsTrue (site, "Site-2");
}
-#if NET_4_5
[Test]
[Category("Async")]
public void TestAsync ()
Assert.That (task.Wait (3000));
Assert.IsInstanceOfType (typeof (Stream), task.Result);
}
-#endif
}
}
using System.IO;\r
using System.Xml;\r
using NUnit.Framework;\r
-#if NET_4_5\r
using System.Reflection;\r
-#endif\r
\r
namespace MonoTests.System.Xml\r
{\r
Assert.AreEqual ("view:Standard.xslt", uri.AbsoluteUri, "#2");\r
}\r
\r
-#if NET_4_5\r
[Test]\r
public void TestAsync ()\r
{\r
Assert.IsTrue (ex is XmlException);\r
}\r
}\r
-#endif\r
}\r
}\r
Assert.AreEqual (false, s.NewLineOnAttributes);
Assert.AreEqual (false, s.OmitXmlDeclaration);
Assert.AreEqual (NewLineHandling.Replace, s.NewLineHandling);
-#if NET_4_5
Assert.IsFalse (s.Async);
-#endif
}
[Test]
Assert.AreEqual (xml, sw.ToString ());
}
-#if NET_4_5
[Test]
[ExpectedException (typeof (XmlException))]
public void ReadonlyAsync ()
var w2 = XmlWriter.Create (w, c);
Assert.IsTrue (w2.Settings.Async);
}
-#endif
}
}
public XElement Content;
}
-#if NET_4_5
[Test]
// Bug #12571
public void DeserializeXElement ()
var xe = (SerializableClass)res;
Assert.AreEqual (xe.Content.ToString (), "<Data />", "#3");
}
-#endif
[Test] // Bug #20151
public void XElementFromArrayWithNullValuesAsObject ()
bool disposed;
DeflateStreamNative native;
- public DeflateStream (Stream compressedStream, CompressionMode mode) :
- this (compressedStream, mode, false, false)
+ public DeflateStream (Stream stream, CompressionMode mode) :
+ this (stream, mode, false, false)
{
}
- public DeflateStream (Stream compressedStream, CompressionMode mode, bool leaveOpen) :
- this (compressedStream, mode, leaveOpen, false)
+ public DeflateStream (Stream stream, CompressionMode mode, bool leaveOpen) :
+ this (stream, mode, leaveOpen, false)
{
}
}
}
- public override int Read (byte[] dest, int dest_offset, int count)
+ public override int Read (byte[] array, int offset, int count)
{
if (disposed)
throw new ObjectDisposedException (GetType ().FullName);
- if (dest == null)
+ if (array == null)
throw new ArgumentNullException ("Destination array is null.");
if (!CanRead)
throw new InvalidOperationException ("Stream does not support reading.");
- int len = dest.Length;
- if (dest_offset < 0 || count < 0)
+ int len = array.Length;
+ if (offset < 0 || count < 0)
throw new ArgumentException ("Dest or count is negative.");
- if (dest_offset > len)
+ if (offset > len)
throw new ArgumentException ("destination offset is beyond array size");
- if ((dest_offset + count) > len)
+ if ((offset + count) > len)
throw new ArgumentException ("Reading would overrun buffer");
- return ReadInternal (dest, dest_offset, count);
+ return ReadInternal (array, offset, count);
}
unsafe void WriteInternal (byte[] array, int offset, int count)
}
}
- public override void Write (byte[] src, int src_offset, int count)
+ public override void Write (byte[] array, int offset, int count)
{
if (disposed)
throw new ObjectDisposedException (GetType ().FullName);
- if (src == null)
- throw new ArgumentNullException ("src");
+ if (array == null)
+ throw new ArgumentNullException ("array");
- if (src_offset < 0)
- throw new ArgumentOutOfRangeException ("src_offset");
+ if (offset < 0)
+ throw new ArgumentOutOfRangeException ("offset");
if (count < 0)
throw new ArgumentOutOfRangeException ("count");
if (!CanWrite)
throw new NotSupportedException ("Stream does not support writing");
- if (src_offset > src.Length - count)
+ if (offset > array.Length - count)
throw new ArgumentException ("Buffer too small. count/offset wrong.");
- WriteInternal (src, src_offset, count);
+ WriteInternal (array, offset, count);
}
public override void Flush ()
base.Dispose (disposing);
}
- public override int Read (byte[] dest, int dest_offset, int count)
+ public override int Read (byte[] array, int offset, int count)
{
if (deflateStream == null)
throw new ObjectDisposedException (GetType ().FullName);
- return deflateStream.Read(dest, dest_offset, count);
+ return deflateStream.Read(array, offset, count);
}
- public override void Write (byte[] src, int src_offset, int count)
+ public override void Write (byte[] array, int offset, int count)
{
if (deflateStream == null)
throw new ObjectDisposedException (GetType ().FullName);
- deflateStream.Write (src, src_offset, count);
+ deflateStream.Write (array, offset, count);
}
public override void Flush()
#region Poll
- public bool Poll (int time_us, SelectMode mode)
+ public bool Poll (int microSeconds, SelectMode mode)
{
ThrowIfDisposedAndClosed ();
throw new NotSupportedException ("'mode' parameter is not valid.");
int error;
- bool result = Poll_internal (safe_handle, mode, time_us, out error);
+ bool result = Poll_internal (safe_handle, mode, microSeconds, out error);
if (error != 0)
throw new SocketException (error);
#region Bind
- public void Bind (EndPoint local_end)
+ public void Bind (EndPoint localEP)
{
ThrowIfDisposedAndClosed ();
- if (local_end == null)
- throw new ArgumentNullException("local_end");
+ if (localEP == null)
+ throw new ArgumentNullException("localEP");
- var ipEndPoint = local_end as IPEndPoint;
+ var ipEndPoint = localEP as IPEndPoint;
if (ipEndPoint != null) {
- local_end = RemapIPEndPoint (ipEndPoint);
+ localEP = RemapIPEndPoint (ipEndPoint);
}
int error;
- Bind_internal (safe_handle, local_end.Serialize(), out error);
+ Bind_internal (safe_handle, localEP.Serialize(), out error);
if (error != 0)
throw new SocketException (error);
if (error == 0)
is_bound = true;
- seed_endpoint = local_end;
+ seed_endpoint = localEP;
}
private static void Bind_internal (SafeSocketHandle safeHandle, SocketAddress sa, out int error)
return Receive (buffer, SocketFlags.None);
}
- public int Receive (byte [] buffer, SocketFlags flags)
+ public int Receive (byte [] buffer, SocketFlags socketFlags)
{
ThrowIfDisposedAndClosed ();
ThrowIfBufferNull (buffer);
ThrowIfBufferOutOfRange (buffer, 0, buffer.Length);
SocketError error;
- int ret = Receive_nochecks (buffer, 0, buffer.Length, flags, out error);
+ int ret = Receive_nochecks (buffer, 0, buffer.Length, socketFlags, out error);
if (error != SocketError.Success) {
if (error == SocketError.WouldBlock && is_blocking) // This might happen when ReceiveTimeout is set
return ret;
}
- public int Receive (byte [] buffer, int size, SocketFlags flags)
+ public int Receive (byte [] buffer, int size, SocketFlags socketFlags)
{
ThrowIfDisposedAndClosed ();
ThrowIfBufferNull (buffer);
ThrowIfBufferOutOfRange (buffer, 0, size);
SocketError error;
- int ret = Receive_nochecks (buffer, 0, size, flags, out error);
+ int ret = Receive_nochecks (buffer, 0, size, socketFlags, out error);
if (error != SocketError.Success) {
if (error == SocketError.WouldBlock && is_blocking) // This might happen when ReceiveTimeout is set
return ret;
}
- public int Receive (byte [] buffer, int offset, int size, SocketFlags flags)
+ public int Receive (byte [] buffer, int offset, int size, SocketFlags socketFlags)
{
ThrowIfDisposedAndClosed ();
ThrowIfBufferNull (buffer);
ThrowIfBufferOutOfRange (buffer, offset, size);
SocketError error;
- int ret = Receive_nochecks (buffer, offset, size, flags, out error);
+ int ret = Receive_nochecks (buffer, offset, size, socketFlags, out error);
if (error != SocketError.Success) {
if (error == SocketError.WouldBlock && is_blocking) // This might happen when ReceiveTimeout is set
return ret;
}
- public int Receive (byte [] buffer, int offset, int size, SocketFlags flags, out SocketError error)
+ public int Receive (byte [] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode)
{
ThrowIfDisposedAndClosed ();
ThrowIfBufferNull (buffer);
ThrowIfBufferOutOfRange (buffer, offset, size);
- return Receive_nochecks (buffer, offset, size, flags, out error);
+ return Receive_nochecks (buffer, offset, size, socketFlags, out errorCode);
}
public int Receive (IList<ArraySegment<byte>> buffers)
return ReceiveFrom (buffer, 0, buffer.Length, SocketFlags.None, ref remoteEP);
}
- public int ReceiveFrom (byte [] buffer, SocketFlags flags, ref EndPoint remoteEP)
+ public int ReceiveFrom (byte [] buffer, SocketFlags socketFlags, ref EndPoint remoteEP)
{
ThrowIfDisposedAndClosed ();
ThrowIfBufferNull (buffer);
- return ReceiveFrom (buffer, 0, buffer.Length, flags, ref remoteEP);
+ return ReceiveFrom (buffer, 0, buffer.Length, socketFlags, ref remoteEP);
}
- public int ReceiveFrom (byte [] buffer, int size, SocketFlags flags, ref EndPoint remoteEP)
+ public int ReceiveFrom (byte [] buffer, int size, SocketFlags socketFlags, ref EndPoint remoteEP)
{
ThrowIfDisposedAndClosed ();
ThrowIfBufferNull (buffer);
ThrowIfBufferOutOfRange (buffer, 0, size);
- return ReceiveFrom (buffer, 0, size, flags, ref remoteEP);
+ return ReceiveFrom (buffer, 0, size, socketFlags, ref remoteEP);
}
- public int ReceiveFrom (byte [] buffer, int offset, int size, SocketFlags flags, ref EndPoint remoteEP)
+ public int ReceiveFrom (byte [] buffer, int offset, int size, SocketFlags socketFlags, ref EndPoint remoteEP)
{
ThrowIfDisposedAndClosed ();
ThrowIfBufferNull (buffer);
throw new ArgumentNullException ("remoteEP");
int error;
- return ReceiveFrom_nochecks_exc (buffer, offset, size, flags, ref remoteEP, true, out error);
+ return ReceiveFrom_nochecks_exc (buffer, offset, size, socketFlags, ref remoteEP, true, out error);
}
public bool ReceiveFromAsync (SocketAsyncEventArgs e)
return ret;
}
- public int Send (byte [] buffer, SocketFlags flags)
+ public int Send (byte [] buffer, SocketFlags socketFlags)
{
ThrowIfDisposedAndClosed ();
ThrowIfBufferNull (buffer);
ThrowIfBufferOutOfRange (buffer, 0, buffer.Length);
SocketError error;
- int ret = Send_nochecks (buffer, 0, buffer.Length, flags, out error);
+ int ret = Send_nochecks (buffer, 0, buffer.Length, socketFlags, out error);
if (error != SocketError.Success)
throw new SocketException ((int) error);
return ret;
}
- public int Send (byte [] buffer, int size, SocketFlags flags)
+ public int Send (byte [] buffer, int size, SocketFlags socketFlags)
{
ThrowIfDisposedAndClosed ();
ThrowIfBufferNull (buffer);
ThrowIfBufferOutOfRange (buffer, 0, size);
SocketError error;
- int ret = Send_nochecks (buffer, 0, size, flags, out error);
+ int ret = Send_nochecks (buffer, 0, size, socketFlags, out error);
if (error != SocketError.Success)
throw new SocketException ((int) error);
return ret;
}
- public int Send (byte [] buffer, int offset, int size, SocketFlags flags)
+ public int Send (byte [] buffer, int offset, int size, SocketFlags socketFlags)
{
ThrowIfDisposedAndClosed ();
ThrowIfBufferNull (buffer);
ThrowIfBufferOutOfRange (buffer, offset, size);
SocketError error;
- int ret = Send_nochecks (buffer, offset, size, flags, out error);
+ int ret = Send_nochecks (buffer, offset, size, socketFlags, out error);
if (error != SocketError.Success)
throw new SocketException ((int) error);
return ret;
}
- public int Send (byte [] buffer, int offset, int size, SocketFlags flags, out SocketError error)
+ public int Send (byte [] buffer, int offset, int size, SocketFlags socketFlags, out SocketError errorCode)
{
ThrowIfDisposedAndClosed ();
ThrowIfBufferNull (buffer);
ThrowIfBufferOutOfRange (buffer, offset, size);
- return Send_nochecks (buffer, offset, size, flags, out error);
+ return Send_nochecks (buffer, offset, size, socketFlags, out errorCode);
}
public
#region SendTo
- public int SendTo (byte [] buffer, EndPoint remote_end)
+ public int SendTo (byte [] buffer, EndPoint remoteEP)
{
ThrowIfDisposedAndClosed ();
ThrowIfBufferNull (buffer);
- return SendTo (buffer, 0, buffer.Length, SocketFlags.None, remote_end);
+ return SendTo (buffer, 0, buffer.Length, SocketFlags.None, remoteEP);
}
- public int SendTo (byte [] buffer, SocketFlags flags, EndPoint remote_end)
+ public int SendTo (byte [] buffer, SocketFlags socketFlags, EndPoint remoteEP)
{
ThrowIfDisposedAndClosed ();
ThrowIfBufferNull (buffer);
- return SendTo (buffer, 0, buffer.Length, flags, remote_end);
+ return SendTo (buffer, 0, buffer.Length, socketFlags, remoteEP);
}
- public int SendTo (byte [] buffer, int size, SocketFlags flags, EndPoint remote_end)
+ public int SendTo (byte [] buffer, int size, SocketFlags socketFlags, EndPoint remoteEP)
{
- return SendTo (buffer, 0, size, flags, remote_end);
+ return SendTo (buffer, 0, size, socketFlags, remoteEP);
}
- public int SendTo (byte [] buffer, int offset, int size, SocketFlags flags, EndPoint remote_end)
+ public int SendTo (byte [] buffer, int offset, int size, SocketFlags socketFlags, EndPoint remoteEP)
{
ThrowIfDisposedAndClosed ();
ThrowIfBufferNull (buffer);
ThrowIfBufferOutOfRange (buffer, offset, size);
- if (remote_end == null)
- throw new ArgumentNullException("remote_end");
+ if (remoteEP == null)
+ throw new ArgumentNullException("remoteEP");
- return SendTo_nochecks (buffer, offset, size, flags, remote_end);
+ return SendTo_nochecks (buffer, offset, size, socketFlags, remoteEP);
}
public bool SendToAsync (SocketAsyncEventArgs e)
throw new SocketException (error);
}
- public byte [] GetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, int length)
+ public byte [] GetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, int optionLength)
{
ThrowIfDisposedAndClosed ();
int error;
- byte[] byte_val = new byte [length];
+ byte[] byte_val = new byte [optionLength];
GetSocketOption_arr_internal (safe_handle, optionLevel, optionName, ref byte_val, out error);
if (error != 0)
#region IOControl
- public int IOControl (int ioctl_code, byte [] in_value, byte [] out_value)
+ public int IOControl (int ioControlCode, byte [] optionInValue, byte [] optionOutValue)
{
if (is_disposed)
throw new ObjectDisposedException (GetType ().ToString ());
int error;
- int result = IOControl_internal (safe_handle, ioctl_code, in_value, out_value, out error);
+ int result = IOControl_internal (safe_handle, ioControlCode, optionInValue, optionOutValue, out error);
if (error != 0)
throw new SocketException (error);
public sealed class SemaphoreAccessRule : AccessRule
{
public SemaphoreAccessRule (IdentityReference identity,
- SemaphoreRights semaphoreRights,
+ SemaphoreRights eventRights,
AccessControlType type)
- : base (identity, (int)semaphoreRights, false, InheritanceFlags.None, PropagationFlags.None, type)
+ : base (identity, (int)eventRights, false, InheritanceFlags.None, PropagationFlags.None, type)
{
}
public SemaphoreAccessRule (string identity,
- SemaphoreRights semaphoreRights,
+ SemaphoreRights eventRights,
AccessControlType type)
- : this (new NTAccount (identity), semaphoreRights, type)
+ : this (new NTAccount (identity), eventRights, type)
{
}
: AuditRule
{
public SemaphoreAuditRule (IdentityReference identity,
- SemaphoreRights semaphoreRights,
+ SemaphoreRights eventRights,
AuditFlags flags)
- : base (identity, (int)semaphoreRights, false, InheritanceFlags.None, PropagationFlags.None, flags)
+ : base (identity, (int)eventRights, false, InheritanceFlags.None, PropagationFlags.None, flags)
{
}
// methods
- public override void CopyFrom (AsnEncodedData encodedData)
+ public override void CopyFrom (AsnEncodedData asnEncodedData)
{
- if (encodedData == null)
- throw new ArgumentNullException ("encodedData");
+ if (asnEncodedData == null)
+ throw new ArgumentNullException ("asnEncodedData");
- X509Extension ex = (encodedData as X509Extension);
+ X509Extension ex = (asnEncodedData as X509Extension);
if (ex == null)
- throw new ArgumentException (Locale.GetText ("Wrong type."), "encodedData");
+ throw new ArgumentException (Locale.GetText ("Wrong type."), "asnEncodedData");
if (ex._oid == null)
_oid = new Oid (oid, friendlyName);
// methods
- public override void CopyFrom (AsnEncodedData encodedData)
+ public override void CopyFrom (AsnEncodedData asnEncodedData)
{
- if (encodedData == null)
- throw new ArgumentNullException ("encodedData");
+ if (asnEncodedData == null)
+ throw new ArgumentNullException ("asnEncodedData");
- X509Extension ex = (encodedData as X509Extension);
+ X509Extension ex = (asnEncodedData as X509Extension);
if (ex == null)
- throw new ArgumentException (Locale.GetText ("Wrong type."), "encodedData");
+ throw new ArgumentException (Locale.GetText ("Wrong type."), "asnEncodedData");
if (ex._oid == null)
_oid = new Oid (oid, friendlyName);
return new MemoryStream (Encoding.UTF8.GetBytes (s));
}
-#if NET_4_5
[Test]
public void CheckNet45Overloads () // Xambug #21982
{
decompressing.Close();
backing.Close();
}
-#endif
[Test]
[ExpectedException (typeof (ArgumentException))]
return new MemoryStream (Encoding.UTF8.GetBytes (s));
}
-#if NET_4_5
[Test]
public void CheckNet45Overloads () // Xambug #21982
{
decompressing.Close();
backing.Close();
}
-#endif
}
}
-#if NET_4_5
using System;
using System.Net;
using System.Threading;
}
}
-#endif
}
}
-#if NET_4_5
[Test]
public void AllowReadStreamBuffering ()
{
} catch (InvalidOperationException) {
}
}
-#endif
class ListenerScope : IDisposable {
EventWaitHandle completed;
Assert.AreSame (wc.Proxy, WebRequest.DefaultWebProxy);
}
-#if NET_4_5
[Test]
[Category ("AndroidNotWorking")] // Fails when ran as part of the entire BCL test suite. Works when only this fixture is ran
public void UploadStringAsyncCancelEvent ()
}
listener.Close ();
}
-#endif
public void UploadAsyncCancelEventTest (int port, Action<WebClient, Uri, EventWaitHandle> uploadAction)
{
// 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_5
using System;
using System.IO;
using System.Collections.Generic;
}
}
}
-#endif
public void Setup()
{
StringTester.CreateMode = createMode;
-#if NET_4_5
StringTester.Location = location + "NET_4_5";
-#else
- StringTester.Location = location + "NET_4_0";
-#endif
}
[TearDown]
{
Uri u = new Uri("http://localhost/index.asp#main#start", false);
-#if NET_4_5
Assert.AreEqual (u.Fragment, "#main#start", "#1");
-#else
- Assert.AreEqual (u.Fragment, "#main%23start", "#1");
-#endif
u = new Uri("http://localhost/index.asp#main#start", true);
Assert.AreEqual (u.Fragment, "#main#start", "#2");
Uri b = new Uri ("http://www.gnome.org");
Uri n = new Uri (b, "blah#main#start");
-#if NET_4_5
Assert.AreEqual (n.Fragment, "#main#start", "#3");
-#else
- Assert.AreEqual (n.Fragment, "#main%23start", "#3");
-#endif
n = new Uri (b, "blah#main#start", true);
Assert.AreEqual (n.Fragment, "#main#start", "#4");
Uri ftp = new Uri ("FTP://[::ffFF:169.32.14.5]/");
Assert.AreEqual ("ftp", ftp.Scheme, "#7");
-#if NET_4_5
Assert.AreEqual ("[::ffff:169.32.14.5]", ftp.Host, "#8");
Assert.AreEqual ("ftp://[::ffff:169.32.14.5]/", ftp.ToString (), "#9");
-#else
- Assert.AreEqual ("[0000:0000:0000:0000:0000:FFFF:A920:0E05]", ftp.Host, "#8");
- Assert.AreEqual ("ftp://[0000:0000:0000:0000:0000:FFFF:A920:0E05]/", ftp.ToString (), "#9");
-#endif
}
[Test]
for (int i = 0; i < 128; i++)
sb.Append ((char) i);
-#if NET_4_5
Assert.AreEqual (
"%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20%21%22%23%24%25%26%27%28%29%2A%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F",
Uri.EscapeDataString (sb.ToString ()));
-#else
- Assert.AreEqual (
- "%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22%23%24%25%26'()*%2B%2C-.%2F0123456789%3A%3B%3C%3D%3E%3F%40ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F",
- Uri.EscapeDataString (sb.ToString ()));
-#endif
Assert.AreEqual ("%C3%A1", Uri.EscapeDataString ("á"));
}
for (int i = 0; i < 128; i++)
sb.Append ((char) i);
-#if NET_4_5
Assert.AreEqual (
"%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22#$%25&'()*+,-./0123456789:;%3C=%3E?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[%5C]%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F",
Uri.EscapeUriString (sb.ToString ()));
-#else
- Assert.AreEqual (
- "%00%01%02%03%04%05%06%07%08%09%0A%0B%0C%0D%0E%0F%10%11%12%13%14%15%16%17%18%19%1A%1B%1C%1D%1E%1F%20!%22#$%25&'()*+,-./0123456789:;%3C=%3E?@ABCDEFGHIJKLMNOPQRSTUVWXYZ%5B%5C%5D%5E_%60abcdefghijklmnopqrstuvwxyz%7B%7C%7D~%7F",
- Uri.EscapeUriString (sb.ToString ()));
-#endif
Assert.AreEqual ("%C3%A1", Uri.EscapeDataString ("á"));
}
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void setup_internal_class (TypeBuilder tb);
- [MethodImplAttribute(MethodImplOptions.InternalCall)]
- private extern void create_internal_class (TypeBuilder tb);
-
[MethodImplAttribute(MethodImplOptions.InternalCall)]
private extern void setup_generic_class ();
fields = new FieldBuilder [1];
fields [0] = res;
num_fields ++;
- create_internal_class (this);
}
if (IsEnum) {
public static int GetHRForException (Exception e)
{
+ if (e == null) return 0;
+
#if FEATURE_COMINTEROP
var errorInfo = new ManagedErrorInfo(e);
SetErrorInfo (0, errorInfo);
+#endif
return e._HResult;
-#elif FULL_AOT_RUNTIME
- throw new PlatformNotSupportedException ();
-#else
- return -1;
-#endif
}
[MonoTODO]
}
}
-#if NET_4_5
[Test]
public void Create ()
{
} catch (ArgumentNullException) {
}
}
-#endif
[Test]
public void DefaultComparer_UserComparable ()
Assert.IsFalse (zh2.Equals (zh1), "#2");
}
-#if NET_4_5
CountdownEvent barrier = new CountdownEvent (3);
AutoResetEvent[] evt = new AutoResetEvent [] { new AutoResetEvent (false), new AutoResetEvent (false), new AutoResetEvent (false), new AutoResetEvent (false)};
Assert.AreEqual ("$100,000.00", us_str, "#1");
Assert.AreEqual ("R$ 100.000,00", br_str, "#2");
}
-#endif
}
}
using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using System.Threading;
-#if NET_4_5
using System.Threading.Tasks;
-#endif
using NUnit.Framework;
Assert.IsTrue (ms.DisposedCalled, "After");
}
-#if NET_4_5
[Test]
public void ReadAsync ()
{
return true;
}
}
-#endif
}
}
using System;
using System.IO;
using System.Text;
-#if NET_4_5
using System.Threading.Tasks;
-#endif
using NUnit.Framework;
Assert.AreEqual (0, StreamReader.Null.ReadBlock (buffer, 0, buffer.Length));
}
-#if NET_4_5
[Test]
public void ReadLineAsync ()
{
Assert.IsTrue (result.Wait (3000), "#1");
Assert.AreEqual ("ab" + Environment.NewLine, result.Result);
}
-#endif
}
class MyStream : Stream {
Assert.IsFalse (s.CanRead, "#1");
}
-#if NET_4_5
[Test]
public void CopyAsync ()
{
} catch (AggregateException) {
}
}
-#endif
}
}
Assert.AreEqual (5, ms.Position, "#2");
}
-#if NET_4_5
[Test]
public void FlushAsync ()
{
Assert.IsTrue (t.Wait (1000), "#5");
}
-#endif
// TODO - Write - test errors, functionality tested in TestFlush.
}
Assert.IsNull (an.GetPublicKey (), "GetPublicKey");
Assert.IsNull (an.GetPublicKeyToken (), "GetPublicKeyToken");
Assert.AreEqual ("TestAssembly", an.ToString (), "ToString");
-#if NET_4_5
Assert.IsNull (an.CultureName, "CultureName");
Assert.AreEqual (AssemblyContentType.Default, an.ContentType, "ContentType");
-#endif
}
[Test] // ctor (String)
Assert.AreEqual (GetType().Assembly, a);
}
-#if NET_4_5
[Test]
public void DefinedTypes_Equality ()
{
Assert.AreSame (x1, x2, "#1");
}
-#endif
class MyAssembly : Assembly { }
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_5
using System;
using System.Reflection;
}
}
-#endif
\ No newline at end of file
Assert.AreEqual (ParamEnum.Foo, info [5].DefaultValue, "#2");
}
-#if NET_4_5
[Test]
public void HasDefaultValueEnum () {
ParameterInfo[] info = typeof (ParameterInfoTest).GetMethod ("paramMethod").GetParameters ();
Assert.IsTrue (info [5].HasDefaultValue);
}
-#endif
public static void Sample2 ([DecimalConstantAttribute(2,2,2,2,2)] decimal a, [DateTimeConstantAttribute(123456)] DateTime b) {}
Assert.AreEqual (pi [1].DefaultValue.GetType (), typeof (Missing), "#2");
}
-#if NET_4_5
[Test]
public void TestHasDefaultValues ()
{
Assert.IsFalse (pi [1].HasDefaultValue, "#2");
Assert.IsTrue (pi [2].HasDefaultValue, "#3");
}
-#endif
public void Sample (int a, [Optional] int b, object c = null)
{
Assert.AreEqual (decimal.MaxValue, info [0].DefaultValue);
}
-#if NET_4_5
[Test]
public void HasDefaultValueDecimal () {
var info = typeof (ParameterInfoTest).GetMethod ("TestC").GetParameters ();
Assert.IsTrue (info [0].HasDefaultValue);
}
-#endif
class TestParamAttribute : Attribute
{
Assert.AreEqual (0, p.GetCustomAttributes (typeof (FlagsAttribute), false).Length, "#3");
Assert.AreEqual (0, p.GetOptionalCustomModifiers ().Length, "#4");
Assert.AreEqual (0, p.GetRequiredCustomModifiers ().Length, "#5");
-#if NET_4_5
try {
var ign = p.HasDefaultValue;
Assert.Fail ("#6");
} catch (NotImplementedException) {
}
-#endif
Assert.IsFalse (p.IsIn, "#7");
#if FEATURE_USE_LCID
Assert.IsFalse (p.IsLcid, "#8");
Assert.IsFalse (p.IsOptional, "#9");
Assert.IsFalse (p.IsOut, "#10");
Assert.IsFalse (p.IsRetval, "#10");
-#if NET_4_5
try {
var ign = p.CustomAttributes;
Assert.Fail ("#11");
} catch (NotImplementedException) {
}
-#endif
try {
p.GetCustomAttributesData ();
Assert.Fail ("#12");
Assert.IsFalse (p2.IsIn, "#1");
p2.MyAttrsImpl = ParameterAttributes.In;
Assert.IsTrue (p2.IsIn, "#2");
-#if NET_4_5
Assert.AreEqual (p2.myList, p2.CustomAttributes, "#3");
-#endif
}
}
}
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_5
using System;
using System.Threading;
}
}
-#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_5
using System;
using System.Threading;
}
}
-#endif
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_5
using System;
using System.Threading;
}
}
-#endif
\ No newline at end of file
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_5
using System;
using System.Collections.Generic;
}
}
-#endif
\ No newline at end of file
}
}
#endif
+
+ [Test]
+ public void GetHRForException ()
+ {
+ Assert.AreEqual (0, Marshal.GetHRForException (null));
+ Assert.IsTrue (Marshal.GetHRForException (new Exception ()) < 0);
+ Assert.AreEqual (12345, Marshal.GetHRForException (new IOException ("test message", 12345)));
+ }
+
[Test] // bug #319009
public void StringToHGlobalUni ()
{
Assert.AreEqual (0x1234, Marshal.ReadInt16 (ptr));
Assert.AreEqual (0x1234, Marshal.ReadInt16 (ptr, 0));
Assert.AreEqual (0x4567, Marshal.ReadInt16 (ptr, 2));
-#if NET_4_5
Assert.AreEqual (0x4567, Marshal.ReadInt16 ((ptr + 5)));
-#endif
Assert.AreEqual (0x4567, Marshal.ReadInt16 (ptr, 5));
} finally {
Marshal.FreeHGlobal (ptr);
Assert.AreEqual (0x12345678, Marshal.ReadInt32 (ptr));
Assert.AreEqual (0x12345678, Marshal.ReadInt32 (ptr, 0));
Assert.AreEqual (0x77654321, Marshal.ReadInt32 (ptr, 4));
-#if NET_4_5
Assert.AreEqual (0x77654321, Marshal.ReadInt32 ((ptr + 10)));
-#endif
Assert.AreEqual (0x77654321, Marshal.ReadInt32 (ptr, 10));
} finally {
Marshal.FreeHGlobal (ptr);
// ClaimsIdentityTest.cs - NUnit Test Cases for System.Security.Claims.ClaimsIdentity
//
-#if NET_4_5
using NUnit.Framework;
using System;
}
}
-#endif
// ClaimsPrincipalTest.cs - NUnit Test Cases for System.Security.Claims.ClaimsPrincipal
//
-#if NET_4_5
using NUnit.Framework;
using System;
}
}
-#endif
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
-#if NET_4_5
using System;
using System.Threading;
}
}
-#endif
\ No newline at end of file
Assert.IsTrue (tasks[1].IsCanceled, "#4");
}
-#if NET_4_5
[Test]
public void WaitAll_CancelledAndTimeout ()
{
var t2 = Task.Delay (3000);
Assert.IsFalse (Task.WaitAll (new[] { t1, t2 }, 10));
}
-#endif
[Test]
public void WaitAllExceptionThenCancelled ()
}
}
-#if NET_4_5
[Test]
public void ContinuationOnBrokenScheduler ()
{
}
}
-#endif
}
}
[TestFixture]
public class CancellationTokenSourceTest
{
-#if NET_4_5
[Test]
public void Ctor_Invalid ()
Assert.AreEqual (0, called, "#1");
}
-#endif
[Test]
public void Token ()
} catch (ObjectDisposedException) {
}
-#if NET_4_5
try {
cts.CancelAfter (1);
Assert.Fail ("#6");
} catch (ObjectDisposedException) {
}
-#endif
}
[Test]
}
}
-#if NET_4_5
[Test]
public void DisposeRace ()
{
c1.Dispose ();
}
}
-#endif
}
}
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
-#if NET_4_5
using System;
using System.Threading;
}
}
-#endif
Assert.AreEqual (myArrSeg_1 != myArrSeg_2, true);
}
-#if NET_4_5
[Test]
public void IList_NotSupported ()
{
IList<byte> seg = new ArraySegment<byte> (arr);
seg[4] = 3;
}
-#endif
}
}
#if !MOBILE
-#if NET_4_5
[Test]
public void RedirectedTest ()
{
Console.SetError (TextWriter.Null);
Assert.IsFalse (Console.IsErrorRedirected);
}
-#endif
// Bug 678357
[Test]
Assert.IsFalse (Foo.failed);
}
-#if NET_4_5
[Test]
public void WeakReferenceT_TryGetTarget_NullTarget ()
{
object obj;
Assert.IsFalse (r.TryGetTarget (out obj), "#1");
}
-#endif
}
}
lockID = Interlocked.Increment(ref s_nextLockID);
}
-#if NET_4_5
[MethodImpl(MethodImplOptions.AggressiveInlining)]
-#endif
private static bool IsRWEntryEmpty(ReaderWriterCount rwc)
{
if (rwc.lockID == 0)
/// entry for this thread, but doesn't want to add one if an existing one
/// could not be found.
/// </summary>
-#if NET_4_5
[MethodImpl(MethodImplOptions.AggressiveInlining)]
-#endif
private ReaderWriterCount GetThreadRWCount(bool dontAllocate)
{
ReaderWriterCount rwc = t_rwc;
return owners & READER_MASK;
}
-#if NET_4_5
[MethodImpl(MethodImplOptions.AggressiveInlining)]
-#endif
private void EnterMyLock()
{
if (Interlocked.CompareExchange(ref myLock, 1, 0) != 0)
--- /dev/null
+// CS0246: The type or namespace name `Foo' could not be found. Are you missing an assembly reference?
+// Line: 8
+
+class Crashy
+{
+ void Call (System.Action<object> action) { }
+
+ public void DoCrash () => Call (f => f as Foo);
+}
eclass = ExprClass.Value;
TypeSpec etype = expr.Type;
+ if (type == null) {
+ type = InternalType.ErrorType;
+ return this;
+ }
+
if (!TypeSpec.IsReferenceType (type) && !type.IsNullableType) {
if (TypeManager.IsGenericParameter (type)) {
ec.Report.Error (413, loc,
ec.EmitInt (first_resume_pc);
ec.Emit (OpCodes.Sub);
- var labels = new Label[resume_points.Count - System.Math.Max (first_catch_resume_pc, 0)];
+ var labels = new Label [first_catch_resume_pc > 0 ? first_catch_resume_pc : resume_points.Count];
for (int i = 0; i < labels.Length; ++i)
labels[i] = resume_points[i].PrepareForEmit (ec);
ec.Emit (OpCodes.Switch, labels);
--- /dev/null
+using System;
+using System.Threading.Tasks;
+
+public class Test
+{
+ static async Task<string> AsyncWithDeepTry ()
+ {
+ try {
+ await Task.Yield ();
+
+ try {
+ await Task.Yield ();
+ } catch {
+ }
+ } catch {
+ await Task.Yield ();
+ } finally {
+ }
+
+ return null;
+ }
+
+
+ static void Main ()
+ {
+ AsyncWithDeepTry ().Wait ();
+ }
+}
</method>
</type>
</test>
+ <test name="test-async-88.cs">
+ <type name="Test">
+ <method name="System.Threading.Tasks.Task`1[System.String] AsyncWithDeepTry()" attrs="145">
+ <size>33</size>
+ </method>
+ <method name="Void Main()" attrs="145">
+ <size>12</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="Test+<AsyncWithDeepTry>c__async0">
+ <method name="Void MoveNext()" attrs="486">
+ <size>460</size>
+ </method>
+ <method name="Void SetStateMachine(System.Runtime.CompilerServices.IAsyncStateMachine)" attrs="486">
+ <size>13</size>
+ </method>
+ </type>
+ </test>
<test name="test-cls-00.cs">
<type name="CLSCLass_6">
<method name="Void add_Disposed(Delegate)" attrs="2182">
if (!(memberDefenition is MethodDefinition))
return;
- MethodDefinition mbase = (MethodDefinition) memberDefenition;
+ MethodDefinition mbase = (MethodDefinition)memberDefenition;
+
+ ParameterData parms = new ParameterData (writer, mbase.Parameters) {
+ HasExtensionParameter = mbase.CustomAttributes.Any (l => l.AttributeType.FullName == "System.Runtime.CompilerServices.ExtensionAttribute")
+ };
- ParameterData parms = new ParameterData (writer, mbase.Parameters);
parms.DoOutput ();
MemberData.OutputGenericParameters (writer, mbase);
this.parameters = parameters;
}
+ public bool HasExtensionParameter { get; set; }
+
public override void DoOutput ()
{
+ bool first = true;
writer.WriteStartElement ("parameters");
foreach (ParameterDefinition parameter in parameters) {
writer.WriteStartElement ("parameter");
AddAttribute ("position", parameter.Method.Parameters.IndexOf(parameter).ToString(CultureInfo.InvariantCulture));
AddAttribute ("attrib", ((int) parameter.Attributes).ToString());
- string direction = "in";
+ string direction = first && HasExtensionParameter ? "this" : "in";
+ first = false;
if (parameter.ParameterType is ByReferenceType)
direction = parameter.IsOut ? "out" : "ref";
if (i > 0)
change.Append (", ");
+ string mods_tgt = tgt [i].GetAttribute ("direction") ?? "";
+ string mods_src = src [i].GetAttribute ("direction") ?? "";
+
+ if (mods_tgt.Length > 0)
+ mods_tgt = mods_tgt + " ";
+
+ if (mods_src.Length > 0)
+ mods_src = mods_src + " ";
+
if (i >= srcCount) {
- change.AppendAdded (tgt [i].GetTypeName ("type") + " " + tgt [i].GetAttribute ("name"), true);
+ change.AppendAdded (mods_tgt + tgt [i].GetTypeName ("type") + " " + tgt [i].GetAttribute ("name"), true);
} else if (i >= tgtCount) {
- change.AppendRemoved (src [i].GetTypeName ("type") + " " + src [i].GetAttribute ("name"), true);
+ change.AppendRemoved (mods_src + src [i].GetTypeName ("type") + " " + src [i].GetAttribute ("name"), true);
} else {
var paramSourceType = src [i].GetTypeName ("type");
var paramTargetType = tgt [i].GetTypeName ("type");
var paramSourceName = src [i].GetAttribute ("name");
var paramTargetName = tgt [i].GetAttribute ("name");
+ if (mods_src != mods_tgt) {
+ change.AppendModified (mods_src, mods_tgt, true);
+ } else {
+ change.Append (mods_src);
+ }
+
if (paramSourceType != paramTargetType) {
change.AppendModified (paramSourceType, paramTargetType, true);
} else {
}
change.Append (" ");
if (paramSourceName != paramTargetName) {
- change.AppendModified (paramSourceName, paramTargetName, false);
+ change.AppendModified (paramSourceName, paramTargetName, true);
} else {
change.Append (paramSourceName);
}
}
}
-
+#else
+ #ifdef _MSC_VER
+ // Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+ void __mono_win32_boehm_gc_quiet_lnk4221(void) {}
+ #endif
#endif /* no Boehm GC */
struct _MonoGenericClass {
MonoClass *container_class; /* the generic type definition */
MonoGenericContext context; /* a context that contains the type instantiation doesn't contain any method instantiation */ /* FIXME: Only the class_inst member of "context" is ever used, so this field could be replaced with just a monogenericinst */
- guint is_dynamic : 1; /* We're a MonoDynamicGenericClass */
+ guint is_dynamic : 1; /* Contains dynamic types */
guint is_tb_open : 1; /* This is the fully open instantiation for a type_builder. Quite ugly, but it's temporary.*/
+ guint need_sync : 1; /* Only if dynamic. Need to be synchronized with its container class after its finished. */
MonoClass *cached_class; /* if present, the MonoClass corresponding to the instantiation. */
/*
MonoImageSet *owner;
};
-/*
- * This is used when instantiating a generic type definition which is
- * a TypeBuilder.
- */
-struct _MonoDynamicGenericClass {
- MonoGenericClass generic_class;
- int count_fields;
- MonoClassField *fields;
- guint initialized;
- /* The non-inflated types of the fields */
- MonoType **field_generic_types;
- /* The managed objects representing the fields */
- MonoObject **field_objects;
-};
-
/*
* A type parameter.
*/
ICALL_TYPE(CATTR_DATA, "System.Reflection.CustomAttributeData", CATTR_DATA_1)
ICALL(CATTR_DATA_1, "ResolveArgumentsInternal", ves_icall_System_Reflection_CustomAttributeData_ResolveArgumentsInternal)
-ICALL_TYPE(ASSEMB, "System.Reflection.Emit.AssemblyBuilder", ASSEMB_1)
-ICALL(ASSEMB_1, "InternalAddModule", ves_icall_AssemblyBuilder_InternalAddModule)
+ICALL_TYPE(ASSEMB, "System.Reflection.Emit.AssemblyBuilder", ASSEMB_2)
ICALL(ASSEMB_2, "basic_init", ves_icall_AssemblyBuilder_basic_init)
#ifndef DISABLE_REFLECTION_EMIT
ICALL_TYPE(TYPEB, "System.Reflection.Emit.TypeBuilder", TYPEB_1)
ICALL(TYPEB_1, "create_generic_class", ves_icall_TypeBuilder_create_generic_class)
-ICALL(TYPEB_2, "create_internal_class", ves_icall_TypeBuilder_create_internal_class)
ICALL(TYPEB_3, "create_runtime_class", ves_icall_TypeBuilder_create_runtime_class)
ICALL(TYPEB_4, "get_IsGenericParameter", ves_icall_TypeBuilder_get_IsGenericParameter)
ICALL(TYPEB_5, "get_event_info", ves_icall_TypeBuilder_get_event_info)
#include "lock-tracer.h"
-
/*
* This is a very simple lock trace implementation. It can be used to verify that the runtime is
* correctly following all locking rules.
{
add_record (RECORD_LOCK_RELEASED, kind, lock);
}
-
-#endif
+#else
+ #ifdef _MSC_VER
+ // Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+ void __mono_win32_lock_tracer_quiet_lnk4221(void) {}
+ #endif
+#endif /* LOCK_TRACER */
free_generic_class (MonoGenericClass *gclass)
{
/* The gclass itself is allocated from the image set mempool */
- if (gclass->is_dynamic)
- mono_reflection_free_dynamic_generic_class (gclass);
if (gclass->cached_class && gclass->cached_class->interface_id)
mono_unload_interface_id (gclass->cached_class);
}
return gclass;
}
- if (is_dynamic) {
- MonoDynamicGenericClass *dgclass = mono_image_set_new0 (set, MonoDynamicGenericClass, 1);
- gclass = &dgclass->generic_class;
+ gclass = mono_image_set_new0 (set, MonoGenericClass, 1);
+ if (is_dynamic)
gclass->is_dynamic = 1;
- } else {
- gclass = mono_image_set_new0 (set, MonoGenericClass, 1);
- }
gclass->is_tb_open = is_tb_open;
gclass->container_class = container_class;
typedef struct _MonoType MonoType;
typedef struct _MonoGenericInst MonoGenericInst;
typedef struct _MonoGenericClass MonoGenericClass;
-typedef struct _MonoDynamicGenericClass MonoDynamicGenericClass;
typedef struct _MonoGenericContext MonoGenericContext;
typedef struct _MonoGenericContainer MonoGenericContainer;
typedef struct _MonoGenericParam MonoGenericParam;
{
return TRUE;
}
-
-#endif
+#else
+ #ifdef _MSC_VER
+ // Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+ void __mono_win32_null_gc_quiet_lnk4221(void) {}
+ #endif
+#endif /* HAVE_NULL_GC */
} CattrNamedArg;
gboolean mono_image_create_pefile (MonoReflectionModuleBuilder *module, HANDLE file, MonoError *error);
-MonoReflectionModule * mono_image_load_module_dynamic (MonoReflectionAssemblyBuilder *assembly, MonoString *file_name, MonoError *error);
guint32 mono_image_insert_string (MonoReflectionModuleBuilder *module, MonoString *str);
guint32 mono_image_create_token (MonoDynamicImage *assembly, MonoObject *obj, gboolean create_methodspec, gboolean register_token, MonoError *error);
guint32 mono_image_create_method_token (MonoDynamicImage *assembly, MonoObject *obj, MonoArray *opt_param_types, MonoError *error);
void mono_reflection_setup_internal_class (MonoReflectionTypeBuilder *tb);
-void
-ves_icall_TypeBuilder_create_internal_class (MonoReflectionTypeBuilder *tb);
-
void
ves_icall_TypeBuilder_setup_generic_class (MonoReflectionTypeBuilder *tb);
MonoType*
mono_reflection_type_get_handle (MonoReflectionType *ref, MonoError *error);
-void
-mono_reflection_free_dynamic_generic_class (MonoGenericClass *gclass);
-
gboolean
mono_image_build_metadata (MonoReflectionModuleBuilder *module, MonoError *error);
res->field = field;
MONO_OBJECT_SETREF (res, name, mono_string_new (domain, mono_field_get_name (field)));
- if (mono_is_sr_field_on_inst (field)) {
- res->attrs = mono_reflection_get_field_on_inst_generic_type (field)->attrs;
-
+ if (field->type) {
rt = mono_type_get_object_checked (domain, field->type, error);
if (!mono_error_ok (error))
return NULL;
MONO_OBJECT_SETREF (res, type, rt);
- } else {
- if (field->type) {
- rt = mono_type_get_object_checked (domain, field->type, error);
- if (!mono_error_ok (error))
- return NULL;
-
- MONO_OBJECT_SETREF (res, type, rt);
- }
- res->attrs = mono_field_get_flags (field);
}
+ res->attrs = mono_field_get_flags (field);
CACHE_OBJECT (MonoReflectionField *, field, res, klass);
}
} else if (strcmp (klass->name, "MonoField") == 0) {
MonoReflectionField *f = (MonoReflectionField*)obj;
- if (mono_is_sr_field_on_inst (f->field)) {
- MonoDynamicGenericClass *dgclass = (MonoDynamicGenericClass*)f->field->parent->generic_class;
-
- if (f->field >= dgclass->fields && f->field < dgclass->fields + dgclass->count_fields) {
- int field_index = f->field - dgclass->fields;
- MonoObject *obj;
-
- g_assert (field_index >= 0 && field_index < dgclass->count_fields);
- obj = dgclass->field_objects [field_index];
- return mono_reflection_get_token_checked (obj, error);
- }
- }
token = mono_class_get_field_token (f->field);
} else if (strcmp (klass->name, "MonoProperty") == 0) {
MonoReflectionProperty *p = (MonoReflectionProperty*)obj;
*/
#include "config.h"
+
#ifdef HAVE_SGEN_GC
{
return -1;
}
-
-#endif
+#else
+ #ifdef _MSC_VER
+ // Quiet Visual Studio linker warning, LNK4221, in cases when this source file intentional ends up empty.
+ void __mono_win32_sgen_os_coop_quiet_lnk4221(void) {}
+ #endif
+#endif /* USE_COOP_GC */
#endif
gboolean
mono_is_sre_ctor_on_tb_inst (MonoClass *klass);
-gboolean
-mono_is_sr_field_on_inst (MonoClassField *field);
-
gboolean
mono_is_sr_mono_cmethod (MonoClass *klass);
MonoMethod*
mono_reflection_method_builder_to_mono_method (MonoReflectionMethodBuilder *mb, MonoError *error);
-MonoType*
-mono_reflection_get_field_on_inst_generic_type (MonoClassField *field);
-
MonoMethod*
mono_reflection_method_on_tb_inst_get_handle (MonoReflectionMethodOnTypeBuilderInst *m, MonoError *error);
} else if (!strcmp (iltoken->member->vtable->klass->name, "FieldBuilder")) {
continue;
} else if (!strcmp (iltoken->member->vtable->klass->name, "MonoField")) {
- MonoClassField *f = ((MonoReflectionField*)iltoken->member)->field;
- g_assert (mono_is_sr_field_on_inst (f));
continue;
} else if (!strcmp (iltoken->member->vtable->klass->name, "MethodBuilder") ||
!strcmp (iltoken->member->vtable->klass->name, "ConstructorBuilder")) {
static gboolean
is_field_on_inst (MonoClassField *field)
{
- return (field->parent->generic_class && field->parent->generic_class->is_dynamic && ((MonoDynamicGenericClass*)field->parent->generic_class)->fields);
+ return field->parent->generic_class && field->parent->generic_class->is_dynamic;
}
-/*
- * If FIELD is a field of a MonoDynamicGenericClass, return its non-inflated type.
- */
-static MonoType*
-get_field_on_inst_generic_type (MonoClassField *field)
-{
- MonoClass *klass, *gtd;
- MonoDynamicGenericClass *dgclass;
- int field_index;
-
- g_assert (is_field_on_inst (field));
-
- dgclass = (MonoDynamicGenericClass*)field->parent->generic_class;
-
- if (field >= dgclass->fields && field - dgclass->fields < dgclass->count_fields) {
- field_index = field - dgclass->fields;
- return dgclass->field_generic_types [field_index];
- }
-
- klass = field->parent;
- gtd = klass->generic_class->container_class;
-
- if (field >= klass->fields && field - klass->fields < klass->field.count) {
- field_index = field - klass->fields;
- return gtd->fields [field_index].type;
- }
-
- g_assert_not_reached ();
- return 0;
-}
-
-#ifndef DISABLE_REFLECTION_EMIT
-gboolean
-mono_is_sr_field_on_inst (MonoClassField *field)
-{
- return is_field_on_inst (field);
-}
-#else
-gboolean
-mono_is_sr_field_on_inst (MonoClassField *field)
-{
- return FALSE;
-}
-#endif /*DISABLE_REFLECTION_EMIT*/
-
-#ifndef DISABLE_REFLECTION_EMIT
-MonoType*
-mono_reflection_get_field_on_inst_generic_type (MonoClassField *field)
-{
- return get_field_on_inst_generic_type (field);
-}
-#else
-MonoType*
-mono_reflection_get_field_on_inst_generic_type (MonoClassField *field)
-{
- g_assert_not_reached ();
- return NULL;
-}
-#endif /* DISABLE_REFLECTION_EMIT */
-
#ifndef DISABLE_REFLECTION_EMIT
static guint32
mono_image_get_fieldref_token (MonoDynamicImage *assembly, MonoObject *f, MonoClassField *field)
int index = field - field->parent->fields;
type = mono_field_get_type (&field->parent->generic_class->container_class->fields [index]);
} else {
- if (is_field_on_inst (field))
- type = get_field_on_inst_generic_type (field);
- else
- type = mono_field_get_type (field);
+ type = mono_field_get_type (field);
}
token = mono_image_get_memberref_token (assembly, &field->parent->byval_arg,
mono_field_get_name (field),
#endif /* !DISABLE_REFLECTION_EMIT */
-#ifndef DISABLE_REFLECTION_EMIT
-
-MonoReflectionModule *
-mono_image_load_module_dynamic (MonoReflectionAssemblyBuilder *ab, MonoString *fileName, MonoError *error)
-{
- char *name;
- MonoImage *image;
- MonoImageOpenStatus status;
- MonoDynamicAssembly *assembly;
- guint32 module_count;
- MonoImage **new_modules;
- gboolean *new_modules_loaded;
-
- mono_error_init (error);
-
- name = mono_string_to_utf8_checked (fileName, error);
- return_val_if_nok (error, NULL);
-
- image = mono_image_open (name, &status);
- if (!image) {
- if (status == MONO_IMAGE_ERROR_ERRNO)
- mono_error_set_exception_instance (error, mono_get_exception_file_not_found (fileName));
- else
- mono_error_set_bad_image_name (error, name, NULL);
- g_free (name);
- return NULL;
- }
-
- g_free (name);
-
- assembly = ab->dynamic_assembly;
- image->assembly = (MonoAssembly*)assembly;
-
- module_count = image->assembly->image->module_count;
- new_modules = g_new0 (MonoImage *, module_count + 1);
- new_modules_loaded = g_new0 (gboolean, module_count + 1);
-
- if (image->assembly->image->modules)
- memcpy (new_modules, image->assembly->image->modules, module_count * sizeof (MonoImage *));
- if (image->assembly->image->modules_loaded)
- memcpy (new_modules_loaded, image->assembly->image->modules_loaded, module_count * sizeof (gboolean));
- new_modules [module_count] = image;
- new_modules_loaded [module_count] = TRUE;
- mono_image_addref (image);
-
- g_free (image->assembly->image->modules);
- image->assembly->image->modules = new_modules;
- image->assembly->image->modules_loaded = new_modules_loaded;
- image->assembly->image->module_count ++;
-
- mono_assembly_load_references (image, &status);
- if (status) {
- mono_image_close (image);
- mono_error_set_exception_instance (error, mono_get_exception_file_not_found (fileName));
- return NULL;
- }
-
- return mono_module_get_object_checked (mono_domain_get (), image, error);
-}
-
-#endif /* DISABLE_REFLECTION_EMIT */
-
#ifndef DISABLE_REFLECTION_EMIT
static gpointer
register_assembly (MonoDomain *domain, MonoReflectionAssembly *res, MonoAssembly *assembly)
return TRUE;
}
-/**
- * reflection_create_internal_class:
- * @tb: a TypeBuilder object
- * @error: set on error
- *
- * Actually create the MonoClass that is associated with the TypeBuilder.
- * On success returns TRUE, on failure returns FALSE and sets @error.
- *
- */
-static gboolean
-reflection_create_internal_class (MonoReflectionTypeBuilder *tb, MonoError *error)
-{
- MonoClass *klass;
-
- mono_error_init (error);
- klass = mono_class_from_mono_type (tb->type.type);
-
- mono_loader_lock ();
- if (klass->enumtype && mono_class_enum_basetype (klass) == NULL) {
- MonoReflectionFieldBuilder *fb;
- MonoClass *ec;
- MonoType *enum_basetype;
-
- g_assert (tb->fields != NULL);
- g_assert (mono_array_length (tb->fields) >= 1);
-
- fb = mono_array_get (tb->fields, MonoReflectionFieldBuilder*, 0);
-
- MonoType *field_type = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
- if (!is_ok (error)) {
- mono_loader_unlock ();
- return FALSE;
- }
- if (!mono_type_is_valid_enum_basetype (field_type)) {
- mono_loader_unlock ();
- return TRUE;
- }
-
- enum_basetype = mono_reflection_type_get_handle ((MonoReflectionType*)fb->type, error);
- if (!is_ok (error)) {
- mono_loader_unlock ();
- return FALSE;
- }
- klass->element_class = mono_class_from_mono_type (enum_basetype);
- if (!klass->element_class)
- klass->element_class = mono_class_from_mono_type (enum_basetype);
-
- /*
- * get the element_class from the current corlib.
- */
- ec = default_class_from_mono_type (enum_basetype);
- klass->instance_size = ec->instance_size;
- klass->size_inited = 1;
- /*
- * this is almost safe to do with enums and it's needed to be able
- * to create objects of the enum type (for use in SetConstant).
- */
- /* FIXME: Does this mean enums can't have method overrides ? */
- mono_class_setup_vtable_general (klass, NULL, 0, NULL);
- }
- mono_loader_unlock ();
- return TRUE;
-}
-
-/**
- * ves_icall_TypeBuilder_create_internal_class:
- * @tb: a TypeBuilder object
- *
- * (icall)
- * Actually create the MonoClass that is associated with the TypeBuilder.
- */
-void
-ves_icall_TypeBuilder_create_internal_class (MonoReflectionTypeBuilder *tb)
-{
- MonoError error;
- (void) reflection_create_internal_class (tb, &error);
- mono_error_set_pending_exception (&error);
-}
-
static MonoMarshalSpec*
mono_marshal_spec_from_builder (MonoImage *image, MonoAssembly *assembly,
MonoReflectionMarshal *minfo, MonoError *error)
return inflate_mono_method (mono_class_from_mono_type (t), method, obj);
}
-/*TODO avoid saving custom attrs for generic classes as it's enough to have them on the generic type definition.*/
-static gboolean
-reflection_generic_class_initialize (MonoReflectionGenericClass *type, MonoArray *fields, MonoError *error)
+static void
+reflection_generic_class_initialize (MonoReflectionGenericClass *type, MonoError *error)
{
MonoGenericClass *gclass;
- MonoDynamicGenericClass *dgclass;
MonoClass *klass, *gklass;
MonoType *gtype;
- int i;
mono_error_init (error);
gtype = mono_reflection_type_get_handle ((MonoReflectionType*)type, error);
- return_val_if_nok (error, FALSE);
+ return_if_nok (error);
klass = mono_class_from_mono_type (gtype);
g_assert (gtype->type == MONO_TYPE_GENERICINST);
gclass = gtype->data.generic_class;
if (!gclass->is_dynamic)
- return TRUE;
-
- dgclass = (MonoDynamicGenericClass *) gclass;
-
- if (dgclass->initialized)
- return TRUE;
+ return;
gklass = gclass->container_class;
mono_class_init (gklass);
- dgclass->count_fields = fields ? mono_array_length (fields) : 0;
-
- dgclass->fields = mono_image_set_new0 (gclass->owner, MonoClassField, dgclass->count_fields);
- dgclass->field_objects = mono_image_set_new0 (gclass->owner, MonoObject*, dgclass->count_fields);
- dgclass->field_generic_types = mono_image_set_new0 (gclass->owner, MonoType*, dgclass->count_fields);
-
- for (i = 0; i < dgclass->count_fields; i++) {
- MonoObject *obj = (MonoObject *)mono_array_get (fields, gpointer, i);
- MonoClassField *field, *inflated_field = NULL;
-
- if (!strcmp (obj->vtable->klass->name, "FieldBuilder")) {
- inflated_field = field = fieldbuilder_to_mono_class_field (klass, (MonoReflectionFieldBuilder *) obj, error);
- return_val_if_nok (error, FALSE);
- } else if (!strcmp (obj->vtable->klass->name, "MonoField"))
- field = ((MonoReflectionField *) obj)->field;
- else {
- field = NULL; /* prevent compiler warning */
- g_assert_not_reached ();
- }
-
- dgclass->fields [i] = *field;
- dgclass->fields [i].parent = klass;
- dgclass->fields [i].type = mono_class_inflate_generic_type_checked (
- field->type, mono_generic_class_get_context ((MonoGenericClass *) dgclass), error);
- mono_error_assert_ok (error); /* FIXME don't swallow the error */
- dgclass->field_generic_types [i] = field->type;
- MONO_GC_REGISTER_ROOT_IF_MOVING (dgclass->field_objects [i], MONO_ROOT_SOURCE_REFLECTION, "dynamic generic class field object");
- dgclass->field_objects [i] = obj;
-
- if (inflated_field) {
- g_free (inflated_field);
- } else {
- dgclass->fields [i].name = mono_image_set_strdup (gclass->owner, dgclass->fields [i].name);
- }
- }
-
- dgclass->initialized = TRUE;
- return TRUE;
+ /* Mark this as needing synchronization with its generic container */
+ gclass->need_sync = TRUE;
}
void
mono_reflection_generic_class_initialize (MonoReflectionGenericClass *type, MonoArray *fields)
{
MonoError error;
- (void) reflection_generic_class_initialize (type, fields, &error);
+ reflection_generic_class_initialize (type, &error);
mono_error_set_pending_exception (&error);
}
-void
-mono_reflection_free_dynamic_generic_class (MonoGenericClass *gclass)
-{
- MonoDynamicGenericClass *dgclass;
- int i;
-
- g_assert (gclass->is_dynamic);
-
- dgclass = (MonoDynamicGenericClass *)gclass;
-
- for (i = 0; i < dgclass->count_fields; ++i) {
- MonoClassField *field = dgclass->fields + i;
- mono_metadata_free_type (field->type);
- MONO_GC_UNREGISTER_ROOT_IF_MOVING (dgclass->field_objects [i]);
- }
-}
-
/**
* fix_partial_generic_class:
* @klass: a generic instantiation MonoClass
* @error: set on error
*
* Assumes that the generic container of @klass has its vtable
- * initialized, and updates the parent class, insterfaces, methods and
+ * initialized, and updates the parent class, interfaces, methods and
* fields of @klass by inflating the types using the generic context.
*
* On success returns TRUE, on failure returns FALSE and sets @error.
fix_partial_generic_class (MonoClass *klass, MonoError *error)
{
MonoClass *gklass = klass->generic_class->container_class;
- MonoDynamicGenericClass *dgclass;
int i;
mono_error_init (error);
if (klass->wastypebuilder)
return TRUE;
- dgclass = (MonoDynamicGenericClass *) klass->generic_class;
if (klass->parent != gklass->parent) {
MonoType *parent_type = mono_class_inflate_generic_type_checked (&gklass->parent->byval_arg, &klass->generic_class->context, error);
if (mono_error_ok (error)) {
}
}
- if (!dgclass->initialized)
+ if (!klass->generic_class->need_sync)
return TRUE;
if (klass->method.count != gklass->method.count) {
g_assert_not_reached ();
}
-MonoReflectionModule *
-mono_image_load_module_dynamic (MonoReflectionAssemblyBuilder *ab, MonoString *fileName, MonoError *error)
-{
- g_assert_not_reached ();
- return NULL;
-}
-
guint32
mono_image_insert_string (MonoReflectionModuleBuilder *module, MonoString *str)
{
return ref->type;
}
-void
-mono_reflection_free_dynamic_generic_class (MonoGenericClass *gclass)
-{
- g_assert_not_reached ();
-}
-
#endif /* DISABLE_REFLECTION_EMIT */
#ifndef DISABLE_REFLECTION_EMIT
return obj;
}
-MonoReflectionModule*
-ves_icall_AssemblyBuilder_InternalAddModule (MonoReflectionAssemblyBuilder *ab, MonoString *fileName)
-{
- MonoError error;
- MonoReflectionModule *result = mono_image_load_module_dynamic (ab, fileName, &error);
- mono_error_set_pending_exception (&error);
- return result;
-}
-
/**
* ves_icall_TypeBuilder_create_generic_class:
* @tb: a TypeBuilder object
MonoThreadInfo *info;
MonoInternalThread *thread;
MonoThread *current_thread;
- HANDLE thread_handle;
MonoNativeThreadId tid;
if ((thread = mono_thread_internal_current ())) {
g_error ("Thread %"G_GSIZE_FORMAT" calling into managed code is not registered with the GC. On UNIX, this can be fixed by #include-ing <gc.h> before <pthread.h> in the file containing the thread creation code.", mono_native_thread_id_get ());
}
- thread = create_internal_thread ();
-
- thread_handle = mono_thread_info_open_handle ();
- g_assert (thread_handle);
+ info = mono_thread_info_current ();
tid=mono_native_thread_id_get ();
- thread->handle = thread_handle;
+ thread = create_internal_thread ();
+ thread->handle = mono_thread_info_get_handle (info);
thread->tid = MONO_NATIVE_THREAD_ID_TO_UINT (tid);
thread->stack_ptr = &tid;
- THREAD_DEBUG (g_message ("%s: Attached thread ID %"G_GSIZE_FORMAT" (handle %p)", __func__, tid, thread_handle));
+ THREAD_DEBUG (g_message ("%s: Attached thread ID %"G_GSIZE_FORMAT" (handle %p)", __func__, tid, thread->handle));
- info = mono_thread_info_current ();
- g_assert (info);
thread->thread_info = info;
thread->small_id = info->small_id;
EXTRA_DIST = TestDriver.cs \
TestHelpers.cs \
genmdesc.pl \
- emitnunit.pl \
$(test_sources) \
$(x86_sources) cpu-x86.md \
$(amd64_sources) cpu-amd64.md \
case OP_LOADU4_MEMBASE:
case OP_LOADI1_MEMBASE:
case OP_LOADI8_MEMBASE:
+#ifndef MONO_ARCH_SOFT_FLOAT_FALLBACK
case OP_LOADR4_MEMBASE:
+#endif
case OP_LOADR8_MEMBASE:
if (ins->inst_offset != 0)
continue;
case OP_STOREI2_MEMBASE_REG:
case OP_STOREI4_MEMBASE_REG:
case OP_STOREI8_MEMBASE_REG:
+#ifndef MONO_ARCH_SOFT_FLOAT_FALLBACK
case OP_STORER4_MEMBASE_REG:
+#endif
case OP_STORER8_MEMBASE_REG:
case OP_STOREV_MEMBASE:
if (ins->inst_offset != 0)
}
}
- if (!(is_llvm_code (amodule, code) && (amodule->info.flags & MONO_AOT_FILE_FLAG_LLVM_ONLY))) {
+ if (!(is_llvm_code (amodule, code) && (amodule->info.flags & MONO_AOT_FILE_FLAG_LLVM_ONLY)) ||
+ (mono_llvm_only && method && method->wrapper_type == MONO_WRAPPER_NATIVE_TO_MANAGED)) {
res = init_method (amodule, method_index, method, NULL, NULL, error);
if (!res)
goto cleanup;
int op_noimm = mono_op_imm_to_op (ins->opcode);
MonoJitICallInfo *info;
+ /*
+ * These opcodes don't have logical equivalence to the emulating native
+ * function. They are decomposed in specific fashion in mono_decompose_soft_float.
+ */
+ if (MONO_HAS_CUSTOM_EMULATION (ins))
+ continue;
+
/*
* Emulation can't handle _IMM ops. If this is an imm opcode we need
* to check whether its non-imm counterpart is emulated and, if so,
#include <config.h>
#include <fcntl.h>
#include <mono/metadata/assembly.h>
+#include <mono/metadata/mono-config.h>
#include <mono/utils/mono-mmap.h>
#include "mini.h"
char *aname = g_strdup (config);
aname [strlen(aname)-strlen(".config")] = 0;
mono_register_config_for_assembly (aname, config);
- } else if (strncmp (kind, "system_config:", strlen ("system_config:")) == 0){
- printf ("TODO s-Found: %s %llx\n", kind, (long long)offset);
+ } else if (strncmp (kind, "systemconfig:", strlen ("systemconfig:")) == 0){
+ mono_config_parse_memory (kind + strlen ("systemconfig:"));
} else if (strncmp (kind, "options:", strlen ("options:")) == 0){
mono_parse_options_from (kind + strlen("options:"), ref_argc, ref_argv);
} else if (strncmp (kind, "config_dir:", strlen ("config_dir:")) == 0){
- printf ("TODO Found: %s %llx\n", kind, (long long)offset);
+ mono_set_dirs (getenv ("MONO_PATH"), kind + strlen ("config_dir:"));
+ } else if (strncmp (kind, "machineconfig:", strlen ("machineconfig:")) == 0) {
+ mono_register_machine_config (kind + strlen ("machineconfig:"));
} else {
fprintf (stderr, "Unknown stream on embedded package: %s\n", kind);
exit (1);
info->fields [i].mspec,
&align, TRUE, unicode);
fields [index].offset = offset + info->fields [i].offset;
+ if (i == info->num_fields - 1 && fields [index].size + fields [index].offset < info->native_size) {
+ /* This can happen with .pack directives eg. 'fixed' arrays */
+ fields [index].size = info->native_size - fields [index].offset;
+ }
index ++;
}
}
ctx->module->max_method_idx = MAX (ctx->module->max_method_idx, cfg->method_index);
// FIXME: beforefieldinit
- if (ctx->has_got_access || mono_class_get_cctor (cfg->method->klass)) {
+ /*
+ * NATIVE_TO_MANAGED methods might be called on a thread not attached to the runtime, so they are initialized when loaded
+ * in load_method ().
+ */
+ if ((ctx->has_got_access || mono_class_get_cctor (cfg->method->klass)) && !(cfg->method->wrapper_type == MONO_WRAPPER_NATIVE_TO_MANAGED)) {
/*
* linkonce methods shouldn't have initialization,
* because they might belong to assemblies which
if (strcmp ("nfloat", klass->name) == 0) {
magic_nfloat_class = klass;
+
+ /* Assert that we are using the matching assembly */
+ MonoClassField *value_field = mono_class_get_field_from_name (klass, "v");
+ g_assert (value_field);
+ MonoType *t = mono_field_get_type (value_field);
+ g_assert (t->type == mini_native_type_replace_type (&klass->byval_arg)->type);
+
return TRUE;
}
return FALSE;
#define MONO_IS_SETCC(ins) ((((ins)->opcode >= OP_CEQ) && ((ins)->opcode <= OP_CLT_UN)) || (((ins)->opcode >= OP_ICEQ) && ((ins)->opcode <= OP_ICLE_UN)) || (((ins)->opcode >= OP_LCEQ) && ((ins)->opcode <= OP_LCLT_UN)) || (((ins)->opcode >= OP_FCEQ) && ((ins)->opcode <= OP_FCLT_UN)))
+#define MONO_HAS_CUSTOM_EMULATION(ins) (((ins)->opcode >= OP_FBEQ && (ins)->opcode <= OP_FBLT_UN) || ((ins)->opcode >= OP_FCEQ && (ins)->opcode <= OP_FCLT_UN))
#define MONO_IS_LOAD_MEMBASE(ins) (((ins)->opcode >= OP_LOAD_MEMBASE && (ins)->opcode <= OP_LOADV_MEMBASE) || ((ins)->opcode >= OP_ATOMIC_LOAD_I1 && (ins)->opcode <= OP_ATOMIC_LOAD_R8))
#define MONO_IS_STORE_MEMBASE(ins) (((ins)->opcode >= OP_STORE_MEMBASE_REG && (ins)->opcode <= OP_STOREV_MEMBASE) || ((ins)->opcode >= OP_ATOMIC_STORE_I1 && (ins)->opcode <= OP_ATOMIC_STORE_R8))
return sa4;
}
+typedef struct {
+ int array [3];
+} FixedArrayStruct;
+
+LIBTEST_API int STDCALL
+mono_test_marshal_fixed_array (FixedArrayStruct s)
+{
+ return s.array [0] + s.array [1] + s.array [2];
+}
using System.Runtime.CompilerServices;
using System.Reflection.Emit;
-public class Tests {
+public unsafe class Tests {
public int int_field;
else
return 0;
}
+
+ [StructLayout(LayoutKind.Explicit, Size = 12)]
+ public struct FixedArrayStruct {
+ [FieldOffset(0)]
+ public fixed int array[3];
+ }
+
+ [DllImport ("libtest", EntryPoint="mono_test_marshal_fixed_array")]
+ public static extern int mono_test_marshal_fixed_array (FixedArrayStruct s);
+
+ public static unsafe int test_6_fixed_array_struct () {
+ var s = new FixedArrayStruct ();
+ s.array [0] = 1;
+ s.array [1] = 2;
+ s.array [2] = 3;
+
+ return mono_test_marshal_fixed_array (s);
+ }
}
mono_threads_platform_set_exited (info);
}
-HANDLE
-mono_threads_platform_open_handle (void)
-{
- MonoThreadInfo *info;
-
- info = mono_thread_info_current ();
- g_assert (info);
- g_assert (info->handle);
-
- mono_w32handle_ref (info->handle);
-
- return info->handle;
-}
-
int
mono_threads_get_max_stack_size (void)
{
{
}
-HANDLE
-mono_threads_platform_open_handle (void)
-{
- HANDLE thread_handle;
-
- thread_handle = GetCurrentThread ();
- g_assert (thread_handle);
-
- /*
- * The handle returned by GetCurrentThread () is a pseudo handle, so it can't be used to
- * refer to the thread from other threads for things like aborting.
- */
- DuplicateHandle (GetCurrentProcess (), thread_handle, GetCurrentProcess (), &thread_handle,
- THREAD_ALL_ACCESS, TRUE, 0);
-
- return thread_handle;
-}
-
int
mono_threads_get_max_stack_size (void)
{
mono_threads_platform_exit (0);
}
-/*
- * mono_thread_info_open_handle:
- *
- * Return a io-layer/win32 handle for the current thread.
- * The handle need to be closed by calling CloseHandle () when it is no
- * longer needed.
- */
-HANDLE
-mono_thread_info_open_handle (void)
-{
- return mono_threads_platform_open_handle ();
-}
-
/*
* mono_threads_open_thread_handle:
*
void
mono_thread_info_exit (void);
-HANDLE
-mono_thread_info_open_handle (void);
-
void
mono_thread_info_set_exited (THREAD_INFO_TYPE *info);
void mono_threads_platform_get_stack_bounds (guint8 **staddr, size_t *stsize);
gboolean mono_threads_platform_yield (void);
void mono_threads_platform_exit (int exit_code);
-HANDLE mono_threads_platform_open_handle (void);
HANDLE mono_threads_platform_open_thread_handle (HANDLE handle, MonoNativeThreadId tid);
void mono_threads_platform_set_exited (THREAD_INFO_TYPE *info);
void mono_threads_platform_describe (THREAD_INFO_TYPE *info, GString *text);
-<?xml version="1.0" encoding="utf-8"?>\r
+<?xml version="1.0" encoding="utf-8"?>\r
<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
<ItemGroup Label="ProjectConfigurations">\r
<ProjectConfiguration Include="Debug|Win32">\r
<ClCompile Include="..\mono\metadata\mono-security.c" />\r
<ClCompile Include="..\mono\metadata\seq-points-data.c" />\r
<ClCompile Include="..\mono\metadata\sgen-mono.c" />\r
+ <ClCompile Include="..\mono\metadata\sgen-os-coop.c" />\r
<ClCompile Include="..\mono\metadata\threadpool-ms-io.c" />\r
<ClCompile Include="..\mono\metadata\threadpool-ms.c" />\r
<ClCompile Include="..\mono\metadata\sgen-bridge.c" />\r
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />\r
<ImportGroup Label="ExtensionTargets">\r
</ImportGroup>\r
-</Project>\r
+</Project>
\ No newline at end of file
<ClCompile Include="..\mono\metadata\metadata-cross-helpers.c">\r
<Filter>Source Files</Filter>\r
</ClCompile>\r
+ <ClCompile Include="..\mono\metadata\custom-attrs.c">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\mono\metadata\dynamic-image.c">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\mono\metadata\dynamic-stream.c">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\mono\metadata\sre.c">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\mono\metadata\sre-encode.c">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\mono\metadata\sre-save.c">\r
+ <Filter>Source Files</Filter>\r
+ </ClCompile>\r
+ <ClCompile Include="..\mono\metadata\sgen-os-coop.c">\r
+ <Filter>Source Files\sgen</Filter>\r
+ </ClCompile>\r
</ItemGroup>\r
<ItemGroup>\r
<ClInclude Include="..\mono\metadata\appdomain.h">\r
<ClInclude Include="..\mono\metadata\gc-internals.h">\r
<Filter>Header Files\gc</Filter>\r
</ClInclude>\r
+ <ClInclude Include="..\mono\metadata\custom-attrs-internals.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\mono\metadata\dynamic-image-internals.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\mono\metadata\dynamic-stream-internals.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\mono\metadata\reflection-cache.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\mono\metadata\reflection-internals.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
+ <ClInclude Include="..\mono\metadata\sre-internals.h">\r
+ <Filter>Header Files</Filter>\r
+ </ClInclude>\r
</ItemGroup>\r
<ItemGroup>\r
<Filter Include="Header Files">\r