Imported Upstream version 3.6.0

Former-commit-id: da6be194a6b1221998fc28233f2503bd61dd9d14
This commit is contained in:
Jo Shields
2014-08-13 10:39:27 +01:00
commit a575963da9
50588 changed files with 8155799 additions and 0 deletions

View File

@@ -0,0 +1,63 @@
//
// System.AccessViolationException.cs
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
namespace System
{
[ComVisible(true)]
[Serializable]
public class AccessViolationException : SystemException
{
const int Result = unchecked ((int)0x80004003);
// Constructors
public AccessViolationException ()
: base (Locale.GetText ("Attempted to read or write protected memory. This is often an indication that other memory has been corrupted."))
{
HResult = Result;
}
public AccessViolationException (string message)
: base (message)
{
HResult = Result;
}
public AccessViolationException (string message, Exception innerException)
: base (message, innerException)
{
HResult = Result;
}
protected AccessViolationException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
}
}
}

View File

@@ -0,0 +1,75 @@
//
// Action.cs
//
// Authors:
// Ben Maurer (bmaurer@ximian.com)
// Marek Safar (marek.safar@gmail.com)
//
// Copyright (C) 2004, 2010 Novell
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.CompilerServices;
namespace System
{
#if NET_4_0
#if MOBILE
[TypeForwardedFrom (Consts.AssemblySystem_Core)]
#elif NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
#endif
public delegate void Action ();
public delegate void Action <in T> (T obj);
#if MOBILE
[TypeForwardedFrom (Consts.AssemblySystem_Core)]
#elif NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
#endif
public delegate void Action <in T1, in T2> (T1 arg1, T2 arg2);
#if MOBILE
[TypeForwardedFrom (Consts.AssemblySystem_Core)]
#elif NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
#endif
public delegate void Action <in T1, in T2, in T3> (T1 arg1, T2 arg2, T3 arg3);
#if MOBILE
[TypeForwardedFrom (Consts.AssemblySystem_Core)]
#elif NET_4_0
[TypeForwardedFrom (Consts.AssemblySystemCore_3_5)]
#endif
public delegate void Action <in T1, in T2, in T3, in T4> (T1 arg1, T2 arg2, T3 arg3, T4 arg4);
public delegate void Action <in T1, in T2, in T3, in T4, in T5> (T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5);
public delegate void Action <in T1, in T2, in T3, in T4, in T5, in T6> (T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6);
public delegate void Action <in T1, in T2, in T3, in T4, in T5, in T6, in T7> (T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7);
public delegate void Action <in T1, in T2, in T3, in T4, in T5, in T6, in T7, in T8> (T1 arg1, T2 arg2, T3 arg3, T4 arg4, T5 arg5, T6 arg6, T7 arg7, T8 arg8);
#else
public delegate void Action <T> (T obj);
// Used internally
delegate void Action <T1, T2, T3> (T1 arg1, T2 arg2, T3 arg3);
#endif
}

View File

@@ -0,0 +1,120 @@
//
// System.ActivationContext class
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System {
[Serializable]
[ComVisible (false)]
public sealed class ActivationContext : IDisposable, ISerializable {
public enum ContextForm {
Loose,
StoreBounded
}
private ApplicationIdentity _appid;
// FIXME:
#pragma warning disable 649
private ContextForm _form;
#pragma warning restore 649
private bool _disposed;
private ActivationContext (ApplicationIdentity identity)
{
_appid = identity;
}
~ActivationContext ()
{
Dispose (false);
}
public ContextForm Form {
get { return _form; }
}
public ApplicationIdentity Identity {
get { return _appid; }
}
[MonoTODO ("Missing validation")]
static public ActivationContext CreatePartialActivationContext (ApplicationIdentity identity)
{
if (identity == null)
throw new ArgumentNullException ("identity");
// TODO - throw new ArgumentException
// - for invalid ApplicationIdentity
return new ActivationContext (identity);
}
[MonoTODO("Missing validation")]
static public ActivationContext CreatePartialActivationContext (ApplicationIdentity identity, string[] manifestPaths)
{
if (identity == null)
throw new ArgumentNullException ("identity");
if (manifestPaths == null)
throw new ArgumentNullException ("manifestPaths");
// TODO - throw new ArgumentException
// - for invalid ApplicationIdentity
// - not matching manifests
// - number components != # manifest paths
return new ActivationContext (identity);
}
public void Dispose ()
{
Dispose (true);
GC.SuppressFinalize (this);
}
void Dispose (bool disposing)
{
if (_disposed) {
if (disposing) {
}
_disposed = true;
}
}
[MonoTODO("Missing serialization support")]
void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException ("info");
}
}
}

View File

@@ -0,0 +1,447 @@
//
// System.Activator.cs
//
// Authors:
// Nick Drochak II (ndrochak@gol.com)
// Gonzalo Paniagua (gonzalo@ximian.com)
// Marek Safar (marek.safar@gmail.com)
//
// (C) 2001 Nick Drochak II
// (c) 2002 Ximian, Inc. (http://www.ximian.com)
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
// Copyright (C) 2013 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security.Permissions;
using System.Security.Policy;
using System.Configuration.Assemblies;
using System.Text;
using System.Runtime.Remoting;
using System.Runtime.Remoting.Activation;
namespace System
{
[ClassInterface (ClassInterfaceType.None)]
[ComVisible (true)]
[ComDefaultInterface (typeof (_Activator))]
public sealed class Activator : _Activator
{
const BindingFlags _flags = BindingFlags.CreateInstance | BindingFlags.Public | BindingFlags.Instance;
const BindingFlags _accessFlags = BindingFlags.DeclaredOnly | BindingFlags.FlattenHierarchy | BindingFlags.IgnoreCase |
BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public |
BindingFlags.Static;
private Activator ()
{
}
[MonoTODO ("No COM support")]
public static ObjectHandle CreateComInstanceFrom (string assemblyName, string typeName)
{
if (assemblyName == null)
throw new ArgumentNullException ("assemblyName");
if (typeName == null)
throw new ArgumentNullException ("typeName");
if (assemblyName.Length == 0)
throw new ArgumentException ("assemblyName");
throw new NotImplementedException();
}
[MonoTODO("Mono does not support COM")]
public static ObjectHandle CreateComInstanceFrom (string assemblyName, string typeName,
byte []hashValue, AssemblyHashAlgorithm hashAlgorithm)
{
if (assemblyName == null)
throw new ArgumentNullException ("assemblyName");
if (typeName == null)
throw new ArgumentNullException ("typeName");
if (assemblyName.Length == 0)
throw new ArgumentException ("assemblyName");
throw new NotImplementedException();
}
public static ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName)
{
return CreateInstanceFrom (assemblyFile, typeName, null);
}
public static ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName, object [] activationAttributes)
{
return Activator.CreateInstanceFrom (assemblyFile, typeName, false, _flags, null, null, null,
activationAttributes, null);
}
#if NET_4_0
[Obsolete]
#endif
public static ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName, bool ignoreCase,
BindingFlags bindingAttr, Binder binder, object [] args,
CultureInfo culture, object [] activationAttributes,
Evidence securityInfo)
{
Assembly assembly = Assembly.LoadFrom (assemblyFile, securityInfo);
if (assembly == null)
return null;
Type type = assembly.GetType (typeName, true, ignoreCase);
if (type == null)
return null;
object obj = CreateInstance (type, bindingAttr, binder, args, culture, activationAttributes);
return (obj != null) ? new ObjectHandle (obj) : null;
}
public static ObjectHandle CreateInstance (string assemblyName, string typeName)
{
if (assemblyName == null)
assemblyName = Assembly.GetCallingAssembly ().GetName ().Name;
return Activator.CreateInstance (assemblyName, typeName, null);
}
public static ObjectHandle CreateInstance (string assemblyName, string typeName, object [] activationAttributes)
{
if (assemblyName == null)
assemblyName = Assembly.GetCallingAssembly ().GetName ().Name;
return Activator.CreateInstance (assemblyName, typeName, false, _flags, null, null, null,
activationAttributes, null);
}
#if NET_4_0
[Obsolete]
#endif
public static ObjectHandle CreateInstance (string assemblyName, string typeName, bool ignoreCase,
BindingFlags bindingAttr, Binder binder, object [] args,
CultureInfo culture, object [] activationAttributes, Evidence securityInfo)
{
Assembly assembly = null;
if(assemblyName == null)
assembly = Assembly.GetCallingAssembly ();
else
assembly = Assembly.Load (assemblyName, securityInfo);
Type type = assembly.GetType (typeName, true, ignoreCase);
object obj = CreateInstance (type, bindingAttr, binder, args, culture, activationAttributes);
return (obj != null) ? new ObjectHandle (obj) : null;
}
[MonoNotSupported ("no ClickOnce in mono")]
public static ObjectHandle CreateInstance (ActivationContext activationContext)
{
throw new NotImplementedException ();
}
[MonoNotSupported ("no ClickOnce in mono")]
public static ObjectHandle CreateInstance (ActivationContext activationContext, string [] activationCustomData)
{
throw new NotImplementedException ();
}
// Cross-domain instance creation
public static ObjectHandle CreateInstanceFrom (AppDomain domain, string assemblyFile, string typeName)
{
if (domain == null)
throw new ArgumentNullException ("domain");
return domain.CreateInstanceFrom (assemblyFile, typeName);
}
#if NET_4_0
[Obsolete]
#endif
public static ObjectHandle CreateInstanceFrom (AppDomain domain, string assemblyFile, string typeName,
bool ignoreCase, BindingFlags bindingAttr, Binder binder,
object [] args, CultureInfo culture,
object [] activationAttributes,
Evidence securityAttributes)
{
if (domain == null)
throw new ArgumentNullException ("domain");
return domain.CreateInstanceFrom (assemblyFile, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityAttributes);
}
public static ObjectHandle CreateInstance (AppDomain domain, string assemblyName, string typeName)
{
if (domain == null)
throw new ArgumentNullException ("domain");
return domain.CreateInstance (assemblyName, typeName);
}
#if NET_4_0
[Obsolete]
#endif
public static ObjectHandle CreateInstance (AppDomain domain, string assemblyName, string typeName,
bool ignoreCase, BindingFlags bindingAttr, Binder binder,
object [] args, CultureInfo culture,
object [] activationAttributes,
Evidence securityAttributes)
{
if (domain == null)
throw new ArgumentNullException ("domain");
return domain.CreateInstance (assemblyName, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes, securityAttributes);
}
public static T CreateInstance <T> ()
{
return (T) CreateInstance (typeof (T));
}
public static object CreateInstance (Type type)
{
return CreateInstance (type, false);
}
public static object CreateInstance (Type type, params object [] args)
{
return CreateInstance (type, args, EmptyArray<object>.Value);
}
public static object CreateInstance (Type type, object [] args, object [] activationAttributes)
{
return CreateInstance (type, BindingFlags.Default, Binder.DefaultBinder, args, null, activationAttributes);
}
public static object CreateInstance (Type type, BindingFlags bindingAttr, Binder binder, object [] args,
CultureInfo culture)
{
return CreateInstance (type, bindingAttr, binder, args, culture, EmptyArray<object>.Value);
}
public static object CreateInstance (Type type, BindingFlags bindingAttr, Binder binder, object [] args,
CultureInfo culture, object [] activationAttributes)
{
CheckType (type);
if (type.ContainsGenericParameters)
throw new ArgumentException (type + " is an open generic type", "type");
// It seems to apply the same rules documented for InvokeMember: "If the type of lookup
// is omitted, BindingFlags.Public | BindingFlags.Instance will apply".
if ((bindingAttr & _accessFlags) == 0)
bindingAttr |= BindingFlags.Public | BindingFlags.Instance;
if (binder == null)
binder = Binder.DefaultBinder;
object state;
ConstructorInfo ctor = (ConstructorInfo) binder.BindToMethod (bindingAttr, type.GetConstructors (bindingAttr), ref args, null, null, null, out state);
if (ctor == null) {
// Not sure about this
if (type.IsValueType && (args == null || args.Length == 0)) {
return CreateInstanceInternal (type);
}
var sb = new StringBuilder ();
if (args != null) {
for (int i = 0; i < args.Length; i++) {
if (i > 0)
sb.Append (", ");
var argument = args [i];
var arg_type = argument != null ? argument.GetType () : null;
sb.Append (arg_type != null ? arg_type.ToString () : "(unknown)");
}
}
throw new MissingMethodException (String.Format (Locale.GetText ("No constructor found for {0}::.ctor({1})"),
type.FullName, sb));
}
CheckAbstractType (type);
if (activationAttributes != null && activationAttributes.Length > 0) {
#if DISABLE_REMOTING
throw new NotSupportedException ("Activation attributes are not supported");
#else
if (!type.IsMarshalByRef) {
string msg = Locale.GetText ("Type '{0}' doesn't derive from MarshalByRefObject.", type.FullName);
throw new NotSupportedException (msg);
}
object newOb = ActivationServices.CreateProxyFromAttributes (type, activationAttributes);
if (newOb != null) {
// This returns null
ctor.Invoke (newOb, bindingAttr, binder, args, culture);
return newOb;
}
#endif
}
return ctor.Invoke (bindingAttr, binder, args, culture);
}
public static object CreateInstance (Type type, bool nonPublic)
{
CheckType (type);
if (type.ContainsGenericParameters)
throw new ArgumentException (type + " is an open generic type", "type");
MonoType monoType = type.UnderlyingSystemType as MonoType;
if (monoType == null)
throw new ArgumentException ("Type must be a type provided by the runtime");
CheckAbstractType (monoType);
var ctor = monoType.GetDefaultConstructor ();
if (!nonPublic && ctor != null && !ctor.IsPublic) {
ctor = null;
}
if (ctor == null) {
if (type.IsValueType)
return CreateInstanceInternal (type);
throw new MissingMethodException (Locale.GetText ("Default constructor not found for type " + type.FullName));
}
return ctor.InternalInvoke (null, null);
}
private static void CheckType (Type type)
{
if (type == null)
throw new ArgumentNullException ("type");
if ((type == typeof (TypedReference)) || (type == typeof (ArgIterator)) || (type == typeof (void)) ||
(type == typeof (RuntimeArgumentHandle))) {
string msg = Locale.GetText ("CreateInstance cannot be used to create this type ({0}).", type.FullName);
throw new NotSupportedException (msg);
}
}
private static void CheckAbstractType (Type type)
{
if (type.IsAbstract) {
string msg = Locale.GetText ("Cannot create an abstract class '{0}'.", type.FullName);
throw new MissingMethodException (msg);
}
}
[SecurityPermission (SecurityAction.LinkDemand, RemotingConfiguration = true)]
public static object GetObject (Type type, string url)
{
if (type == null)
throw new ArgumentNullException ("type");
return RemotingServices.Connect (type, url);
}
[SecurityPermission (SecurityAction.LinkDemand, RemotingConfiguration = true)]
public static object GetObject (Type type, string url, object state)
{
if (type == null)
throw new ArgumentNullException ("type");
return RemotingServices.Connect (type, url, state);
}
[MethodImplAttribute (MethodImplOptions.InternalCall)]
internal static extern object CreateInstanceInternal (Type type);
void _Activator.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
{
throw new NotImplementedException ();
}
void _Activator.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
{
throw new NotImplementedException ();
}
void _Activator.GetTypeInfoCount (out uint pcTInfo)
{
throw new NotImplementedException ();
}
void _Activator.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams,
IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
{
throw new NotImplementedException ();
}
#if NET_4_0
public static ObjectHandle CreateInstance (string assemblyName, string typeName, bool ignoreCase,
BindingFlags bindingAttr, Binder binder, object [] args,
CultureInfo culture, object [] activationAttributes)
{
Assembly assembly = null;
if(assemblyName == null)
assembly = Assembly.GetCallingAssembly ();
else
assembly = Assembly.Load (assemblyName);
Type type = assembly.GetType (typeName, true, ignoreCase);
object obj = CreateInstance (type, bindingAttr, binder, args, culture, activationAttributes);
return (obj != null) ? new ObjectHandle (obj) : null;
}
public static ObjectHandle CreateInstance (AppDomain domain, string assemblyName, string typeName,
bool ignoreCase, BindingFlags bindingAttr, Binder binder,
object [] args, CultureInfo culture,
object [] activationAttributes)
{
if (domain == null)
throw new ArgumentNullException ("domain");
return domain.CreateInstance (assemblyName, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes);
}
public static ObjectHandle CreateInstanceFrom (string assemblyFile, string typeName, bool ignoreCase,
BindingFlags bindingAttr, Binder binder, object [] args,
CultureInfo culture, object [] activationAttributes)
{
Assembly assembly = Assembly.LoadFrom (assemblyFile);
if (assembly == null)
return null;
Type type = assembly.GetType (typeName, true, ignoreCase);
if (type == null)
return null;
object obj = CreateInstance (type, bindingAttr, binder, args, culture, activationAttributes);
return (obj != null) ? new ObjectHandle (obj) : null;
}
public static ObjectHandle CreateInstanceFrom (AppDomain domain, string assemblyFile, string typeName,
bool ignoreCase, BindingFlags bindingAttr, Binder binder,
object [] args, CultureInfo culture,
object [] activationAttributes)
{
if (domain == null)
throw new ArgumentNullException ("domain");
return domain.CreateInstanceFrom (assemblyFile, typeName, ignoreCase, bindingAttr, binder, args, culture, activationAttributes);
}
#endif
}
}

View File

@@ -0,0 +1,181 @@
//
// AggregateException.cs
//
// Authors:
// Marek Safar (marek.safar@gmail.com)
//
// Copyright (c) 2008 Jérémie "Garuma" Laval
// Copyright (C) 2013 Xamarin Inc (http://www.xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
// The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
// THE SOFTWARE.
//
//
#if NET_4_0
using System;
using System.Collections.ObjectModel;
using System.Collections.Generic;
using System.Runtime.Serialization;
namespace System
{
[System.SerializableAttribute]
[System.Diagnostics.DebuggerDisplay ("Count = {InnerExceptions.Count}")]
public class AggregateException : Exception
{
List<Exception> innerExceptions = new List<Exception> ();
const string defaultMessage = "One or more errors occured";
public AggregateException () : base (defaultMessage)
{
}
public AggregateException (string message): base (message)
{
}
public AggregateException (string message, Exception innerException): base (message, innerException)
{
if (innerException == null)
throw new ArgumentNullException ("innerException");
innerExceptions.Add (innerException);
}
protected AggregateException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
}
public AggregateException (params Exception[] innerExceptions)
: this (string.Empty, innerExceptions)
{
}
public AggregateException (string message, params Exception[] innerExceptions)
: base (message, innerExceptions == null || innerExceptions.Length == 0 ? null : innerExceptions[0])
{
if (innerExceptions == null)
throw new ArgumentNullException ("innerExceptions");
foreach (var exception in innerExceptions)
if (exception == null)
throw new ArgumentException ("One of the inner exception is null", "innerExceptions");
this.innerExceptions.AddRange (innerExceptions);
}
public AggregateException (IEnumerable<Exception> innerExceptions)
: this (defaultMessage, innerExceptions)
{
}
public AggregateException (string message, IEnumerable<Exception> innerExceptions)
: this (message, new List<Exception> (innerExceptions).ToArray ())
{
}
public AggregateException Flatten ()
{
List<Exception> inner = new List<Exception> ();
foreach (Exception e in innerExceptions) {
AggregateException aggEx = e as AggregateException;
if (aggEx != null) {
inner.AddRange (aggEx.Flatten ().InnerExceptions);
} else {
inner.Add (e);
}
}
return new AggregateException (inner);
}
public void Handle (Func<Exception, bool> predicate)
{
if (predicate == null)
throw new ArgumentNullException ("predicate");
List<Exception> failed = new List<Exception> ();
foreach (var e in innerExceptions) {
if (!predicate (e))
failed.Add (e);
}
if (failed.Count > 0)
throw new AggregateException (failed);
}
public ReadOnlyCollection<Exception> InnerExceptions {
get {
return innerExceptions.AsReadOnly ();
}
}
internal void AddChildException (AggregateException childEx)
{
if (innerExceptions == null)
innerExceptions = new List<Exception> ();
if (childEx == null)
return;
innerExceptions.Add (childEx);
}
public override string ToString ()
{
System.Text.StringBuilder finalMessage = new System.Text.StringBuilder (base.ToString ());
int currentIndex = -1;
foreach (Exception e in innerExceptions) {
finalMessage.Append (Environment.NewLine);
finalMessage.Append (" --> (Inner exception ");
finalMessage.Append (++currentIndex);
finalMessage.Append (") ");
finalMessage.Append (e.ToString ());
finalMessage.Append (Environment.NewLine);
}
return finalMessage.ToString ();
}
public override void GetObjectData (SerializationInfo info, StreamingContext context)
{
if (info == null) {
throw new ArgumentNullException("info");
}
base.GetObjectData(info, context);
info.AddValue ("InnerExceptions", innerExceptions.ToArray(), typeof (Exception[]));
}
public override Exception GetBaseException ()
{
Exception inner = this;
for (var ae = this; ae.innerExceptions.Count == 1;) {
inner = ae.InnerExceptions [0];
var aei = inner as AggregateException;
if (aei == null)
break;
ae = aei;
}
return inner;
}
}
}
#endif

View File

@@ -0,0 +1,65 @@
//
// System.AndroidPlatform.cs
//
// Author:
// Jonathan Pryor (jonp@xamarin.com)
//
// Copyright (C) 2012 Xamarin Inc (http://xamarin.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// 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 MONODROID
using System.Threading;
namespace System {
internal class AndroidPlatform {
static readonly Func<SynchronizationContext> getDefaultSyncContext;
static readonly Func<string> getDefaultTimeZone;
static AndroidPlatform ()
{
getDefaultSyncContext = (Func<SynchronizationContext>)
Delegate.CreateDelegate (typeof(Func<SynchronizationContext>),
Type.GetType ("Android.Runtime.AndroidEnvironment, Mono.Android", true)
.GetMethod ("GetDefaultSyncContext",
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic));
getDefaultTimeZone = (Func<string>)
Delegate.CreateDelegate (typeof(Func<string>),
Type.GetType ("Android.Runtime.AndroidEnvironment, Mono.Android", true)
.GetMethod ("GetDefaultTimeZone",
System.Reflection.BindingFlags.Static | System.Reflection.BindingFlags.NonPublic));
}
internal static SynchronizationContext GetDefaultSyncContext ()
{
return getDefaultSyncContext ();
}
internal static string GetDefaultTimeZone ()
{
return getDefaultTimeZone ();
}
}
}
#endif

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,34 @@
//
// System.AppDomainInitializer delegate
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
namespace System {
[System.Runtime.InteropServices.ComVisible (true)]
[Serializable]
public delegate void AppDomainInitializer (string[] args);
}

View File

@@ -0,0 +1,114 @@
//
// System.AppDomainManager class
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2004-2005,2009 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Reflection;
using System.Runtime.Hosting;
using System.Runtime.InteropServices;
using System.Security;
using System.Security.Permissions;
using System.Security.Policy;
using System.Threading;
namespace System {
[ComVisible (true)]
[SecurityPermission (SecurityAction.LinkDemand, Infrastructure = true)]
[SecurityPermission (SecurityAction.InheritanceDemand, Infrastructure = true)]
public class AppDomainManager : MarshalByRefObject {
private ApplicationActivator _activator;
private AppDomainManagerInitializationOptions _flags;
public AppDomainManager ()
{
_flags = AppDomainManagerInitializationOptions.None;
}
public virtual ApplicationActivator ApplicationActivator {
get {
if (_activator == null)
_activator = new ApplicationActivator ();
return _activator;
}
}
public virtual Assembly EntryAssembly {
get { return Assembly.GetEntryAssembly (); }
}
[MonoTODO]
public virtual HostExecutionContextManager HostExecutionContextManager {
get { throw new NotImplementedException (); }
}
public virtual HostSecurityManager HostSecurityManager {
get { return null; }
}
public AppDomainManagerInitializationOptions InitializationFlags {
get { return _flags; }
set { _flags = value; }
}
// methods
public virtual AppDomain CreateDomain (string friendlyName, Evidence securityInfo, AppDomainSetup appDomainInfo)
{
InitializeNewDomain (appDomainInfo);
AppDomain ad = CreateDomainHelper (friendlyName, securityInfo, appDomainInfo);
// supply app domain policy ?
if ((HostSecurityManager.Flags & HostSecurityManagerOptions.HostPolicyLevel) == HostSecurityManagerOptions.HostPolicyLevel) {
PolicyLevel pl = HostSecurityManager.DomainPolicy;
if (pl != null) {
ad.SetAppDomainPolicy (pl);
}
}
return ad;
}
public virtual void InitializeNewDomain (AppDomainSetup appDomainInfo)
{
// default does nothing (as documented)
}
// available in FX2.0 with service pack 1, including the 2.0 shipped as part of FX3.5
public virtual bool CheckSecuritySettings (SecurityState state)
{
return false;
}
// static
// FIXME: maybe AppDomain.CreateDomain should be calling this?
protected static AppDomain CreateDomainHelper (string friendlyName, Evidence securityInfo, AppDomainSetup appDomainInfo)
{
return AppDomain.CreateDomain (friendlyName, securityInfo, appDomainInfo);
}
}
}

View File

@@ -0,0 +1,400 @@
//
// System.AppDomainSetup.cs
//
// Authors:
// Dietmar Maurer (dietmar@ximian.com)
// Sebastien Pouliot <sebastien@ximian.com>
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Known Problems:
// Fix serialization compatibility with MS.NET.
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Collections.Generic;
using System.IO;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Security;
using System.Runtime.Serialization.Formatters.Binary;
using System.Runtime.Hosting;
using System.Security.Policy;
namespace System
{
[Serializable]
[ClassInterface (ClassInterfaceType.None)]
[ComVisible (true)]
[StructLayout (LayoutKind.Sequential)]
#if NET_2_1
public sealed class AppDomainSetup
#else
public sealed class AppDomainSetup : IAppDomainSetup
#endif
{
string application_base;
string application_name;
string cache_path;
string configuration_file;
string dynamic_base;
string license_file;
string private_bin_path;
string private_bin_path_probe;
string shadow_copy_directories;
string shadow_copy_files;
bool publisher_policy;
private bool path_changed;
#if MOBILE
private int loader_optimization;
#else
private LoaderOptimization loader_optimization;
#endif
bool disallow_binding_redirects;
bool disallow_code_downloads;
#if MOBILE
object _activationArguments;
object domain_initializer;
object application_trust;
#else
private ActivationArguments _activationArguments;
AppDomainInitializer domain_initializer;
[NonSerialized]
ApplicationTrust application_trust;
#endif
string [] domain_initializer_args;
bool disallow_appbase_probe;
byte [] configuration_bytes;
byte [] serialized_non_primitives;
public AppDomainSetup ()
{
}
internal AppDomainSetup (AppDomainSetup setup)
{
application_base = setup.application_base;
application_name = setup.application_name;
cache_path = setup.cache_path;
configuration_file = setup.configuration_file;
dynamic_base = setup.dynamic_base;
license_file = setup.license_file;
private_bin_path = setup.private_bin_path;
private_bin_path_probe = setup.private_bin_path_probe;
shadow_copy_directories = setup.shadow_copy_directories;
shadow_copy_files = setup.shadow_copy_files;
publisher_policy = setup.publisher_policy;
path_changed = setup.path_changed;
loader_optimization = setup.loader_optimization;
disallow_binding_redirects = setup.disallow_binding_redirects;
disallow_code_downloads = setup.disallow_code_downloads;
_activationArguments = setup._activationArguments;
domain_initializer = setup.domain_initializer;
application_trust = setup.application_trust;
domain_initializer_args = setup.domain_initializer_args;
disallow_appbase_probe = setup.disallow_appbase_probe;
configuration_bytes = setup.configuration_bytes;
}
public AppDomainSetup (ActivationArguments activationArguments)
{
_activationArguments = activationArguments;
}
public AppDomainSetup (ActivationContext activationContext)
{
_activationArguments = new ActivationArguments (activationContext);
}
static string GetAppBase (string appBase)
{
if (appBase == null)
return null;
int len = appBase.Length;
if (len >= 8 && appBase.ToLower ().StartsWith ("file://")) {
appBase = appBase.Substring (7);
if (Path.DirectorySeparatorChar != '/')
appBase = appBase.Replace ('/', Path.DirectorySeparatorChar);
if (Environment.IsRunningOnWindows) {
// Under Windows prepend "//" to indicate it's a local file
appBase = "//" + appBase;
}
} else {
appBase = Path.GetFullPath (appBase);
}
return appBase;
}
public string ApplicationBase {
get { return GetAppBase (application_base); }
set { application_base = value; }
}
public string ApplicationName {
get {
return application_name;
}
set {
application_name = value;
}
}
public string CachePath {
get {
return cache_path;
}
set {
cache_path = value;
}
}
public string ConfigurationFile {
get {
if (configuration_file == null)
return null;
if (Path.IsPathRooted(configuration_file))
return configuration_file;
if (ApplicationBase == null)
throw new MemberAccessException("The ApplicationBase must be set before retrieving this property.");
return Path.Combine(ApplicationBase, configuration_file);
}
set {
configuration_file = value;
}
}
public bool DisallowPublisherPolicy {
get {
return publisher_policy;
}
set {
publisher_policy = value;
}
}
public string DynamicBase {
get {
if (dynamic_base == null)
return null;
if (Path.IsPathRooted (dynamic_base))
return dynamic_base;
if (ApplicationBase == null)
throw new MemberAccessException ("The ApplicationBase must be set before retrieving this property.");
return Path.Combine (ApplicationBase, dynamic_base);
}
set {
if (application_name == null)
throw new MemberAccessException ("ApplicationName must be set before the DynamicBase can be set.");
uint id = (uint) application_name.GetHashCode ();
dynamic_base = Path.Combine (value, id.ToString("x"));
}
}
public string LicenseFile {
get {
return license_file;
}
set {
license_file = value;
}
}
[MonoLimitation ("In Mono this is controlled by the --share-code flag")]
public LoaderOptimization LoaderOptimization {
get {
return (LoaderOptimization)loader_optimization;
}
set {
#if MOBILE
loader_optimization = (int)value;
#else
loader_optimization = value;
#endif
}
}
public string PrivateBinPath {
get {
return private_bin_path;
}
set {
private_bin_path = value;
path_changed = true;
}
}
public string PrivateBinPathProbe {
get {
return private_bin_path_probe;
}
set {
private_bin_path_probe = value;
path_changed = true;
}
}
public string ShadowCopyDirectories {
get {
return shadow_copy_directories;
}
set {
shadow_copy_directories = value;
}
}
public string ShadowCopyFiles {
get {
return shadow_copy_files;
}
set {
shadow_copy_files = value;
}
}
public bool DisallowBindingRedirects {
get {
return disallow_binding_redirects;
}
set {
disallow_binding_redirects = value;
}
}
public bool DisallowCodeDownload {
get {
return disallow_code_downloads;
}
set {
disallow_code_downloads = value;
}
}
public ActivationArguments ActivationArguments {
get {
if (_activationArguments != null)
return (ActivationArguments)_activationArguments;
DeserializeNonPrimitives ();
return (ActivationArguments)_activationArguments;
}
set { _activationArguments = value; }
}
[MonoLimitation ("it needs to be invoked within the created domain")]
public AppDomainInitializer AppDomainInitializer {
get {
if (domain_initializer != null)
return (AppDomainInitializer)domain_initializer;
DeserializeNonPrimitives ();
return (AppDomainInitializer)domain_initializer;
}
set { domain_initializer = value; }
}
[MonoLimitation ("it needs to be used to invoke the initializer within the created domain")]
public string [] AppDomainInitializerArguments {
get { return domain_initializer_args; }
set { domain_initializer_args = value; }
}
[MonoNotSupported ("This property exists but not considered.")]
public ApplicationTrust ApplicationTrust {
get {
if (application_trust != null)
return (ApplicationTrust)application_trust;
DeserializeNonPrimitives ();
if (application_trust == null)
application_trust = new ApplicationTrust ();
return (ApplicationTrust)application_trust;
}
set { application_trust = value; }
}
[MonoNotSupported ("This property exists but not considered.")]
public bool DisallowApplicationBaseProbing {
get { return disallow_appbase_probe; }
set { disallow_appbase_probe = value; }
}
[MonoNotSupported ("This method exists but not considered.")]
public byte [] GetConfigurationBytes ()
{
return configuration_bytes != null ? configuration_bytes.Clone () as byte [] : null;
}
[MonoNotSupported ("This method exists but not considered.")]
public void SetConfigurationBytes (byte [] value)
{
configuration_bytes = value;
}
private void DeserializeNonPrimitives ()
{
lock (this) {
if (serialized_non_primitives == null)
return;
BinaryFormatter bf = new BinaryFormatter ();
MemoryStream ms = new MemoryStream (serialized_non_primitives);
object [] arr = (object []) bf.Deserialize (ms);
_activationArguments = (ActivationArguments) arr [0];
domain_initializer = (AppDomainInitializer) arr [1];
application_trust = (ApplicationTrust) arr [2];
serialized_non_primitives = null;
}
}
internal void SerializeNonPrimitives ()
{
object [] arr = new object [3];
arr [0] = _activationArguments;
arr [1] = domain_initializer;
arr [2] = application_trust;
BinaryFormatter bf = new BinaryFormatter ();
MemoryStream ms = new MemoryStream ();
bf.Serialize (ms, arr);
serialized_non_primitives = ms.ToArray ();
}
#if NET_4_0
[MonoTODO ("not implemented, does not throw because it's used in testing moonlight")]
public void SetCompatibilitySwitches (IEnumerable<string> switches)
{
}
#endif
}
}

View File

@@ -0,0 +1,69 @@
//
// System.AppDomainUnloadedException.cs
//
// Authors:
// Duncan Mak (duncan@ximian.com)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// 2002 (C) Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
namespace System
{
[Serializable]
[ComVisible (true)]
public class AppDomainUnloadedException : SystemException
{
const int Result = unchecked ((int)0x80131014);
// Constructors
public AppDomainUnloadedException ()
: base (Locale.GetText ("Can't access an unloaded application domain."))
{
HResult = Result;
}
public AppDomainUnloadedException (string message)
: base (message)
{
HResult = Result;
}
public AppDomainUnloadedException (string message, Exception innerException)
:base (message, innerException)
{
HResult = Result;
}
protected AppDomainUnloadedException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
}
}
}

View File

@@ -0,0 +1,70 @@
//
// System.ApplicationException.cs
//
// Authors:
// Joe Shaw (joe@ximian.com)
// Miguel de Icaza (miguel@ximian.com)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
namespace System
{
[Serializable]
[ComVisible (true)]
public class ApplicationException : Exception
{
const int Result = unchecked ((int)0x80131600);
// Constructors
public ApplicationException ()
: base (Locale.GetText ("An application exception has occurred."))
{
HResult = Result;
}
public ApplicationException (string message)
: base (message)
{
HResult = Result;
}
public ApplicationException (string message, Exception innerException)
: base (message, innerException)
{
HResult = Result;
}
protected ApplicationException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
}
}
}

View File

@@ -0,0 +1,138 @@
//
// System.ApplicationId class
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
using System.Text;
namespace System {
[Serializable]
[ComVisible (true)]
public sealed class ApplicationId {
private byte[] _token;
private string _name;
private Version _version;
private string _proc;
private string _culture;
public ApplicationId (byte[] publicKeyToken, string name, Version version, string processorArchitecture, string culture)
{
if (publicKeyToken == null)
throw new ArgumentNullException ("publicKeyToken");
if (name == null)
throw new ArgumentNullException ("name");
if (version == null)
throw new ArgumentNullException ("version");
_token = (byte[]) publicKeyToken.Clone ();
_name = name;
_version = version;
_proc = processorArchitecture;
_culture = culture;
}
// properties
public string Culture {
get { return _culture; }
}
public string Name {
get { return _name; }
}
public string ProcessorArchitecture {
get { return _proc; }
}
public byte[] PublicKeyToken {
get { return (byte[]) _token.Clone (); }
}
public Version Version {
get { return _version; }
}
// methods
public ApplicationId Copy ()
{
return new ApplicationId (_token, _name, _version, _proc, _culture);
}
public override bool Equals (object o)
{
if (o == null)
return false;
ApplicationId appid = (o as ApplicationId);
if (appid == null)
return false;
if (_name != appid._name)
return false;
if (_proc != appid._proc)
return false;
if (_culture != appid._culture)
return false;
if (!_version.Equals (appid._version))
return false;
if (_token.Length != appid._token.Length)
return false;
for (int i=0; i < _token.Length; i++)
if (_token [i] != appid._token [i])
return false;
return true;
}
public override int GetHashCode ()
{
int code = _name.GetHashCode () ^ _version.GetHashCode ();
for (int i=0; i < _token.Length; i++)
code ^= _token [i];
// ProcessorArchitecture and Culture aren't part of the hash code
// Confirmed by Microsoft in FDBK13339
return code;
}
public override string ToString ()
{
StringBuilder sb = new StringBuilder ();
sb.Append (_name);
if (_culture != null)
sb.AppendFormat (", culture=\"{0}\"", _culture);
sb.AppendFormat (", version=\"{0}\", publicKeyToken=\"", _version);
for (int i=0; i < _token.Length; i++)
sb.Append (_token [i].ToString ("X2"));
if (_proc != null)
sb.AppendFormat ("\", processorArchitecture =\"{0}\"", _proc);
else
sb.Append ("\"");
return sb.ToString ();
}
}
}

View File

@@ -0,0 +1,80 @@
//
// System.ApplicationIdentity class
//
// Author:
// Sebastien Pouliot <sebastien@ximian.com>
//
// Copyright (C) 2004-2005 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.InteropServices;
using System.Runtime.Serialization;
namespace System {
[Serializable]
[ComVisible (false)]
public sealed class ApplicationIdentity: ISerializable {
private string _fullName;
// FIXME:
#pragma warning disable 649
private string _codeBase;
#pragma warning restore 649
public ApplicationIdentity (string applicationIdentityFullName)
{
if (applicationIdentityFullName == null)
throw new ArgumentNullException ("applicationIdentityFullName");
if (applicationIdentityFullName.IndexOf (", Culture=") == -1)
_fullName = applicationIdentityFullName + ", Culture=neutral";
else
_fullName = applicationIdentityFullName;
}
//
// FIXME: "URL for deployment manifest", this message should be clearer!
//
public string CodeBase {
get { return _codeBase; }
}
public string FullName {
get { return _fullName; }
}
public override string ToString ()
{
return _fullName;
}
[MonoTODO ("Missing serialization")]
void ISerializable.GetObjectData (SerializationInfo info, StreamingContext context)
{
if (info == null)
throw new ArgumentNullException ("info");
}
}
}

View File

@@ -0,0 +1,121 @@
//
// System.ArgIterator.cs
//
// Authors:
// Dick Porter (dick@ximian.com)
// Paolo Molaro (lupus@ximian.com)
//
// (C) Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
namespace System
{
[StructLayout (LayoutKind.Auto)]
public struct ArgIterator
{
#pragma warning disable 169, 414
IntPtr sig;
IntPtr args;
int next_arg;
int num_args;
#pragma warning restore 169, 414
[MethodImpl (MethodImplOptions.InternalCall)]
extern void Setup (IntPtr argsp, IntPtr start);
public ArgIterator (RuntimeArgumentHandle arglist)
{
sig = IntPtr.Zero;
args = IntPtr.Zero;
next_arg = num_args = 0;
Setup (arglist.args, IntPtr.Zero);
}
[CLSCompliant (false)]
unsafe public ArgIterator (RuntimeArgumentHandle arglist, void *ptr)
{
sig = IntPtr.Zero;
args = IntPtr.Zero;
next_arg = num_args = 0;
Setup (arglist.args, (IntPtr) ptr);
}
public void End ()
{
next_arg = num_args;
}
public override bool Equals (object o)
{
throw new NotSupportedException (Locale.GetText ("ArgIterator does not support Equals."));
}
public override int GetHashCode ()
{
return sig.GetHashCode ();
}
[CLSCompliant (false)]
public TypedReference GetNextArg ()
{
if (num_args == next_arg)
throw new InvalidOperationException (Locale.GetText ("Invalid iterator position."));
return IntGetNextArg ();
}
[MethodImpl (MethodImplOptions.InternalCall)]
extern TypedReference IntGetNextArg ();
[CLSCompliant (false)]
public TypedReference GetNextArg (RuntimeTypeHandle rth)
{
if (num_args == next_arg)
throw new InvalidOperationException (Locale.GetText ("Invalid iterator position."));
return IntGetNextArg (rth.Value);
}
[MethodImpl (MethodImplOptions.InternalCall)]
extern TypedReference IntGetNextArg (IntPtr rth);
public RuntimeTypeHandle GetNextArgType ()
{
if (num_args == next_arg)
throw new InvalidOperationException (Locale.GetText ("Invalid iterator position."));
return new RuntimeTypeHandle (IntGetNextArgType ());
}
[MethodImpl (MethodImplOptions.InternalCall)]
extern IntPtr IntGetNextArgType ();
public int GetRemainingCount ()
{
return num_args - next_arg;
}
}
}

View File

@@ -0,0 +1,110 @@
//
// System.ArgumentException.cs
//
// Authors:
// Joe Shaw (joe@ximian.com)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
namespace System
{
[Serializable]
[ComVisible (true)]
[StructLayout (LayoutKind.Sequential)]
public class ArgumentException : SystemException
{
const int Result = unchecked ((int)0x80070057);
private string param_name;
// Constructors
public ArgumentException ()
: base (Locale.GetText ("Value does not fall within the expected range."))
{
HResult = Result;
}
public ArgumentException (string message)
: base (message)
{
HResult = Result;
}
public ArgumentException (string message, Exception innerException)
: base (message, innerException)
{
HResult = Result;
}
public ArgumentException (string message, string paramName)
: base (message)
{
this.param_name = paramName;
HResult = Result;
}
public ArgumentException (string message, string paramName, Exception innerException)
: base (message, innerException)
{
this.param_name = paramName;
HResult = Result;
}
protected ArgumentException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
param_name = info.GetString ("ParamName");
}
// Properties
public virtual string ParamName {
get {
return param_name;
}
}
public override string Message {
get {
if (ParamName != null && ParamName.Length != 0)
return base.Message + Environment.NewLine
+ Locale.GetText ("Parameter name: ")
+ ParamName;
return base.Message;
}
}
public override void GetObjectData (SerializationInfo info, StreamingContext context)
{
base.GetObjectData (info, context);
info.AddValue ("ParamName", ParamName);
}
}
}

View File

@@ -0,0 +1,75 @@
//
// System.ArgumentNullException.cs
//
// Authors:
// Joe Shaw (joe@ximian.com)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
namespace System
{
[Serializable]
[ComVisible (true)]
public class ArgumentNullException : ArgumentException
{
const int Result = unchecked ((int)0x80004003);
// Constructors
public ArgumentNullException ()
: base (Locale.GetText ("Argument cannot be null."))
{
HResult = Result;
}
public ArgumentNullException (string paramName)
: base (Locale.GetText ("Argument cannot be null."), paramName)
{
HResult = Result;
}
public ArgumentNullException (string paramName, string message)
: base (message, paramName)
{
HResult = Result;
}
public ArgumentNullException (string message, Exception innerException)
: base (message, innerException)
{
HResult = Result;
}
protected ArgumentNullException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
}
}
}

View File

@@ -0,0 +1,109 @@
//
// System.ArgumentOutOfRangeException.cs
//
// Authors:
// Joe Shaw (joe@ximian.com)
// Duncan Mak (duncan@ximian.com)
// Andreas Nahr (ClassDevelopment@A-SoftTech.com)
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
namespace System
{
[Serializable]
[ComVisible (true)]
public class ArgumentOutOfRangeException : ArgumentException
{
const int Result = unchecked ((int)0x80131502);
private object actual_value;
// Constructors
public ArgumentOutOfRangeException ()
: base (Locale.GetText ("Argument is out of range."))
{
HResult = Result;
}
public ArgumentOutOfRangeException (string paramName)
: base (Locale.GetText ("Argument is out of range."), paramName)
{
HResult = Result;
}
public ArgumentOutOfRangeException (string paramName, string message)
: base (message, paramName)
{
HResult = Result;
}
public ArgumentOutOfRangeException (string paramName, object actualValue, string message)
: base (message, paramName)
{
this.actual_value = actualValue;
HResult = Result;
}
protected ArgumentOutOfRangeException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
actual_value = info.GetString ("ActualValue");
}
public ArgumentOutOfRangeException (string message, Exception innerException)
: base (message, innerException)
{
HResult = Result;
}
// Properties
public virtual object ActualValue {
get {
return actual_value;
}
}
public override string Message {
get {
string basemsg = base.Message;
if (actual_value == null)
return basemsg;
return basemsg + Environment.NewLine + actual_value;
}
}
// Methods
public override void GetObjectData (SerializationInfo info, StreamingContext context)
{
base.GetObjectData (info, context);
info.AddValue ("ActualValue", actual_value);
}
}
}

View File

@@ -0,0 +1,69 @@
//
// System.ArithmeticException.cs
//
// Author:
// Joe Shaw (joe@ximian.com)
// Duncan Mak (duncan@ximian.com)
//
// (C) 2001 Ximian, Inc. http://www.ximian.com
//
//
// Copyright (C) 2004 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be
// included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
// EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
// NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
// LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
// OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
// WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
using System.Runtime.Serialization;
using System.Runtime.InteropServices;
namespace System
{
[Serializable]
[ComVisible (true)]
public class ArithmeticException : SystemException
{
const int Result = unchecked ((int)0x80070216);
// Constructors
public ArithmeticException ()
: base (Locale.GetText ("Overflow or underflow in the arithmetic operation."))
{
HResult = Result;
}
public ArithmeticException (string message)
: base (message)
{
HResult = Result;
}
public ArithmeticException (string message, Exception innerException)
: base (message, innerException)
{
HResult = Result;
}
protected ArithmeticException (SerializationInfo info, StreamingContext context)
: base (info, context)
{
}
}
}

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More