[runtime] Move pending_exception from InternalThread to Thread to avoid crashing on domain unload.
-Subproject commit 78dccece97d38f6e771ce039001c84fa8435349a
+Subproject commit 0cb499950a7ae61c62c433c8cce353d535dbd09e
intermediate_clean=$(subst /,-,$(intermediate))
csproj-library:
config_file=`basename $(LIBRARY) .dll`-$(intermediate_clean)$(PROFILE).input; \
- [[ $(thisdir) == *"Facades"* ]] && config_file=Facades_$$config_file; \
+ case "$(thisdir)" in *"Facades"*) config_file=Facades_$$config_file;; esac; \
echo $(thisdir):$$config_file >> $(topdir)/../msvc/scripts/order; \
(echo $(is_boot); \
echo $(USE_MCS_FLAGS) $(LIBRARY_FLAGS) $(LIB_MCS_FLAGS); \
namespace Mono.Security.Protocol.Ntlm {
[Obsolete (Type3Message.LegacyAPIWarning)]
-#if INSIDE_SYSTEM
- internal
-#else
- public
-#endif
- class ChallengeResponse : IDisposable {
+ public class ChallengeResponse : IDisposable {
static private byte[] magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };
namespace Mono.Security.Protocol.Ntlm {
-#if INSIDE_SYSTEM
- internal
-#else
- public
-#endif
- static class ChallengeResponse2 {
+ public static class ChallengeResponse2 {
static private byte[] magic = { 0x4B, 0x47, 0x53, 0x21, 0x40, 0x23, 0x24, 0x25 };
namespace Mono.Security.Protocol.Ntlm {
-#if INSIDE_SYSTEM
- internal
-#else
- public
-#endif
- abstract class MessageBase {
+ public abstract class MessageBase {
static private byte[] header = { 0x4e, 0x54, 0x4c, 0x4d, 0x53, 0x53, 0x50, 0x00 };
* is LM_and_NTLM_and_try_NTLMv2_Session.
*/
-#if INSIDE_SYSTEM
- internal
-#else
- public
-#endif
- enum NtlmAuthLevel {
+ public enum NtlmAuthLevel {
/* Use LM and NTLM, never use NTLMv2 session security. */
LM_and_NTLM,
namespace Mono.Security.Protocol.Ntlm {
[Flags]
-#if INSIDE_SYSTEM
- internal
-#else
- public
-#endif
- enum NtlmFlags : int {
+ public enum NtlmFlags : int {
// The client sets this flag to indicate that it supports Unicode strings.
NegotiateUnicode = 0x00000001,
// This is set to indicate that the client supports OEM strings.
* is LM_and_NTLM_and_try_NTLMv2_Session.
*/
- #if INSIDE_SYSTEM
- internal
- #else
- public
- #endif
- static class NtlmSettings {
+ public static class NtlmSettings {
static NtlmAuthLevel defaultAuthLevel = NtlmAuthLevel.LM_and_NTLM_and_try_NTLMv2_Session;
- static FieldInfo GetDefaultAuthLevelField ()
- {
- #if INSIDE_SYSTEM
- return null;
- #else
- var type = typeof (HttpWebRequest).Assembly.GetType ("Mono.Security.Protocol.Ntlm.NtlmSettings", false);
- if (type == null)
- return null;
- return type.GetField ("defaultAuthLevel", BindingFlags.Static | BindingFlags.NonPublic);
- #endif
- }
-
- #if INSIDE_SYSTEM
- internal
- #else
- public
- #endif
- static NtlmAuthLevel DefaultAuthLevel {
- get {
- var field = GetDefaultAuthLevelField ();
- if (field != null)
- return (NtlmAuthLevel)field.GetValue (null);
- else
- return defaultAuthLevel;
- }
-
- set {
- var field = GetDefaultAuthLevelField ();
- if (field != null)
- field.SetValue (null, value);
- else
- defaultAuthLevel = value;
- }
+ public static NtlmAuthLevel DefaultAuthLevel {
+ get { return defaultAuthLevel; }
+ set { defaultAuthLevel = value; }
}
}
}
namespace Mono.Security.Protocol.Ntlm {
-#if INSIDE_SYSTEM
- internal
-#else
- public
-#endif
- class Type1Message : MessageBase {
+ public class Type1Message : MessageBase {
private string _host;
private string _domain;
namespace Mono.Security.Protocol.Ntlm {
-#if INSIDE_SYSTEM
- internal
-#else
- public
-#endif
- class Type2Message : MessageBase {
+ public class Type2Message : MessageBase {
private byte[] _nonce;
private string _targetName;
namespace Mono.Security.Protocol.Ntlm {
-#if INSIDE_SYSTEM
- internal
-#else
- public
-#endif
- class Type3Message : MessageBase {
+ public class Type3Message : MessageBase {
private NtlmAuthLevel _level;
private byte[] _challenge;
./Mono.Security.X509.Extensions/SubjectKeyIdentifierExtension.cs
./Mono.Security.Cryptography/TlsHMAC.cs
./Mono.Security.Cryptography/MD5SHA1.cs
-./Mono.Security.Protocol.Ntlm/ChallengeResponse.cs
-./Mono.Security.Protocol.Ntlm/ChallengeResponse2.cs
-./Mono.Security.Protocol.Ntlm/MessageBase.cs
-./Mono.Security.Protocol.Ntlm/NtlmAuthLevel.cs
-./Mono.Security.Protocol.Ntlm/NtlmFlags.cs
-./Mono.Security.Protocol.Ntlm/NtlmSettings.cs
-./Mono.Security.Protocol.Ntlm/Type1Message.cs
-./Mono.Security.Protocol.Ntlm/Type2Message.cs
-./Mono.Security.Protocol.Ntlm/Type3Message.cs
./Mono.Security.Protocol.Tls/Alert.cs
./Mono.Security.Protocol.Tls/CipherAlgorithmType.cs
./Mono.Security.Protocol.Tls/CipherSuite.cs
rootGroup.StreamName = streamName;
}
- if (streamName != null)
- Load ();
+ try {
+ if (streamName != null)
+ Load ();
+ } catch (XmlException ex) {
+ throw new ConfigurationErrorsException (ex.Message, ex, streamName, 0);
+ }
}
internal Configuration Parent {
Assert.AreEqual ("Server=(local);Initial Catalog=someDb;User Id=someUser;Password=somePassword;Application Name=someAppName;Min Pool Size=5;Max Pool Size=500;Connect Timeout=10;Connection Lifetime=29;",
connString);
}
+
+ [Test]
+ public void BadConfig ()
+ {
+ string xml = @" badXml";
+
+ var file = Path.Combine (tempFolder, "badConfig.config");
+ File.WriteAllText (file, xml);
+
+ try {
+ var fileMap = new ConfigurationFileMap (file);
+ var configuration = ConfigurationManager.OpenMappedMachineConfiguration (fileMap);
+ Assert.Fail ("Exception ConfigurationErrorsException was expected.");
+ } catch (ConfigurationErrorsException e) {
+ Assert.AreEqual (file, e.Filename);
+ }
+
+ }
}
}
<Compile Include="..\..\..\external\referencesource\System.Core\System\Runtime\CompilerServices\ExecutionScope.cs" />\r
<Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\Aes.cs" />\r
<Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\AesManaged.cs" />\r
+ <Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\CngKeyBlobFormat.cs" />\r
<Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\ECDiffieHellman.cs" />\r
<Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\ECDiffieHellmanPublicKey.cs" />\r
<Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\ECDsa.cs" />\r
<Compile Include="..\..\..\external\referencesource\System.Core\System\Runtime\CompilerServices\ExecutionScope.cs" />\r
<Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\Aes.cs" />\r
<Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\AesManaged.cs" />\r
+ <Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\CngKeyBlobFormat.cs" />\r
<Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\ECDiffieHellman.cs" />\r
<Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\ECDiffieHellmanPublicKey.cs" />\r
<Compile Include="..\..\..\external\referencesource\System.Core\System\Security\Cryptography\ECDsa.cs" />\r
+++ /dev/null
-//
-// System.Security.Cryptography.CngKeyBlobFormat
-//
-// Authors:
-// Sebastien Pouliot <sebastien@ximian.com>
-//
-// Copyright (C) 2008 Novell, Inc (http://www.novell.com)
-// Copyright (C) 2011 Juho Vähä-Herttua
-//
-// 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;
-
-namespace System.Security.Cryptography {
-
- // note: CNG stands for "Cryptography API: Next Generation"
-
- [Serializable]
- public sealed class CngKeyBlobFormat : IEquatable<CngKeyBlobFormat> {
-
- private string m_format;
-
- public CngKeyBlobFormat (string format)
- {
- if (format == null)
- throw new ArgumentNullException ("format");
- if (format.Length == 0)
- throw new ArgumentException ("format");
-
- m_format = format;
- }
-
- public string Format {
- get { return m_format; }
- }
-
- public bool Equals (CngKeyBlobFormat other)
- {
- if (other == null)
- return false;
- return m_format == other.m_format;
- }
-
- public override bool Equals (object obj)
- {
- return Equals (obj as CngKeyBlobFormat);
- }
-
- public override int GetHashCode ()
- {
- return m_format.GetHashCode ();
- }
-
- public override string ToString ()
- {
- return m_format;
- }
-
- // static
-
- private static CngKeyBlobFormat opaqueTransportBlob;
- private static CngKeyBlobFormat genericPrivateBlob;
- private static CngKeyBlobFormat genericPublicBlob;
- private static CngKeyBlobFormat eccPrivateBlob;
- private static CngKeyBlobFormat eccPublicBlob;
- private static CngKeyBlobFormat pkcs8PrivateBlob;
-
- public static CngKeyBlobFormat OpaqueTransportBlob {
- get {
- if (opaqueTransportBlob == null)
- opaqueTransportBlob = new CngKeyBlobFormat ("OpaqueTransport");
- return opaqueTransportBlob;
- }
- }
-
- public static CngKeyBlobFormat GenericPrivateBlob {
- get {
- if (genericPrivateBlob == null)
- genericPrivateBlob = new CngKeyBlobFormat ("PRIVATEBLOB");
- return genericPrivateBlob;
- }
- }
-
- public static CngKeyBlobFormat GenericPublicBlob {
- get {
- if (genericPublicBlob == null)
- genericPublicBlob = new CngKeyBlobFormat ("PUBLICBLOB");
- return genericPublicBlob;
- }
- }
-
- public static CngKeyBlobFormat EccPrivateBlob {
- get {
- if (eccPrivateBlob == null)
- eccPrivateBlob = new CngKeyBlobFormat ("ECCPRIVATEBLOB");
- return eccPrivateBlob;
- }
- }
-
- public static CngKeyBlobFormat EccPublicBlob {
- get {
- if (eccPublicBlob == null)
- eccPublicBlob = new CngKeyBlobFormat ("ECCPUBLICBLOB");
- return eccPublicBlob;
- }
- }
-
- public static CngKeyBlobFormat Pkcs8PrivateBlob {
- get {
- if (pkcs8PrivateBlob == null)
- pkcs8PrivateBlob = new CngKeyBlobFormat ("PKCS8_PRIVATEKEY");
- return pkcs8PrivateBlob;
- }
- }
-
- public static bool operator == (CngKeyBlobFormat left, CngKeyBlobFormat right)
- {
- if ((object)left == null)
- return ((object)right == null);
- return left.Equals (right);
- }
-
- public static bool operator != (CngKeyBlobFormat left, CngKeyBlobFormat right)
- {
- if ((object)left == null)
- return ((object)right != null);
- return !left.Equals (right);
- }
- }
-}
../../../external/referencesource/System.Core/System/Runtime/CompilerServices/ExecutionScope.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/Aes.cs
+../../../external/referencesource/System.Core/System/Security/Cryptography/CngKeyBlobFormat.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/ECDiffieHellmanPublicKey.cs
../../../external/referencesource/System.Core/System/Security/Cryptography/ECDsa.cs
using System.ServiceModel.Description;
using System.Text;
using System.Xml;
+using System.Xml.Schema;
using System.Xml.Serialization;
namespace System.ServiceModel.Dispatcher
protected override void OnWriteBodyContents (XmlDictionaryWriter writer)
{
+ if (writer.WriteState == WriteState.Element) {
+ writer.WriteXmlnsAttribute ("xsi", XmlSchema.InstanceNamespace);
+ writer.WriteXmlnsAttribute ("xsd", XmlSchema.Namespace);
+ }
+
serializer.Serialize (writer, body);
}
}
[Test]
public void OneWayOperationWithRequestReplyChannel ()
{
+ var port = NetworkHelpers.FindFreePort ();
var host = new ServiceHost (typeof (OneWayService));
host.AddServiceEndpoint (typeof (IOneWayService),
new BasicHttpBinding (),
- new Uri ("http://localhost:30158"));
+ new Uri ("http://localhost:" + port));
host.Open ();
try {
var cf = new ChannelFactory<IOneWayService> (
new BasicHttpBinding (),
- new EndpointAddress ("http://localhost:30158"));
+ new EndpointAddress ("http://localhost:" + port));
var ch = cf.CreateChannel ();
ch.GiveMessage ("test");
using System;
using System.Collections.ObjectModel;
using System.IO;
+using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.ServiceModel;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
+using System.Text;
+using System.Threading.Tasks;
using System.Xml;
+using System.Xml.Serialization;
using NUnit.Framework;
using MonoTests.Helpers;
{
}
}
+
+ [SerializableAttribute ()]
+ [XmlTypeAttribute (Namespace = "http://mono.com/")]
+ public class ValueWithXmlAttributes
+ {
+ [XmlElementAttribute (ElementName = "Name")]
+ public string FakeName;
+ }
+
+ [ServiceContractAttribute (Namespace = "http://mono.com/")]
+ public interface IXmlSerializerFormatService
+ {
+ [OperationContractAttribute (Action = "http://mono.com/Send", ReplyAction = "*")]
+ [XmlSerializerFormatAttribute ()]
+ void SendValueWithXmlAttributes (ValueWithXmlAttributes v);
+ }
+
+ class XmlSerializerFormatClient : ClientBase<IXmlSerializerFormatService>
+ {
+ public XmlSerializerFormatClient (Binding binding, EndpointAddress address)
+ : base (binding, address)
+ {
+ }
+
+ public void SendValue ()
+ {
+ var v = new ValueWithXmlAttributes () { FakeName = "name" };
+ base.Channel.SendValueWithXmlAttributes (v);
+ }
+ }
+
+ [Test]
+ public void TestXmlAttributes ()
+ {
+ int port = NetworkHelpers.FindFreePort();
+ var endpoint = new EndpointAddress ("http://localhost:" + port);
+ var binding = new BasicHttpBinding ();
+ var client = new XmlSerializerFormatClient (binding, endpoint);
+
+ var server = new TcpListener (IPAddress.Any, port);
+ server.Start ();
+
+ var acceptTask = server.AcceptTcpClientAsync ();
+
+ var t1 = new Task( () => client.SendValue ());
+ t1.Start();
+
+ if (!acceptTask.Wait (2000))
+ Assert.Fail ("No request from client.");
+
+ var netStream = acceptTask.Result.GetStream ();
+
+ byte[] buffer = new byte [1024];
+ int numBytesRead = 0;
+ var message = new StringBuilder ();
+
+ do {
+ numBytesRead = netStream.Read (buffer, 0, buffer.Length);
+ var str = Encoding.UTF8.GetString (buffer, 0, numBytesRead);
+ message.AppendFormat ("{0}", str);
+ if (str.EndsWith ("</s:Envelope>", StringComparison.InvariantCulture))
+ break;
+ } while (numBytesRead > 0);
+
+ var messageStr = message.ToString ();
+ var envelopeIndex = messageStr.IndexOf ("<s:Envelope");
+ if (envelopeIndex < 0)
+ Assert.Fail ("Soap envelope was not received.");
+
+ var envelope = messageStr.Substring (envelopeIndex);
+
+ var expected = "<s:Envelope xmlns:s=\"http://schemas.xmlsoap.org/soap/envelope/\"><s:Body xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><SendValueWithXmlAttributes xmlns=\"http://mono.com/\"><v><Name>name</Name></v></SendValueWithXmlAttributes></s:Body></s:Envelope>";
+
+ Assert.AreEqual (expected, envelope);
+
+ server.Stop ();
+ }
}
}
System.Web.Services.Configuration/WsiProfilesElementTest.cs
System.Web.Services.Configuration/XmlFormatExtensionAttributeTest.cs
System.Web.Services.Discovery/ContractReferenceTest.cs
+System.Web.Services.Discovery/DiscoveryClientProtocolTest.cs
System.Web.Services.Description/BindingCollectionTest.cs
System.Web.Services.Description/DocumentableItemTest.cs
System.Web.Services.Description/TypesTest.cs
--- /dev/null
+//
+// MonoTests.System.Web.Services.Discovery.DiscoveryClientProtocolTest.cs
+//
+// Author:
+// Marcos Henrich (marcos.henrich@xamarin.com)
+//
+// Copyright (C) Xamarin Inc. 2016
+//
+
+using NUnit.Framework;
+using System;
+using System.IO;
+using System.Web.Services.Discovery;
+
+namespace MonoTests.System.Web.Services.Discovery {
+
+ [TestFixture]
+ public class DiscoveryClientProtocolTest {
+
+ [Test] // Covers #36116
+ [Category ("InetAccess")]
+ public void ReadWriteTest ()
+ {
+ string directory = Path.Combine (Path.GetTempPath (), Path.GetRandomFileName ());
+ Directory.CreateDirectory (directory);
+ try {
+ string url = "http://www.w3schools.com/WebServices/TempConvert.asmx";
+ var p1 = new DiscoveryClientProtocol ();
+ p1.DiscoverAny (url);
+ p1.ResolveAll ();
+
+ p1.WriteAll (directory, "Reference.map");
+
+ var p2 = new DiscoveryClientProtocol ();
+ var results = p2.ReadAll (Path.Combine (directory, "Reference.map"));
+
+ Assert.AreEqual (2, results.Count);
+ Assert.AreEqual ("TempConvert.disco", results [0].Filename);
+ Assert.AreEqual ("TempConvert.wsdl", results [1].Filename);
+ } finally {
+ Directory.Delete (directory, true);
+ }
+ }
+ }
+}
private ExeConfigurationFileMap exeMapPrev = null;
private SettingsPropertyValueCollection values = null;
+ /// <remarks>
+ /// Hack to remove the XmlDeclaration that the XmlSerializer adds.
+ /// <br />
+ /// see <a href="https://github.com/mono/mono/pull/2273">Issue 2273</a> for details
+ /// </remarks>
+ private string StripXmlHeader (string serializedValue)
+ {
+ if (serializedValue == null)
+ {
+ return string.Empty;
+ }
+
+ XmlDocument doc = new XmlDocument ();
+ XmlElement valueXml = doc.CreateElement ("value");
+ valueXml.InnerXml = serializedValue;
+
+ foreach (XmlNode child in valueXml.ChildNodes) {
+ if (child.NodeType == XmlNodeType.XmlDeclaration) {
+ valueXml.RemoveChild (child);
+ break;
+ }
+ }
+
+ // InnerXml will give you well-formed XML that you could save as a separate document, and
+ // InnerText will immediately give you a pure-text representation of this inner XML.
+ return valueXml.InnerXml;
+ }
+
private void SaveProperties (ExeConfigurationFileMap exeMap, SettingsPropertyValueCollection collection, ConfigurationUserLevel level, SettingsContext context, bool checkUserLevel)
{
Configuration config = ConfigurationManager.OpenMappedExeConfiguration (exeMap, level);
UserSettingsGroup userGroup = config.GetSectionGroup ("userSettings") as UserSettingsGroup;
bool isRoaming = (level == ConfigurationUserLevel.PerUserRoaming);
-#if true // my reimplementation
-
if (userGroup == null) {
userGroup = new UserSettingsGroup ();
config.SectionGroups.Add ("userSettings", userGroup);
element.Value.ValueXml = new XmlDocument ().CreateElement ("value");
switch (value.Property.SerializeAs) {
case SettingsSerializeAs.Xml:
- element.Value.ValueXml.InnerXml = (value.SerializedValue as string) ?? string.Empty;
+ element.Value.ValueXml.InnerXml = StripXmlHeader (value.SerializedValue as string);
break;
case SettingsSerializeAs.String:
element.Value.ValueXml.InnerText = value.SerializedValue as string;
}
if (hasChanges)
config.Save (ConfigurationSaveMode.Minimal, true);
-
-#else // original impl. - likely buggy to miss some properties to save
-
- foreach (ConfigurationSection configSection in userGroup.Sections)
- {
- ClientSettingsSection userSection = configSection as ClientSettingsSection;
- if (userSection != null)
- {
-/*
- userSection.Settings.Clear();
-
- foreach (SettingsPropertyValue propertyValue in collection)
- {
- if (propertyValue.IsDirty)
- {
- SettingElement element = new SettingElement(propertyValue.Name, SettingsSerializeAs.String);
- element.Value.ValueXml = new XmlDocument();
- element.Value.ValueXml.InnerXml = (string)propertyValue.SerializedValue;
- userSection.Settings.Add(element);
- }
- }
-*/
- foreach (SettingElement element in userSection.Settings)
- {
- if (collection [element.Name] != null) {
- if (collection [element.Name].Property.Attributes.Contains (typeof (SettingsManageabilityAttribute)) != isRoaming)
- continue;
-
- element.SerializeAs = SettingsSerializeAs.String;
- element.Value.ValueXml.InnerXml = (string) collection [element.Name].SerializedValue; ///Value = XmlElement
- }
- }
-
- }
- }
- config.Save (ConfigurationSaveMode.Minimal, true);
-#endif
}
// NOTE: We should add here all the chars that are valid in a name of a class (Ecma-wise),
//#define SPEW
-
using System;
+using System.IO;
+using System.Xml;
+using System.Xml.Serialization;
+using System.Xml.Schema;
using System.Text;
using System.Configuration;
using System.ComponentModel;
Assert.AreEqual ("eclair", holder1.TestKey, "#4");
Assert.AreEqual ("", holder2.TestKey, "#5");
}
+
+ class Settings : ApplicationSettingsBase
+ {
+ [UserScopedSetting]
+ public WindowPositionList WindowPositions {
+ get {
+ return ((WindowPositionList)(this ["WindowPositions"]));
+ }
+ set {
+ this ["WindowPositions"] = value;
+ }
+ }
+ }
+
+ [Serializable]
+ public class WindowPositionList : IXmlSerializable
+ {
+ public XmlSchema GetSchema ()
+ {
+ return null;
+ }
+
+ public void ReadXml (XmlReader reader)
+ {
+ reader.ReadStartElement ("sampleNode");
+ reader.ReadEndElement ();
+ }
+
+ public void WriteXml (XmlWriter writer)
+ {
+ writer.WriteStartElement ("sampleNode");
+ writer.WriteEndElement ();
+ }
+ }
+
+ [Test] //Covers 36388
+ public void XmlHeader ()
+ {
+ try {
+ var settings = new Settings ();
+ settings.Reset ();
+ settings.Save ();
+
+ settings.WindowPositions = new WindowPositionList ();
+
+ settings.Save ();
+ // If Reloads fails then saved data is corrupted
+ settings.Reload ();
+ } catch (ConfigurationErrorsException e) {
+ // Delete corrupted config file so other test won't fail.
+ File.Delete (e.Filename);
+ Assert.Fail ("Invalid data was saved to config file.");
+ }
+ }
}
}
using System.Security.Cryptography.X509Certificates;
using System.Threading;
+using MonoTests.Helpers;
+
namespace MonoTests.System.Net.Security
{
void AuthenticateClientAndServer (bool server, bool client)
{
- IPEndPoint endPoint = new IPEndPoint (IPAddress.Parse ("127.0.0.1"), 10000);
+ IPEndPoint endPoint = new IPEndPoint (IPAddress.Parse ("127.0.0.1"), NetworkHelpers.FindFreePort ());
ClientServerState state = new ClientServerState ();
state.Client = new TcpClient ();
state.Listener = new TcpListener (endPoint);
using System.Collections.Generic;
+using MonoTests.Helpers;
+
namespace MonoTests.System.Net.Sockets
{
[TestFixture]
[Test]
public void ConnectIPAddressAny ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Any, 0);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
/* UDP sockets use Any to disconnect
try {
public void IncompatibleAddress ()
{
IPEndPoint epIPv6 = new IPEndPoint (IPAddress.IPv6Any,
- 0);
+ NetworkHelpers.FindFreePort ());
try {
using (Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.IP)) {
Socket.Select (list, list, list, 1000);
}
- private bool BlockingConnect (bool block)
+ private bool BlockingConnect (bool block, int port)
{
- IPEndPoint ep = new IPEndPoint(IPAddress.Loopback, 1234);
+ IPEndPoint ep = new IPEndPoint(IPAddress.Loopback, port);
Socket server = new Socket(AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
public void AcceptBlockingStatus()
{
bool block;
-
- block = BlockingConnect(true);
+ var port = NetworkHelpers.FindFreePort ();
+
+ block = BlockingConnect(true, port);
Assert.AreEqual (block, true, "BlockingStatus01");
- block = BlockingConnect(false);
+ block = BlockingConnect(false, port);
Assert.AreEqual (block, false, "BlockingStatus02");
}
* anything...
*/
sock.BeginConnect (new IPEndPoint (IPAddress.Loopback,
- 114),
+ NetworkHelpers.FindFreePort ()),
new AsyncCallback (CFACallback),
sock);
CFACalledBack.WaitOne ();
[Test]
public void SetSocketOptionBoolean ()
{
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 1);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
Socket sock = new Socket (ep.Address.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
try {
sock.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.KeepAlive, true);
[Test]
public void TestSelect1 ()
{
- Socket srv = CreateServer ();
+ Socket srv = CreateServer (NetworkHelpers.FindFreePort ());
ClientSocket clnt = new ClientSocket (srv.LocalEndPoint);
Thread th = new Thread (new ThreadStart (clnt.ConnectSleepClose));
Socket acc = null;
}
}
- static Socket CreateServer ()
+ static Socket CreateServer (int port)
{
Socket sock = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- sock.Bind (new IPEndPoint (IPAddress.Loopback, 0));
+ sock.Bind (new IPEndPoint (IPAddress.Loopback, port));
sock.Listen (1);
return sock;
}
public void Disposed19 ()
{
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
- EndPoint ep = new IPEndPoint (IPAddress.Any, 31337);
+ EndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
s.Close();
s.SendTo (buf, 0, ep);
public void Disposed20 ()
{
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
- EndPoint ep = new IPEndPoint (IPAddress.Any, 31337);
+ EndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
s.Close();
s.SendTo (buf, 10, 0, ep);
public void Disposed21 ()
{
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
- EndPoint ep = new IPEndPoint (IPAddress.Any, 31337);
+ EndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
s.Close();
s.SendTo (buf, 0, 10, 0, ep);
public void Disposed22 ()
{
Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
- EndPoint ep = new IPEndPoint (IPAddress.Any, 31337);
+ EndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
s.Close();
s.SendTo (buf, ep);
Socket server = new Socket (AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp);
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
- 9010);
+ NetworkHelpers.FindFreePort ());
server.Bind (ep);
server.Listen (1);
SocketType.Stream,
ProtocolType.Tcp);
- sock.Bind (new IPEndPoint (IPAddress.Any, 1235));
+ sock.Bind (new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ()));
sock.ExclusiveAddressUse = true;
sock.Close ();
}
SocketType.Stream,
ProtocolType.Tcp);
- sock.Bind (new IPEndPoint (IPAddress.Any, 1236));
+ sock.Bind (new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ()));
sock.BeginAccept (BACallback, sock);
SocketType.Stream,
ProtocolType.Tcp);
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
- 1237);
+ NetworkHelpers.FindFreePort ());
sock.Bind (ep);
sock.Listen (1);
SocketType.Stream,
ProtocolType.Tcp);
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
- 1238);
+ NetworkHelpers.FindFreePort ());
sock.Bind (ep);
sock.Listen (1);
ProtocolType.Udp);
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
- 1239);
+ NetworkHelpers.FindFreePort ());
sock.Bind (ep);
sock.Listen (1);
ProtocolType.Tcp);
IPEndPoint ep1 = new IPEndPoint (IPAddress.Loopback,
- 1240);
+ NetworkHelpers.FindFreePort ());
IPEndPoint ep2 = new IPEndPoint (IPAddress.Loopback,
- 1241);
+ NetworkHelpers.FindFreePort ());
sock.Bind (ep1);
sock.Listen (1);
ProtocolType.Tcp);
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
- 1242);
+ NetworkHelpers.FindFreePort ());
sock.Bind (ep);
sock.Listen (1);
SocketType.Stream,
ProtocolType.Tcp);
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
- 1243);
+ NetworkHelpers.FindFreePort ());
sock.Bind (ep);
sock.Listen (1);
SocketType.Stream,
ProtocolType.Tcp);
IPAddress ip = IPAddress.Loopback;
- IPEndPoint ep = new IPEndPoint (ip, 1244);
+ IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
listen.Bind (ep);
listen.Listen (1);
BCConnected = false;
- sock.BeginConnect (ip, 1244, BCCallback, sock);
+ sock.BeginConnect (ip, ep.Port, BCCallback, sock);
if (BCCalledBack.WaitOne (2000, false) == false) {
Assert.Fail ("BeginConnectAddressPort wait timed out");
SocketType.Stream,
ProtocolType.Tcp);
IPAddress ip = IPAddress.Loopback;
- IPEndPoint ep = new IPEndPoint (ip, 1245);
+ IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
sock.Bind (ep);
sock.Listen (1);
try {
- sock.BeginConnect (ip, 1245, BCCallback, sock);
+ sock.BeginConnect (ip, ep.Port, BCCallback, sock);
Assert.Fail ("BeginConnectAddressPortListen #1");
} catch (InvalidOperationException) {
} catch {
SocketType.Stream,
ProtocolType.Tcp);
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
- 1246);
+ NetworkHelpers.FindFreePort ());
IPAddress[] ips = new IPAddress[4];
ips[0] = IPAddress.Parse ("127.0.0.4");
BCConnected = false;
- sock.BeginConnect (ips, 1246, BCCallback, sock);
+ sock.BeginConnect (ips, ep.Port, BCCallback, sock);
/* Longer wait here, because the ms runtime
* takes a lot longer to not connect
* succeed it it can connect to at least one of the requested
* addresses.
*/
- IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, 1246);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
listen.Bind (ep);
listen.Listen (1);
BCConnected = false;
- sock.BeginConnect (allIps, 1246, BCCallback, sock);
+ sock.BeginConnect (allIps, ep.Port, BCCallback, sock);
/* Longer wait here, because the ms runtime
* takes a lot longer to not connect
ProtocolType.Tcp);
IPAddress[] ips = new IPAddress[4];
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
- 1247);
+ NetworkHelpers.FindFreePort ());
ips[0] = IPAddress.Parse ("127.0.0.4");
ips[1] = IPAddress.Parse ("127.0.0.3");
sock.Listen (1);
try {
- sock.BeginConnect (ips, 1247, BCCallback,
+ sock.BeginConnect (ips, ep.Port, BCCallback,
sock);
Assert.Fail ("BeginConnectMultipleListen #1");
} catch (InvalidOperationException) {
SocketType.Stream,
ProtocolType.Tcp);
IPAddress ip = IPAddress.Loopback;
- IPEndPoint ep = new IPEndPoint (ip, 1248);
+ IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
sock.Bind (ep);
sock.Listen (1);
try {
- sock.BeginConnect ("localhost", 1248,
+ sock.BeginConnect ("localhost", ep.Port,
BCCallback, sock);
Assert.Fail ("BeginConnectHostPortListen #1");
} catch (InvalidOperationException) {
SocketType.Stream,
ProtocolType.Tcp);
IPAddress ip = IPAddress.Loopback;
- IPEndPoint ep = new IPEndPoint (ip, 1254);
+ IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
listen.Bind (ep);
listen.Listen (1);
- sock.Connect (ip, 1254);
+ sock.Connect (ip, ep.Port);
Assert.AreEqual (true, sock.Connected, "BeginDisconnect #1");
SocketType.Stream,
ProtocolType.Tcp);
IPEndPoint ep1 = new IPEndPoint (IPAddress.Loopback,
- 1256);
+ NetworkHelpers.FindFreePort ());
IPEndPoint ep2 = new IPEndPoint (IPAddress.Loopback,
- 1257);
+ NetworkHelpers.FindFreePort ());
sock.Bind (ep1);
SocketType.Stream,
ProtocolType.Tcp);
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
- 1258);
+ NetworkHelpers.FindFreePort ());
listen.Bind (ep);
listen.Listen (1);
SocketType.Stream,
ProtocolType.Tcp);
IPAddress ip = IPAddress.Loopback;
- IPEndPoint ep = new IPEndPoint (ip, 1249);
+ IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
listen.Bind (ep);
listen.Listen (1);
- sock.Connect (ip, 1249);
+ sock.Connect (ip, ep.Port);
Assert.AreEqual (true, sock.Connected, "ConnectAddressPort #1");
SocketType.Stream,
ProtocolType.Tcp);
IPAddress ip = IPAddress.Loopback;
- IPEndPoint ep = new IPEndPoint (ip, 1250);
+ IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
sock.Bind (ep);
sock.Listen (1);
try {
- sock.Connect (ip, 1250);
+ sock.Connect (ip, ep.Port);
Assert.Fail ("ConnectAddressPortListen #1");
} catch (InvalidOperationException) {
} catch {
SocketType.Stream,
ProtocolType.Tcp);
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
- 1251);
+ NetworkHelpers.FindFreePort ());
IPAddress[] ips = new IPAddress[4];
ips[0] = IPAddress.Parse ("127.0.0.4");
listen.Bind (ep);
listen.Listen (1);
- sock.Connect (ips, 1251);
+ sock.Connect (ips, ep.Port);
Assert.AreEqual (true, sock.Connected, "ConnectMultiple #1");
Assert.AreEqual (AddressFamily.InterNetwork, sock.RemoteEndPoint.AddressFamily, "ConnectMultiple #2");
* Bind to IPAddress.Any; Connect() will fail unless it can
* connect to all the addresses in allIps.
*/
- IPEndPoint ep = new IPEndPoint (IPAddress.Any, 1251);
+ IPEndPoint ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
listen.Bind (ep);
listen.Listen (1);
- sock.Connect (allIps, 1251);
+ sock.Connect (allIps, ep.Port);
Assert.AreEqual (true, sock.Connected, "ConnectMultiple2 #1");
Assert.AreEqual (AddressFamily.InterNetwork, sock.RemoteEndPoint.AddressFamily, "ConnectMultiple2 #2");
ProtocolType.Tcp);
IPAddress[] ips = new IPAddress[4];
IPEndPoint ep = new IPEndPoint (IPAddress.Loopback,
- 1252);
+ NetworkHelpers.FindFreePort ());
ips[0] = IPAddress.Parse ("127.0.0.4");
ips[1] = IPAddress.Parse ("127.0.0.3");
sock.Listen (1);
try {
- sock.Connect (ips, 1252);
+ sock.Connect (ips, ep.Port);
Assert.Fail ("ConnectMultipleListen #1");
} catch (InvalidOperationException) {
} catch {
SocketType.Stream,
ProtocolType.Tcp);
IPAddress ip = IPAddress.Loopback;
- IPEndPoint ep = new IPEndPoint (ip, 1253);
+ IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
sock.Bind (ep);
sock.Listen (1);
try {
- sock.Connect ("localhost", 1253);
+ sock.Connect ("localhost", ep.Port);
Assert.Fail ("ConnectHostPortListen #1");
} catch (InvalidOperationException) {
} catch {
SocketType.Stream,
ProtocolType.Tcp);
IPAddress ip = IPAddress.Loopback;
- IPEndPoint ep = new IPEndPoint (ip, 1255);
+ IPEndPoint ep = new IPEndPoint (ip, NetworkHelpers.FindFreePort ());
listen.Bind (ep);
listen.Listen (1);
- sock.Connect (ip, 1255);
+ sock.Connect (ip, ep.Port);
Assert.AreEqual (true, sock.Connected, "Disconnect #1");
{
int i;
- IPEndPoint endpoint = new IPEndPoint(IPAddress.Loopback, 1258);
+ IPEndPoint endpoint = new IPEndPoint(IPAddress.Loopback, NetworkHelpers.FindFreePort ());
Socket listensock = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
listensock.Bind (endpoint);
{
int i;
- IPEndPoint endpoint = new IPEndPoint(IPAddress.Loopback, 1259);
+ IPEndPoint endpoint = new IPEndPoint(IPAddress.Loopback, NetworkHelpers.FindFreePort ());
Socket listensock = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
listensock.Bind (endpoint);
SocketType.Dgram,
ProtocolType.Udp);
CWRSocket.Bind (new IPEndPoint (IPAddress.Loopback,
- 1256));
+ NetworkHelpers.FindFreePort ()));
Thread recv_thread = new Thread (new ThreadStart (CWRReceiveThread));
CWRReady.Reset ();
static bool RRCLastRead = false;
static ManualResetEvent RRCReady = new ManualResetEvent (false);
- private static void RRCClientThread ()
+ private static void RRCClientThread (int port)
{
byte[] bytes = new byte[8];
int readbyte;
SocketType.Stream,
ProtocolType.Tcp);
sock.Connect (new IPEndPoint (IPAddress.Loopback,
- 1257));
+ port));
NetworkStream stream = new NetworkStream (sock);
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
- EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+ EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
try {
s.ReceiveFrom ((Byte []) null, ref remoteEP);
Assert.Fail ("#1");
ProtocolType.Tcp);
s.Close ();
- EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+ EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
try {
s.ReceiveFrom ((Byte []) null, ref remoteEP);
Assert.Fail ("#1");
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
- EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+ EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
try {
s.ReceiveFrom ((Byte []) null, (SocketFlags) 666, ref remoteEP);
Assert.Fail ("#1");
ProtocolType.Tcp);
s.Close ();
- EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+ EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
try {
s.ReceiveFrom ((Byte []) null, (SocketFlags) 666, ref remoteEP);
Assert.Fail ("#1");
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
- EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+ EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
try {
s.ReceiveFrom ((Byte []) null, 0, (SocketFlags) 666,
ref remoteEP);
{
Socket s;
byte [] buffer = new byte [5];
- EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+ EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
// size negative
s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
s.Close ();
- EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+ EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
try {
s.ReceiveFrom ((Byte []) null, -1, (SocketFlags) 666,
ref remoteEP);
{
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
ProtocolType.Tcp);
- EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+ EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
try {
s.ReceiveFrom ((Byte []) null, -1, -1, (SocketFlags) 666,
{
Socket s;
byte [] buffer = new byte [5];
- EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+ EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
// offset negative
s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
{
Socket s;
byte [] buffer = new byte [5];
- EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+ EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
// size negative
s = new Socket (AddressFamily.InterNetwork, SocketType.Stream,
s.Close ();
byte [] buffer = new byte [5];
- EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, 8001);
+ EndPoint remoteEP = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
try {
s.ReceiveFrom (buffer, -1, -1, (SocketFlags) 666,
ref remoteEP);
[Test]
public void ReceiveRemoteClosed ()
{
+ var port = NetworkHelpers.FindFreePort ();
Socket sock = new Socket (AddressFamily.InterNetwork,
SocketType.Stream,
ProtocolType.Tcp);
- sock.Bind (new IPEndPoint (IPAddress.Loopback, 1257));
+ sock.Bind (new IPEndPoint (IPAddress.Loopback, port));
sock.Listen (1);
RRCReady.Reset ();
- Thread client_thread = new Thread (new ThreadStart (RRCClientThread));
+ Thread client_thread = new Thread (() => RRCClientThread (port));
client_thread.Start ();
Socket client = sock.Accept ();
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
s.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
- s.Bind (new IPEndPoint (IPAddress.Any, 12345));
+ var ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
+ s.Bind (ep);
Socket ss = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
ss.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
- ss.Bind (new IPEndPoint (IPAddress.Any, 12345));
+ ss.Bind (new IPEndPoint (IPAddress.Any, ep.Port));
// If we make it this far, we succeeded.
using (Socket ss = new Socket (AddressFamily.InterNetwork,
SocketType.Stream, ProtocolType.Tcp)) {
s.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
-
- s.Bind (new IPEndPoint (IPAddress.Any, 12345));
+ var ep = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
+ s.Bind (ep);
s.Listen(1);
ss.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, true);
Exception ex = null;
try {
- ss.Bind (new IPEndPoint (IPAddress.Any, 12345));
+ ss.Bind (new IPEndPoint (IPAddress.Any, ep.Port));
ss.Listen(1);
} catch (SocketException e) {
ex = e;
[Category ("NotOnMac")]
public void ConnectedProperty ()
{
- TcpListener listener = new TcpListener (IPAddress.Loopback, 23456);
+ TcpListener listener = new TcpListener (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
listener.Start();
Socket client = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- client.Connect (IPAddress.Loopback, 23456);
+ client.Connect (IPAddress.Loopback, ((IPEndPoint)listener.LocalEndpoint).Port);
Socket server = listener.AcceptSocket ();
try {
IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250");
using (Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) {
- s.Bind (new IPEndPoint (IPAddress.Any, 1901));
+ s.Bind (new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ()));
try {
s.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.AddMembership,
new IPv6MulticastOption (mcast_addr));
IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250");
using (Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) {
- s.Bind (new IPEndPoint (IPAddress.Any, 1901));
+ s.Bind (new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ()));
s.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.AddMembership,
new MulticastOption (mcast_addr));
}
IPAddress mcast_addr = IPAddress.Parse ("ff02::1");
using (Socket s = new Socket (AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp)) {
- s.Bind (new IPEndPoint (IPAddress.IPv6Any, 1902));
+ s.Bind (new IPEndPoint (IPAddress.IPv6Any, NetworkHelpers.FindFreePort ()));
s.SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.AddMembership,
new IPv6MulticastOption (mcast_addr));
}
IPAddress mcast_addr = IPAddress.Parse ("ff02::1");
using (Socket s = new Socket (AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp)) {
- s.Bind (new IPEndPoint (IPAddress.IPv6Any, 1902));
+ s.Bind (new IPEndPoint (IPAddress.IPv6Any, NetworkHelpers.FindFreePort ()));
try {
s.SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.AddMembership,
new MulticastOption (mcast_addr));
IPAddress mcast_addr = IPAddress.Parse ("239.255.255.250");
using (Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) {
- s.Bind (new IPEndPoint (IPAddress.Any, 1901));
+ s.Bind (new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ()));
s.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.AddMembership,
new MulticastOption (mcast_addr));
try {
using (Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) {
MulticastOption option = new MulticastOption (mcast_addr);
- s.Bind (new IPEndPoint (IPAddress.Any, 1901));
+ s.Bind (new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ()));
s.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.AddMembership,
option);
s.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.DropMembership,
IPAddress mcast_addr = IPAddress.Parse ("ff02::1");
using (Socket s = new Socket (AddressFamily.InterNetworkV6, SocketType.Dgram, ProtocolType.Udp)) {
- s.Bind (new IPEndPoint (IPAddress.IPv6Any, 1902));
+ s.Bind (new IPEndPoint (IPAddress.IPv6Any, NetworkHelpers.FindFreePort ()));
s.SetSocketOption (SocketOptionLevel.IPv6, SocketOptionName.AddMembership,
new IPv6MulticastOption (mcast_addr));
try {
public void Shutdown_NoConnect ()
{
Socket s = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- s.Bind (new IPEndPoint (IPAddress.Loopback, 0));
+ s.Bind (new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ()));
s.Listen (1);
try {
s.Shutdown (SocketShutdown.Both);
public void ConnectToIPV4EndPointUsingDualModelSocket () {
using (var server = new Socket (SocketType.Stream, ProtocolType.Tcp))
using (var client = new Socket (SocketType.Stream, ProtocolType.Tcp)) {
- var host = new IPEndPoint (IPAddress.Loopback, 0);
+ var host = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
server.Bind (host);
server.Listen (0);
public void BeginConnectToIPV4EndPointUsingDualModelSocket () {
using (var server = new Socket (SocketType.Stream, ProtocolType.Tcp))
using (var client = new Socket (SocketType.Stream, ProtocolType.Tcp)) {
- var host = new IPEndPoint (IPAddress.Loopback, 0);
+ var host = new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ());
server.Bind (host);
server.Listen (0);
Socket listenSocket = new Socket (AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- listenSocket.Bind (new IPEndPoint (IPAddress.Loopback, 0));
+ listenSocket.Bind (new IPEndPoint (IPAddress.Loopback, NetworkHelpers.FindFreePort ()));
listenSocket.Listen (1);
listenSocket.BeginAccept (new AsyncCallback (ReceiveCallback), listenSocket);
/* see https://bugzilla.xamarin.com/show_bug.cgi?id=36941 */
using (Socket socket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp)) {
- IPEndPoint end_point = new IPEndPoint (IPAddress.Any, 11000);
+ IPEndPoint end_point = new IPEndPoint (IPAddress.Any, NetworkHelpers.FindFreePort ());
socket.SetSocketOption (SocketOptionLevel.Socket, SocketOptionName.ReuseAddress, 1);
socket.Bind (end_point);
socket.SetSocketOption (SocketOptionLevel.IP, SocketOptionName.MulticastTimeToLive, 19);
endif
# System.IO/DirectoryInfoTest.cs needs Mono.Posix
-TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe $(CORLIB_MONO_POSIX_REF) -r:System.Core.dll \
+TEST_MCS_FLAGS += -debug -nowarn:168,219,618,672 -unsafe $(CORLIB_MONO_POSIX_REF) -r:System.Core.dll -r:System.dll \
-define:MONO_DATACONVERTER_STATIC_METHODS $(TEST_RESX_RESOURCES:%=-resource:%)
EXTRA_DISTFILES = \
include $(topdir)/build/library.make
-ifdef FIXME_CORLIB_CMP
-# corlib_cmp
-corlib_flags = -unsafe -nostdlib
-cmplib = $(topdir)/class/lib/$(PROFILE)/corlib_cmp.dll
-cmppdb = $(cmplib:.dll=.pdb)
-cmp_response = $(depsdir)/$(PROFILE)_corlib_cmp.dll.response
-cmp_makefrag = $(depsdir)/$(PROFILE)_corlib_cmp.dll.makefrag
-cmp_flags = -r:$(PLATFORM_CORLIB) $(corlib_flags)
-
-EXTRA_DISTFILES += corlib_cmp.dll.excludes
-CLEAN_FILES += $(cmplib) $(cmp_response) $(cmp_makefrag) $(cmppdb)
-
-$(cmplib): $(cmp_makefrag) $(cmp_response)
- $(BOOT_COMPILE) $(LIBRARY_FLAGS) $(cmp_flags) -target:library -out:$@ @$(cmp_response)
-
-$(cmp_response): $(sourcefile) corlib_cmp.dll.excludes
- @echo Creating $@ ...
- @sort $(sourcefile) corlib_cmp.dll.excludes | uniq -u | $(PLATFORM_CHANGE_SEPARATOR_CMD) >$@
-
-$(cmp_makefrag): $(cmp_response)
- @echo Creating $@ ...
- @sed 's,^,$(cmplib): ,' $< >$@
-
-# Since we make corlib_cmp on demand, there isn't a real need
-# to have full dep tracking for it. Also, the generation of this
-# file is busted on Win32 ('sort' seems to mess up line endings),
-# leading to a broken build.
-#
-# -include $(cmp_makefrag)
-
-$(cmp_response) $(cmp_makefrag): Makefile $(depsdir)/.stamp
-endif
-
$(TEST_RESX_RESOURCES) $(TEST_RESX_RESOURCES_SATELITE): %.resources: %.resx
$(RESGEN) $< || cp $@.prebuilt $@
n = 2;
break;
case '7':
+#if PCL
+ e = Encoding.GetEncoding ("utf-7");
+#else
e = Encoding.UTF7;
+#endif
n = 1;
break;
case 'b':
n = 2;
break;
case '3':
+#if PCL
+ e = Encoding.GetEncoding ("utf-32");
+#else
e = Encoding.GetEncoding (12000);
+#endif
n = 4;
break;
case '4':
+#if PCL
+ e = Encoding.GetEncoding ("utf-32BE");
+#else
e = Encoding.GetEncoding (12001);
+#endif
n = 4;
break;
{
if (destFileName == null)
throw new ArgumentNullException ("destFileName");
- if (destFileName == Name || destFileName == FullName)
+ if (destFileName.Length == 0)
+ throw new ArgumentException ("An empty file name is not valid.", "destFileName");
+
+ var destFullPath = Path.GetFullPath (destFileName);
+ if (destFullPath == FullPath)
return;
if (!File.Exists (FullPath))
throw new FileNotFoundException ();
- File.Move (FullPath, destFileName);
- this.FullPath = Path.GetFullPath (destFileName);
+ File.Move (FullPath, destFullPath);
+ this.FullPath = destFullPath;
}
public FileInfo CopyTo (string destFileName)
throw new NotSupportedException ();
}
+ public override ParameterInfo ReturnParameter {
+ get {
+ throw new NotSupportedException();
+ }
+ }
+
public override ICustomAttributeProvider ReturnTypeCustomAttributes {
get {
throw new NotSupportedException ();
+++ /dev/null
-//
-// System.Reflection/MethodInfo.cs
-//
-// Author:
-// Paolo Molaro (lupus@ximian.com)
-//
-// (C) 2001 Ximian, Inc. http://www.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.Diagnostics;
-using System.Runtime.CompilerServices;
-using System.Runtime.InteropServices;
-
-namespace System.Reflection {
-
- [ComVisible (true)]
- [ComDefaultInterfaceAttribute (typeof (_MethodInfo))]
- [Serializable]
- [ClassInterface(ClassInterfaceType.None)]
-#if MOBILE
- public abstract class MethodInfo: MethodBase {
-#else
- public abstract class MethodInfo: MethodBase, _MethodInfo {
-#endif
- public abstract MethodInfo GetBaseDefinition();
-
- internal virtual MethodInfo GetBaseMethod ()
- {
- return this;
- }
-
- protected MethodInfo() {
- }
-
-
- public override MemberTypes MemberType { get {return MemberTypes.Method;} }
-
- public virtual Type ReturnType {
- get { return null; }
- }
-
- public abstract ICustomAttributeProvider ReturnTypeCustomAttributes { get; }
-
-#if !MOBILE
- void _MethodInfo.GetIDsOfNames ([In] ref Guid riid, IntPtr rgszNames, uint cNames, uint lcid, IntPtr rgDispId)
- {
- throw new NotImplementedException ();
- }
-
- Type _MethodInfo.GetType ()
- {
- // Required or object::GetType becomes virtual final
- return base.GetType ();
- }
-
- void _MethodInfo.GetTypeInfo (uint iTInfo, uint lcid, IntPtr ppTInfo)
- {
- throw new NotImplementedException ();
- }
-
- void _MethodInfo.GetTypeInfoCount (out uint pcTInfo)
- {
- throw new NotImplementedException ();
- }
-
- void _MethodInfo.Invoke (uint dispIdMember, [In] ref Guid riid, uint lcid, short wFlags, IntPtr pDispParams, IntPtr pVarResult, IntPtr pExcepInfo, IntPtr puArgErr)
- {
- throw new NotImplementedException ();
- }
-#endif
-
- [ComVisible (true)]
- public virtual MethodInfo GetGenericMethodDefinition ()
- {
- throw new NotSupportedException ();
- }
-
- public virtual MethodInfo MakeGenericMethod (params Type [] typeArguments)
- {
- throw new NotSupportedException (this.GetType().ToString ());
- }
-
- // GetGenericArguments, IsGenericMethod, IsGenericMethodDefinition
- // and ContainsGenericParameters are implemented in the derived classes.
- [ComVisible (true)]
- public override Type [] GetGenericArguments () {
- return Type.EmptyTypes;
- }
-
-
- public virtual ParameterInfo ReturnParameter {
- get {
- throw new NotSupportedException ();
- }
- }
-
- public override bool Equals (object obj)
- {
- return obj == (object) this;
- }
-
- public override int GetHashCode ()
- {
- return base.GetHashCode ();
- }
-
- public static bool operator == (MethodInfo left, MethodInfo right)
- {
- if ((object)left == (object)right)
- return true;
- if ((object)left == null ^ (object)right == null)
- return false;
- return left.Equals (right);
- }
-
- public static bool operator != (MethodInfo left, MethodInfo right)
- {
- if ((object)left == (object)right)
- return false;
- if ((object)left == null ^ (object)right == null)
- return true;
- return !left.Equals (right);
- }
-
- public virtual Delegate CreateDelegate (Type delegateType)
- {
- return Delegate.CreateDelegate (delegateType, this);
- }
-
- public virtual Delegate CreateDelegate (Type delegateType, object target)
- {
- return Delegate.CreateDelegate (delegateType, target, this);
- }
- }
-}
return sbName.ToString();
}
+ public override Delegate CreateDelegate (Type delegateType)
+ {
+ return Delegate.CreateDelegate (delegateType, this);
+ }
+
+ public override Delegate CreateDelegate (Type delegateType, object target)
+ {
+ return Delegate.CreateDelegate (delegateType, target, this);
+ }
+
public override String ToString()
{
return ReturnType.FormatTypeName() + " " + FormatNameAndSig(false);
}
}
+ [Test] //Covers #18361
+ public void MoveTo_SameName ()
+ {
+ string name = "FIT.MoveTo.SameName.Test";
+ string path1 = TempFolder + DSC + name;
+ string path2 = name;
+ DeleteFile (path1);
+ DeleteFile (path2);
+
+ try {
+ File.Create (path1).Close ();
+ FileInfo info1 = new FileInfo (path1);
+ FileInfo info2 = new FileInfo (path2);
+ Assert.IsTrue (info1.Exists, "#A1");
+ Assert.IsFalse (info2.Exists, "#A2");
+
+ info1.MoveTo (path2);
+ info1 = new FileInfo (path1);
+ info2 = new FileInfo (path2);
+ Assert.IsFalse (info1.Exists, "#B1");
+ Assert.IsTrue (info2.Exists, "#B2");
+ } finally {
+ DeleteFile (path1);
+ DeleteFile (path2);
+ }
+ }
+
[Test]
public void MoveTo_DestFileName_AlreadyExists ()
{
}
+ [Test]
+ public void OpenCharDeviceRepeatedly ()
+ {
+ // https://bugzilla.xamarin.com/show_bug.cgi?id=38408
+ try {
+ using (var f = new FileStream ("/dev/zero", FileMode.Open))
+ {
+ }
+ } catch (FileNotFoundException) {
+ // Only run this test on platforms where /dev/zero exists
+ Assert.Ignore();
+ }
+
+ // this shouldn't throw
+ using (var g = new FileStream ("/dev/zero", FileMode.Open))
+ {
+ }
+ }
+
#if !MOBILE
[Test]
public void WriteWithExposedHandle ()
Assert.AreEqual (0x32, (int) s [5], "#B7");
}
- // UTF8 decoding tests from http://www.cl.cam.ac.uk/~mgk25/
+ //
+ // UTF8 decoding tests are based on the test file from http://www.cl.cam.ac.uk/~mgk25/
+ // The test file is: https://www.cl.cam.ac.uk/~mgk25/ucs/examples/UTF-8-test.txt
+ // which is licensed under CC-by-4.0: https://creativecommons.org/licenses/by/4.0/
+ //
+ // The file is not copied verbatim, instead individual
+ // tests are based on individual portions of that file
+ //
[Test]
public void T1_Correct_GreekWord_kosme ()
using System.Reflection;
using System.Threading;
+#if !MOBILE
+using System.Diagnostics;
+#endif
+
using NUnit.Framework;
namespace MonoTests.System
}
}
+ // Several tests in this file, to run properly, allocate 4GB objects.
+ // Obviously this creates problems on several kinds of systems, so we
+ // conservatively skip these tests unless we find a high-RAM environment.
+ // Checking RAM requires PerformanceCounter which is absent on mobile,
+ // so any test that calls this must be category MobileNotWorking.
+ static void RequireHighMemoryTestEnvironment ()
+ {
+#if MOBILE
+ Assert.Ignore("PerformanceCounter not available.");
+#else
+ if (!Environment.Is64BitProcess)
+ Assert.Ignore("This test cannot run on a 32-bit system.");
+
+ // Require 6 GB physical RAM, for the 4GB string plus 2GB headroom
+ var pc = new PerformanceCounter ("Mono Memory", "Total Physical Memory");
+
+ if (pc.RawValue < 6L*1024L*1024L*1024L)
+ Assert.Ignore("This machine may not have enough RAM to run this test.");
+#endif
+ }
+
[Test] // ctor (Char, Int32)
+ [Category ("MobileNotWorking")]
public void Constructor4_LargeString ()
{
- try {
- var x = new String ('A', int.MaxValue);
- if (Environment.Is64BitProcess) {
- Assert.AreEqual ('A', x[0]);
- Assert.AreEqual ('A', x[int.MaxValue - 1]);
- }
- else
- Assert.Fail ("Expected OutOfMemoryException.");
- } catch (OutOfMemoryException) {
- }
+ RequireHighMemoryTestEnvironment();
+
+ var x = new String ('A', int.MaxValue);
+ Assert.AreEqual ('A', x[0]);
+ Assert.AreEqual ('A', x[int.MaxValue - 1]);
}
[Test] // ctor (Char [], Int32, Int32)
}
[Test]
+ [Category ("MobileNotWorking")]
public void PadLeft_LargeString ()
{
- try {
- var x = "x".PadLeft (int.MaxValue, '-');
- if (Environment.Is64BitProcess) {
- Assert.AreEqual ('-', x[0]);
- Assert.AreEqual ('x', x[int.MaxValue - 1]);
- }
- else
- Assert.Fail ("Expected OutOfMemoryException.");
- } catch (OutOfMemoryException) {
- }
+ RequireHighMemoryTestEnvironment();
+
+ var x = "x".PadLeft (int.MaxValue, '-');
+ Assert.AreEqual ('-', x[0]);
+ Assert.AreEqual ('x', x[int.MaxValue - 1]);
}
[Test] // PadRight (Int32)
}
[Test]
+ [Category ("MobileNotWorking")]
public void PadRight_LargeString ()
{
- try {
- var x = "x".PadRight (int.MaxValue, '-');
- if (Environment.Is64BitProcess) {
- Assert.AreEqual ('x', x[0]);
- Assert.AreEqual ('-', x[int.MaxValue - 1]);
- }
- else
- Assert.Fail ("Expected OutOfMemoryException.");
- } catch (OutOfMemoryException) {
- }
+ RequireHighMemoryTestEnvironment();
+
+ var x = "x".PadRight (int.MaxValue, '-');
+ Assert.AreEqual ('x', x[0]);
+ Assert.AreEqual ('-', x[int.MaxValue - 1]);
}
[Test] // Remove (Int32, Int32)
<Compile Include="..\..\..\external\referencesource\mscorlib\system\action.cs" />\r
<Compile Include="..\..\..\external\referencesource\mscorlib\system\activator.cs" />\r
<Compile Include="..\..\..\external\referencesource\mscorlib\system\AggregateException.cs" />\r
+ <Compile Include="..\..\..\external\referencesource\mscorlib\system\AppContext\AppContext.cs" />\r
<Compile Include="..\..\..\external\referencesource\mscorlib\system\appdomainattributes.cs" />\r
<Compile Include="..\..\..\external\referencesource\mscorlib\system\appdomainunloadedexception.cs" />\r
<Compile Include="..\..\..\external\referencesource\mscorlib\system\applicationexception.cs" />\r
<Compile Include="System.Security\PermissionBuilder.cs" />\r
<Compile Include="System.Security\PermissionSet.cs" />\r
<Compile Include="System.Security\PolicyLevelType.cs" />\r
+ <Compile Include="System.Security\SafeAccessTokenHandle.cs" />\r
<Compile Include="System.Security\SecureString.cs" />\r
<Compile Include="System.Security\SecurityElement.cs" />\r
<Compile Include="System.Security\SecurityException.cs" />\r
<Compile Include="System\__ComObject.cs" />\r
<Compile Include="System\ActivationContext.cs" />\r
<Compile Include="System\AndroidPlatform.cs" />\r
- <Compile Include="System\AppContext.cs" />\r
<Compile Include="System\AppDomain.cs" />\r
<Compile Include="System\AppDomainInitializer.cs" />\r
<Compile Include="System\AppDomainManager.cs" />\r
System.Reflection/ImageFileMachine.cs
System.Reflection/LocalVariableInfo.cs
System.Reflection/MethodBody.cs
-System.Reflection/MethodInfo.cs
System.Reflection/Module.cs
System.Reflection/ModuleResolveEventHandler.cs
System.Reflection/MonoAssembly.cs
../../../external/referencesource/mscorlib/system/reflection/methodbase.cs
../../../external/referencesource/mscorlib/system/reflection/methodbody.cs
../../../external/referencesource/mscorlib/system/reflection/methodimplattributes.cs
+../../../external/referencesource/mscorlib/system/reflection/methodinfo.cs
../../../external/referencesource/mscorlib/system/reflection/missing.cs
../../../external/referencesource/mscorlib/system/reflection/obfuscateassemblyattribute.cs
../../../external/referencesource/mscorlib/system/reflection/obfuscationattribute.cs
// Win32 version info values
string vi_product, vi_product_version, vi_company, vi_copyright, vi_trademark;
+ string pa_file_version, pa_assembly_version;
protected AssemblyDefinition (ModuleContainer module, string name)
{
SetCustomAttribute (ctor, cdata);
} else {
builder_extra.SetVersion (vinfo, a.Location);
+ pa_assembly_version = vinfo.ToString ();
}
return;
} else if (a.Type == pa.RuntimeCompatibility) {
wrap_non_exception_throws_custom = true;
} else if (a.Type == pa.AssemblyFileVersion) {
- vi_product_version = a.GetString ();
- if (string.IsNullOrEmpty (vi_product_version) || IsValidAssemblyVersion (vi_product_version, false) == null) {
+ pa_file_version = a.GetString ();
+ if (string.IsNullOrEmpty (pa_file_version) || IsValidAssemblyVersion (pa_file_version, false) == null) {
Report.Warning (7035, 1, a.Location, "The specified version string `{0}' does not conform to the recommended format major.minor.build.revision",
- vi_product_version, a.Name);
+ pa_file_version, a.Name);
return;
}
// File version info decoding from blob is not supported
- var cab = new CustomAttributeBuilder ((ConstructorInfo) ctor.GetMetaInfo (), new object[] { vi_product_version });
+ var cab = new CustomAttributeBuilder ((ConstructorInfo)ctor.GetMetaInfo (), new object [] { pa_file_version });
Builder.SetCustomAttribute (cab);
return;
} else if (a.Type == pa.AssemblyProduct) {
vi_trademark = a.GetString ();
} else if (a.Type == pa.Debuggable) {
has_user_debuggable = true;
+ } else if (a.Type == pa.AssemblyInformationalVersion) {
+ vi_product_version = a.GetString ();
}
//
if (Compiler.Settings.Win32ResourceFile != null) {
Builder.DefineUnmanagedResource (Compiler.Settings.Win32ResourceFile);
} else {
- Builder.DefineVersionInfoResource (vi_product, vi_product_version, vi_company, vi_copyright, vi_trademark);
+ Builder.DefineVersionInfoResource (vi_product,
+ vi_product_version ?? pa_file_version ?? pa_assembly_version,
+ vi_company,
+ vi_copyright,
+ vi_trademark);
}
if (Compiler.Settings.Win32IconFile != null) {
public readonly PredefinedAttribute AssemblyAlgorithmId;
public readonly PredefinedAttribute AssemblyFlags;
public readonly PredefinedAttribute AssemblyFileVersion;
+ public readonly PredefinedAttribute AssemblyInformationalVersion;
public readonly PredefinedAttribute ComImport;
public readonly PredefinedAttribute CoClass;
public readonly PredefinedAttribute AttributeUsage;
AssemblyCompany = new PredefinedAttribute (module, "System.Reflection", "AssemblyCompanyAttribute");
AssemblyCopyright = new PredefinedAttribute (module, "System.Reflection", "AssemblyCopyrightAttribute");
AssemblyTrademark = new PredefinedAttribute (module, "System.Reflection", "AssemblyTrademarkAttribute");
+ AssemblyInformationalVersion = new PredefinedAttribute (module, "System.Reflection", "AssemblyInformationalVersionAttribute");
AsyncStateMachine = new PredefinedStateMachineAttribute (module, "System.Runtime.CompilerServices", "AsyncStateMachineAttribute");
public override Expression CreateExpressionTree (ResolveContext ec)
{
- MemberAccess ma = new MemberAccess (new MemberAccess (new QualifiedAliasMember ("global", "System", loc), "Delegate", loc), "CreateDelegate", loc);
-
- Arguments args = new Arguments (3);
+ Arguments args = new Arguments (2);
args.Add (new Argument (new TypeOf (type, loc)));
if (method_group.InstanceExpression == null)
else
args.Add (new Argument (method_group.InstanceExpression));
- args.Add (new Argument (method_group.CreateExpressionTree (ec)));
+ Expression ma;
+ var create_v45 = ec.Module.PredefinedMembers.MethodInfoCreateDelegate.Get ();
+ if (create_v45 != null) {
+ //
+ // .NET 4.5 has better API but it produces different instance than Delegate::CreateDelegate
+ // and because csc uses this enhancement we have to as well to be fully compatible
+ //
+ var mg = MethodGroupExpr.CreatePredefined (create_v45, create_v45.DeclaringType, loc);
+ mg.InstanceExpression = method_group.CreateExpressionTree (ec);
+ ma = mg;
+ } else {
+ ma = new MemberAccess (new MemberAccess (new QualifiedAliasMember ("global", "System", loc), "Delegate", loc), "CreateDelegate", loc);
+ args.Add (new Argument (method_group.CreateExpressionTree (ec)));
+ }
+
Expression e = new Invocation (ma, args).Resolve (ec);
if (e == null)
return null;
public readonly PredefinedMember<MethodSpec> FixedBufferAttributeCtor;
public readonly PredefinedMember<MethodSpec> MethodInfoGetMethodFromHandle;
public readonly PredefinedMember<MethodSpec> MethodInfoGetMethodFromHandle2;
+ public readonly PredefinedMember<MethodSpec> MethodInfoCreateDelegate;
public readonly PredefinedMember<MethodSpec> MonitorEnter;
public readonly PredefinedMember<MethodSpec> MonitorEnter_v4;
public readonly PredefinedMember<MethodSpec> MonitorExit;
MethodInfoGetMethodFromHandle2 = new PredefinedMember<MethodSpec> (module, types.MethodBase,
"GetMethodFromHandle", MemberKind.Method, types.RuntimeMethodHandle, new PredefinedType (btypes.RuntimeTypeHandle));
+ MethodInfoCreateDelegate = new PredefinedMember<MethodSpec> (module, types.MethodInfo,
+ "CreateDelegate", MemberKind.Method,
+ new PredefinedType (btypes.Type), new PredefinedType (btypes.Object));
+
MonitorEnter = new PredefinedMember<MethodSpec> (module, types.Monitor, "Enter", btypes.Object);
MonitorEnter_v4 = new PredefinedMember<MethodSpec> (module, types.Monitor,
int TestInstance ()
{
Expression<Func<EmptyDelegate>> e = () => M;
- if (e.Body.ToString () != "Convert(CreateDelegate(EmptyDelegate, value(C), Void M()))")
+ if (e.Body.ToString () != "Convert(Void M().CreateDelegate(EmptyDelegate, value(C)))")
return 1;
e.Compile () ();
Expression<Func<C, EmptyDelegate>> e2 = (l) => l.M;
- if (e2.Body.ToString () != "Convert(CreateDelegate(EmptyDelegate, l, Void M()))")
+ if (e2.Body.ToString () != "Convert(Void M().CreateDelegate(EmptyDelegate, l))")
return 2;
e2.Compile () (this);
public static int Main ()
{
Expression<Func<EmptyDelegate>> e = () => new EmptyDelegate (Test);
-
- if (e.Body.ToString () != "Convert(CreateDelegate(EmptyDelegate, null, Void Test()))")
+ if (e.Body.ToString () != "Convert(Void Test().CreateDelegate(EmptyDelegate, null))")
return 1;
var v = e.Compile ();
return 2;
Expression<Func<EmptyDelegate>> e2 = () => Test;
- if (e2.Body.ToString () != "Convert(CreateDelegate(EmptyDelegate, null, Void Test()))")
+ if (e2.Body.ToString () != "Convert(Void Test().CreateDelegate(EmptyDelegate, null))")
return 3;
var v2 = e2.Compile ();
unsafe {
Expression<Func<UnsafeDelegate>> e3 = () => new UnsafeDelegate (Foo);
- if (e3.Body.ToString () != "Convert(CreateDelegate(UnsafeDelegate, null, Int32* Foo()))")
+ if (e3.Body.ToString () != "Convert(Int32* Foo().CreateDelegate(UnsafeDelegate, null))")
return 5;
var v3 = e3.Compile ();
--- /dev/null
+using System;
+using System.Linq.Expressions;
+
+class X
+{
+ class HasAction
+ {
+ public void Start ()
+ {
+ }
+ }
+
+ public static int Main ()
+ {
+ var expectedObject = typeof (HasAction).GetMethod("Start");
+
+ Expression<Func<HasAction, Action>> methodToUse = r => r.Start;
+
+ UnaryExpression unary = methodToUse.Body as UnaryExpression;
+ MethodCallExpression methodCall = unary.Operand as MethodCallExpression;
+ ConstantExpression constantExpression = methodCall.Object as ConstantExpression;
+
+ if (expectedObject != constantExpression.Value)
+ return 1;
+
+ if (methodCall.Object == null)
+ return 2;
+
+ return 0;
+ }
+}
\ No newline at end of file
if (fvi.FileVersion != "2011.02.0.0")
return 1;
+ if (fvi.ProductVersion != "2011.02.0.0")
+ return 2;
+
return 0;
}
}
\ No newline at end of file
<size>102</size>
</method>
<method name="Void ConvertTest_12()" attrs="129">
- <size>142</size>
+ <size>141</size>
</method>
<method name="Void ConvertTest_13()" attrs="129">
<size>87</size>
<size>313</size>
</method>
<method name="Void EqualTestDelegate_3()" attrs="129">
- <size>230</size>
+ <size>229</size>
</method>
<method name="Void ExclusiveOrTest()" attrs="129">
<size>116</size>
<size>2</size>
</method>
<method name="Int32 TestInstance()" attrs="129">
- <size>339</size>
+ <size>337</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>583</size>
+ <size>580</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
<size>9</size>
</method>
<method name="Int32 Main()" attrs="150">
- <size>222</size>
+ <size>221</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
</method>
</type>
</test>
+ <test name="gtest-etree-31.cs">
+ <type name="X">
+ <method name="Int32 Main()" attrs="150">
+ <size>241</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ <type name="X+HasAction">
+ <method name="Void Start()" attrs="134">
+ <size>2</size>
+ </method>
+ <method name="Void .ctor()" attrs="6278">
+ <size>7</size>
+ </method>
+ </type>
+ </test>
<test name="gtest-exmethod-01.cs">
<type name="SimpleTest">
<method name="System.String Prefix(System.String, System.String)" attrs="150">
<test name="test-892.cs">
<type name="X">
<method name="Int32 Main()" attrs="150">
- <size>66</size>
+ <size>94</size>
</method>
<method name="Void .ctor()" attrs="6278">
<size>7</size>
+++ /dev/null
-/EnumCheck.cs -crlf
-/EnumCheckAssemblyCollection.cs -crlf
-/GenerateDelegate.cs -crlf
-/IFaceDisco.cs -crlf
-/XMLUtil.cs -crlf
+++ /dev/null
-/**\r
- * Namespace: System.Web\r
- * Class: EnumCheck\r
- *\r
- * Author: Gaurav Vaish\r
- * Contact: <gvaish@iitk.ac.in>\r
- * Status: 100%\r
- *\r
- * (C) Gaurav Vaish (2002)\r
- */\r
-\r
-using System;\r
-using System.Xml;\r
-using System.Collections;\r
-using System.Reflection;\r
-\r
-namespace Mono.Enumerations\r
-{\r
- public class EnumCheck\r
- {\r
- private string className;\r
- private Type type;\r
- private EnumCheckAssemblyCollection ecac = new EnumCheckAssemblyCollection();\r
- \r
- public static string confFile = "assemblies.xml";\r
-\r
- public EnumCheck(string className)\r
- {\r
- this.className = className;\r
- ecac.Parse();\r
- }\r
-\r
- public void Display()\r
- {\r
- ecac.ConfigFile = confFile;\r
- LoadType();\r
- if(type == null || !type.IsEnum)\r
- {\r
- System.Console.Write("-->Failed to load the enumeration: " + className);\r
- return;\r
- }\r
- Array ar = Enum.GetValues(type);\r
- System.Console.WriteLine("-->Enumeration: {0}", type.ToString());\r
- for(int i=0; i < ar.Length; i++)\r
- {\r
- Enum b = (Enum)ar.GetValue(i);\r
- System.Console.Write(" {0}", Enum.Format(type, b, "G"));\r
- System.Console.WriteLine(" ({0}) ", Enum.Format(type, b, "D"));\r
- }\r
- }\r
-\r
- private void LoadType()\r
- {\r
- type = null;\r
- foreach(string url in ecac)\r
- {\r
- try\r
- {\r
- Assembly assembly = Assembly.LoadFrom(url);\r
- foreach(Type t in assembly.GetTypes())\r
- {\r
- if(!t.IsEnum)\r
- continue;\r
- if(className == t.ToString())\r
- {\r
- type = t;\r
- break;\r
- }\r
- }\r
- } catch(BadImageFormatException)\r
- {\r
- } catch(ReflectionTypeLoadException)\r
- {\r
- } catch(ArgumentException)\r
- {\r
- }\r
- if(type != null)\r
- return;\r
- }\r
- }\r
-\r
- public static void PrintUsage()\r
- {\r
- System.Console.WriteLine("Usage:");\r
- System.Console.WriteLine("EnumCheck [<enum> [<enum> [... ] ] ]");\r
- System.Console.WriteLine("");\r
- System.Console.WriteLine("enum := <namespace>[.<subnamespace>[...]].enum_name");\r
- System.Console.WriteLine("");\r
- }\r
-\r
- public static void Main(string[] args)\r
- {\r
- if(args.Length > 0 && (args[0] == "--help" || args[0] == "-h"))\r
- {\r
- PrintUsage();\r
- return;\r
- }\r
- EnumCheck check = null;\r
- string bdir;\r
- System.Console.Write("Enter assembly configuration file [{0}]:", confFile);\r
- //System.Console.Write("[{0}]: ", confFile);\r
- bdir = System.Console.ReadLine();\r
- while(bdir.EndsWith("/") || bdir.EndsWith("\\"))\r
- {\r
- bdir = bdir.Substring(0, bdir.Length - 1);\r
- }\r
- if(bdir != "")\r
- {\r
- confFile = bdir;\r
- }\r
- if(args.Length != 0)\r
- {\r
- foreach(string clName in args)\r
- {\r
- check = new EnumCheck(clName);\r
- check.Display();\r
- System.Console.WriteLine("\n");\r
- }\r
- }\r
- while(true)\r
- {\r
- System.Console.Write("Enter the name of the Enumeration (end to stop): ");\r
- string clName = System.Console.ReadLine();\r
- if(clName == "stop" || clName == "end" || clName.Length == 0)\r
- break;\r
- check = new EnumCheck(clName);\r
- check.Display();\r
- System.Console.WriteLine("\n");\r
- }\r
- }\r
- }\r
-}\r
+++ /dev/null
-/**\r
- * Namespace: System.Web\r
- * Class: EnumCheckAssembly\r
- *\r
- * Author: Gaurav Vaish\r
- * Contact: <gvaish@iitk.ac.in>\r
- * Status: 100%\r
- *\r
- * (C) Gaurav Vaish (2002)\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-using System.Xml;\r
-using System.Collections;\r
-using System.Reflection;\r
-\r
-namespace Mono.Enumerations\r
-{\r
- public class EnumCheckAssemblyCollection: IEnumerable\r
- {\r
- public string ConfigFile = "assemblies.xml";\r
- \r
- private ArrayList assemblyList = new ArrayList();\r
-\r
- public EnumCheckAssemblyCollection()\r
- {\r
- }\r
-\r
- public void Parse()\r
- {\r
- Stream fStream;\r
- XmlReader reader;\r
- XmlDocument document;\r
- string url;\r
-\r
- fStream = new FileStream(ConfigFile, FileMode.Open, FileAccess.Read, FileShare.Read);\r
- reader = new XmlTextReader(fStream);\r
- document = new XmlDocument();\r
- document.Load(reader);\r
- if(document.DocumentElement != null)\r
- {\r
- if(document.DocumentElement.LocalName == "assemblies")\r
- {\r
- foreach(XmlNode pathNode in document.DocumentElement)\r
- {\r
- if(pathNode.NodeType == XmlNodeType.Element && pathNode.LocalName=="path")\r
- {\r
- url = pathNode.Attributes["url"].Value;\r
- while(url.EndsWith("\\") || url.EndsWith("/"))\r
- {\r
- url = url.Substring(0, url.Length - 1);\r
- }\r
- if(url == null || url.Length == 0)\r
- {\r
- continue;\r
- }\r
- foreach(XmlNode assemblyNode in pathNode.ChildNodes)\r
- {\r
- if(assemblyNode.LocalName == "assembly")\r
- {\r
- assemblyList.Add(url + "\\" + assemblyNode.Attributes["file"].Value);\r
- }\r
- }\r
- }\r
- }\r
- }\r
- }\r
- fStream.Close();\r
- }\r
-\r
- public IEnumerator GetEnumerator()\r
- {\r
- return assemblyList.GetEnumerator();\r
- }\r
- }\r
-}\r
+++ /dev/null
-/**\r
- * Namespace: com.mastergaurav.utils\r
- * Class: GenerateDelegate\r
- *\r
- * Author: Gaurav Vaish\r
- * Maintainer: gvaish@iitk.ac.in\r
- * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>\r
- * Implementation: yes\r
- * Status: 100%\r
- *\r
- * (C) Gaurav Vaish (2001)\r
- */\r
-\r
-using System;\r
-using System.IO;\r
-\r
-namespace com.mastergaurav.Utils\r
-{\r
- public class GenerateDelegate\r
- {\r
- public static string TargetDirectory = String.Empty;\r
- public static string NamespaceName = String.Empty;\r
-\r
- public static readonly string PROLOGUE = "/**\n * Namespace: ";\r
- public static readonly string DETAILS = " *\n * Author: Gaurav Vaish\n" +\r
- " * Maintainer: gvaish@iitk.ac.in\n" +\r
- " * Contact: <my_scripts2001@yahoo.com>, <gvaish@iitk.ac.in>\n" +\r
- " * Implementation: yes\n" +\r
- " * Status: 100%\n" +\r
- " *\n" +\r
- " * (C) Gaurav Vaish (2002)\n" +\r
- " */\n\n";\r
- public static readonly string USING = "using System;\n" +\r
- "using System.Web;\n" +\r
- "using System.Web.UI;\n\n";\r
-\r
- public static readonly string NAMESPACE = "namespace ";\r
-\r
- public static string AskForNamespace()\r
- {\r
- string nm = String.Empty;\r
- System.Console.Write("Enter the name of the namespace: ");\r
- nm = System.Console.ReadLine();\r
- return nm;\r
- }\r
-\r
- public static string AskForMore()\r
- {\r
- string del = String.Empty;\r
- System.Console.Write("Enter the name of the delegate (end to stop): ");\r
- del = System.Console.ReadLine();\r
- if(del == String.Empty || del == "end")\r
- return String.Empty;\r
- return del;\r
- }\r
-\r
- public static void Generate(string delName)\r
- {\r
- string fileName = TargetDirectory + "\\" + delName + "EventHandler.cs";\r
- System.Console.Write("File: ");//, fileName);\r
- System.Console.Write(fileName);\r
- System.Console.Write("\tGenerating");\r
-\r
- StreamWriter writer;\r
- try\r
- {\r
- Stream stream = new FileStream(fileName, FileMode.Truncate, FileAccess.Write);\r
- writer = new StreamWriter(stream);\r
- } catch(FileNotFoundException)\r
- {\r
- writer = File.CreateText(fileName);\r
- }\r
- if(writer == null)\r
- {\r
- System.Console.WriteLine("Null writer...\n");\r
- return;\r
- }\r
- writer.Write(PROLOGUE);\r
- writer.Write(NamespaceName + "\n");\r
- writer.Write(DETAILS);\r
- writer.Write(NAMESPACE);\r
- writer.Write(NamespaceName + "\n");\r
- writer.Write("{\n");\r
- writer.Write("\tpublic delegate void ");\r
- writer.Write(delName);\r
- writer.Write("EventHandler(object sender, ");\r
- writer.Write(delName);\r
- writer.Write("EventArgs e);\n");\r
- writer.Write("}");\r
-\r
- writer.Flush();\r
- writer.Close();\r
-\r
- System.Console.WriteLine("\tGenerated\n");\r
- }\r
-\r
- public static string GetTargetDir()\r
- {\r
- System.Console.Write("Enter target directory: ");\r
- return System.Console.ReadLine();\r
- }\r
-\r
- public static void Usage(bool wrong)\r
- {\r
- if(wrong)\r
- {\r
- System.Console.WriteLine("Wrong # arguments.");\r
- }\r
- System.Console.WriteLine("Usage: GenerateDelegate [target-dir] [namespace] [delegate1 [delegate2 [...]]]");\r
- }\r
-\r
- public static bool IsHelp(string arg)\r
- {\r
- return (arg == "-h" || arg == "--help");\r
- }\r
-\r
- public static bool IsDirectory(string dirName)\r
- {\r
- FileAttributes attrs;\r
- try\r
- {\r
- attrs = File.GetAttributes(dirName);\r
- if( (attrs & FileAttributes.Directory) != FileAttributes.Directory)\r
- {\r
- Usage(true);\r
- return false;\r
- }\r
- }catch(Exception e)\r
- {\r
- System.Console.WriteLine("Exception: {0}", e.ToString());\r
- return false;\r
- }\r
- return true;\r
- }\r
-\r
- public static void Main(string[] args)\r
- {\r
- if(args.Length == 1 && IsHelp(args[0]))\r
- {\r
- Usage(false);\r
- return;\r
- }\r
-\r
- if(args.Length == 0)\r
- {\r
- TargetDirectory = GetTargetDir();\r
- while(TargetDirectory.EndsWith("\\"))\r
- {\r
- TargetDirectory = TargetDirectory.Substring(0, TargetDirectory.Length - 1);\r
- }\r
- } else\r
- {\r
- while(args[0].EndsWith("\\"))\r
- {\r
- args[0] = args[0].Substring(0, args[0].Length - 1);\r
- }\r
- TargetDirectory = args[0];\r
- }\r
-\r
- if(!IsDirectory(TargetDirectory))\r
- return;\r
-\r
- if(args.Length > 1)\r
- {\r
- NamespaceName = args[1];\r
- } else\r
- {\r
- NamespaceName = AskForNamespace();\r
- }\r
-\r
- if(args.Length > 2)\r
- {\r
- int i=0;\r
- foreach(string currArg in args)\r
- {\r
- if(i != 0)\r
- {\r
- Generate(currArg);\r
- }\r
- i++;\r
- }\r
- }\r
- string delegateName = String.Empty;\r
- while((delegateName = AskForMore()) != String.Empty)\r
- {\r
- Generate(delegateName);\r
- }\r
- }\r
- }\r
-}\r
+++ /dev/null
-// IFaceDisco.cs\r
-//\r
-// Nick Drochak (ndrochak@gol.com)\r
-//\r
-// (C) 2001 Nick Drochak\r
-\r
-using System;\r
-using System.Reflection;\r
-using System.Collections;\r
-using System.IO;\r
-\r
-namespace Mono.Util\r
-{\r
- class IFaceDisco {\r
- public static void Main(string[] args) {\r
- Assembly asm;\r
- Type[] asmTypes;\r
- InterfaceMapping map;\r
- Type[] interfaces;\r
- ArrayList TypesList = new ArrayList();\r
- ArrayList implementingTypes = new ArrayList();\r
- string asmFullPath = null;\r
- string ifaceToDiscover = null;\r
- \r
- if (args.Length < 1 || args.Length > 3) {\r
- Usage();\r
- return;\r
- }\r
-\r
- for (int i = 0; i < args.Length; i++) {\r
- string arg = args[i];\r
-\r
- if (arg.StartsWith("-") && ((i + 1) < args.Length)) {\r
- if (arg == "--asm") {\r
- asmFullPath = args[++i];\r
- } else {\r
- Usage();\r
- return;\r
- }\r
- } else {\r
- // allow only one interface to discover\r
- if (ifaceToDiscover != null){\r
- Usage();\r
- return;\r
- }\r
- ifaceToDiscover = arg;\r
- }\r
- }\r
-\r
- // find the assembly\r
- if (null == asmFullPath){\r
- asm = Assembly.GetAssembly(typeof (System.Object));\r
- }\r
- else {\r
- try{\r
- asm = Assembly.LoadFrom(asmFullPath);\r
- }\r
- catch(Exception e){\r
- Console.WriteLine("Could not open assembly '{0}' for discovery. Error is: "+e.Message, asmFullPath);\r
- return;\r
- }\r
- }\r
- asmTypes = asm.GetTypes();\r
-\r
- // examine all the public types\r
- foreach(Type t in asmTypes) {\r
- if (t.IsPublic) {\r
- // find out which, if any, interfaces are "in" the type\r
- interfaces= t.GetInterfaces();\r
- if (null != interfaces){\r
- // look for the interface we want to discover\r
- foreach (Type iface in interfaces) {\r
- // this area seems to throw an exception sometimes, just ignore it\r
- try{\r
- if (iface.FullName.ToLower() == args[0].ToLower()) {\r
- // find out if this type is the one which "declares" the interface\r
- map = t.GetInterfaceMap(iface);\r
- if (map.TargetMethods[0].DeclaringType.FullName == t.FullName){\r
- // if so, then we found a class to report\r
- implementingTypes.Add(t.FullName);\r
- } // if\r
- } // if\r
- }catch{}\r
- } // foreach\r
- } // if\r
- } // if\r
- } // foreach\r
-\r
- // sort the list to make it easier to find what you are looking for\r
- implementingTypes.Sort();\r
- Console.WriteLine(XMLUtil.ToXML(implementingTypes, "Type", "ImplementingTypes"));\r
- } // Main()\r
-\r
- private static void Usage() {\r
- Console.WriteLine (\r
- "Mono Interface Discovery Tool\n" +\r
- "usage: ifacedisco [--asm assembly] interface\n\n" +\r
- " The full path to 'assembly' should be specified when using --asm.\n" +\r
- " If 'assembly' is not specified, the assembly that contains System.Object will be used.\n" +\r
- " Use the fully qualified form for 'interface', e.g. System.Runtime.Serialization.ISerializable\n"\r
- );\r
- } // Usage()\r
-\r
- } // class IFaceDisco\r
-} // namespace Mono.Util\r
+++ /dev/null
-// IFaceDisco.cs\r
-//\r
-// Nick Drochak (ndrochak@gol.com)\r
-//\r
-// (C) 2001 Nick Drochak\r
-\r
-using System;\r
-using System.Text;\r
-using System.Collections;\r
-\r
-namespace Mono.Util\r
-{\r
- class XMLUtil{\r
- public static string ToXML(\r
- ArrayList list, \r
- string itemWrap,\r
- string listWrap)\r
- {\r
- if (null == itemWrap){\r
- throw new ArgumentNullException("itemWrap");\r
- }\r
- if (null == listWrap){\r
- throw new ArgumentNullException("listWrap");\r
- }\r
- StringBuilder output = new StringBuilder();\r
- output.Append("<"+listWrap+">");\r
- foreach(object o in list){\r
- output.Append("\n<"+itemWrap+">");\r
- output.Append(o.ToString());\r
- output.Append("</"+itemWrap+">");\r
- }\r
- output.Append("\n</"+listWrap+">");\r
- return output.ToString();\r
- }\r
- }\r
-}
\ No newline at end of file
+++ /dev/null
-// monostyle.cs
-//
-// Adam Treat (manyoso@yahoo.com)
-// Ben Maurer (bmaurer@users.sf.net)
-// (C) 2002 Adam Treat
-// (C) 2003 Ben Maurer
-//
-// This program is free software; you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation; either version 2 of the License, or
-// (at your option) any later version.
-
-using System;
-using System.IO;
-using System.Text.RegularExpressions;
-using System.Collections.Specialized;
-
-namespace Mono.Util {
-
- class MonoStyle {
-
- string file;
- StringCollection filebuffer;
- bool linespace = true;
-
- void Usage()
- {
- Console.Write (
- "monostyle -f file.cs -l <true|false> > output.cs\n\n" +
- " -f || /-f || --file file.cs The csharp source file to parse.\n\n" +
- " -l || /-l || --line <true|false> Specifies wether to use line spacing.\n\n");
- }
-
- public static void Main (string[] args)
- {
- MonoStyle style = new MonoStyle(args);
- }
-
- public MonoStyle (string[] args)
- {
- int argc = args.Length;
- for(int i = 0; i < argc; i++) {
- string arg = args[i];
- // The "/" switch is there for wine users, like me ;-)
- if(arg.StartsWith("-") || arg.StartsWith("/")) {
- switch(arg) {
- case "-l": case "/-l": case "--line":
- if((i + 1) >= argc) {
- Usage();
- return;
- }
- if (args[i++] == "false") {
- linespace = false;
- }
- continue;
- case "-f": case "/-f": case "--file":
- if((i + 1) >= argc) {
- Usage();
- return;
- }
- file = args[++i];
- continue;
- default:
- Usage();
- return;
- }
- }
- }
- if(file == null) {
- Usage();
- return;
- }
- filebuffer = new StringCollection();
- StreamReader sr = new StreamReader(file);
- FillBuffer(sr);
- FixMonoStyle();
- PrintToConsole();
- }
-
- public void FillBuffer(StreamReader sr)
- {
- sr.BaseStream.Seek(0, SeekOrigin.Begin);
- while (sr.Peek() > -1) {
- filebuffer.Add(sr.ReadLine());
- }
- sr.Close();
- }
-
- public void FixMonoStyle()
- {
- for (int i=0; i < filebuffer.Count; i++) {
- IsBadMonoStyle(filebuffer[i]);
- }
- }
-
- public void PrintToConsole()
- {
- for (int i=0; i < filebuffer.Count; i++) {
- Console.WriteLine(filebuffer[i]);
- }
- }
-
- public void IsBadMonoStyle(String str)
- {
- if (IsBadMonoType(str)) {
- FixHangingBrace(str);
- } else if(IsBadMonoFlow(str)) {
- FixHangingBrace(str);
- } else if(IsBadMonoFunction(str)) {
- FixEndBrace(str);
- } else if(IsBadMonoProperty(str)) {
- FixHangingBrace(str);
- } else {
- }
- }
-
- public void FixHangingBrace(String str)
- {
- int strloc = filebuffer.IndexOf(str);
- int brcloc = FindHangingBrace(strloc);
- int diff = brcloc - strloc;
- if (brcloc > 0) {
- for (int i = 0; i < diff+1; i++) {
- filebuffer.RemoveAt(strloc);
- }
- filebuffer.Insert(strloc, str + " {");
- if (linespace) {
- filebuffer.Insert(strloc+1, "");
- }
- } else {}
- }
-
- public int FindHangingBrace(int strloc)
- {
- strloc++;
- bool found = false;
- while (!found) {
- try {
- string str = filebuffer[strloc++];
- found = IsHangingBrace(str);
- if (!found && !IsBlankLine(str)) {
- return -1;
- }
- } catch (Exception) {
- return -1;
- }
- }
- return strloc -1;
- }
-
- public void FixEndBrace(String str)
- {
- int strloc = filebuffer.IndexOf(str);
- filebuffer.RemoveAt(strloc);
- filebuffer.Insert(strloc, RemoveEndBrace(str));
- filebuffer.Insert(strloc+1, AddHangingBrace(str));
- }
-
- public static bool IsBadMonoType(String str)
- {
- if ( IsType(str) && !EndWithBrace(str)) {
- return true;
- } else {
- return false;
- }
- }
-
- public static bool IsBadMonoFlow(String str)
- {
- if (IsFlow(str) && !EndWithBrace(str)) {
- return true;
- } else {
- return false;
- }
- }
-
- public static bool IsBadMonoFunction(String str)
- {
- if (IsFunction(str) && EndWithBrace(str)) {
- return true;
- } else {
- return false;
- }
- }
-
- public static bool IsBadMonoProperty(String str)
- {
- if (IsProperty(str) && !EndWithBrace(str)) {
- return true;
- } else {
- return false;
- }
- }
-
- public static bool IsType(String str)
- {
- if ( !IsComment(str) && (
- IsNameSpace(str) ||
- IsClass(str) ||
- IsStruct(str) ||
- IsEnum(str) )) {
- return true;
- } else {
- return false;
- }
- }
-
- public static bool IsFlow(String str)
- {
- if ( !IsComment(str) && (
- IsIf(str) ||
- IsElse(str) ||
- IsElseIf(str) ||
- IsTry(str) ||
- IsCatch(str) ||
- IsFinally(str) ||
- IsFor(str) ||
- IsForEach(str) ||
- IsWhile(str) ||
- IsSwitch(str)
- )) {
- return true;
- } else {
- return false;
- }
- }
-
- public static bool IsFunction(String str)
- {
- if ( Regex.IsMatch(str, @"^\s*(\w+)\s+(\w+).*\(+") &&
- !IsDeclaration(str) &&
- !IsComment(str) &&
- !IsType(str) &&
- !IsFlow(str) ) {
- return true;
- } else {
- return false;
- }
- }
-
- public static bool IsProperty(String str)
- {
- if ( Regex.IsMatch(str, @"^\s*(\w+)\s+(\w+).*") &&
- !IsDeclaration(str) &&
- !IsComment(str) &&
- !IsType(str) &&
- !IsFlow(str) &&
- !IsFunction(str) ) {
- return true;
- } else {
- return false;
- }
- }
-
- public static string RemoveEndBrace(String str)
- {
- Regex rg = new Regex(@"\{\s*$");
- return rg.Replace(str, "");
- }
-
- public static string AddHangingBrace(String str)
- {
- Regex rg = new Regex(@"\S+\s*");
- string blank = rg.Replace(str,"");
- return blank + "{";
- }
-
- public static bool IsDeclaration(String str)
- {
- return Regex.IsMatch(str, @"\;\s*$");
- }
-
- public static bool IsComment(String str)
- {
- return Regex.IsMatch(str, @"^(\s*\/+|\s*\*+|\s*\#+)");
- }
-
- public static bool EndWithBrace(String str)
- {
- return Regex.IsMatch(str, @"\{\s*$");
- }
-
- public static bool IsHangingBrace(String str)
- {
- return Regex.IsMatch(str, @"^\s*\{");
- }
-
- public static bool IsBlankLine(String str)
- {
- return Regex.IsMatch(str, @"^\s*$");
- }
-
- public static bool IsNameSpace(String str)
- {
- return Regex.IsMatch(str, @"(^|\s+)namespace\s+");
- }
-
- public static bool IsClass(String str)
- {
- return Regex.IsMatch(str, @"\s+class\s+");
- }
-
- public static bool IsStruct(String str)
- {
- return Regex.IsMatch(str, @"\s+struct\s+");
- }
-
- public static bool IsEnum(String str)
- {
- return Regex.IsMatch(str, @"\s+enum\s+");
- }
-
- public static bool IsIf(String str)
- {
- return Regex.IsMatch(str, @"(^|\s+|\}+)if(\s+|\(+|$)");
- }
-
- public static bool IsElse(String str)
- {
- return Regex.IsMatch(str, @"(^|\s+|\}+)else(\s+|\{+|$)");
- }
-
- public static bool IsElseIf(String str)
- {
- return Regex.IsMatch(str, @"(^|\s+|\}+)else if(\s+|\(+|$)");
- }
-
- public static bool IsTry(String str)
- {
- return Regex.IsMatch(str, @"(^|\s+|\}+)try(\s+|\(+|$)");
- }
-
- public static bool IsCatch(String str)
- {
- return Regex.IsMatch(str, @"(^|\s+|\}+)catch(\s+|\(+|$)");
- }
-
- public static bool IsFinally(String str)
- {
- return Regex.IsMatch(str, @"(^|\s+|\}+)finally(\s+|\{+|$)");
- }
-
- public static bool IsFor(String str)
- {
- return Regex.IsMatch(str, @"(^|\s+|\}+)for(\s+|\(+|$)");
- }
-
- public static bool IsForEach(String str)
- {
- return Regex.IsMatch(str, @"(^|\s+|\}+)foreach(\s+|\(+|$)");
- }
-
- public static bool IsWhile(String str)
- {
- return Regex.IsMatch(str, @"(^|\s+|\}+)while(\s+|\(+|$)");
- }
-
- public static bool IsSwitch(String str)
- {
- return Regex.IsMatch(str, @"(^|\s+|\}+)switch(\s+|\(+|$)");
- }
-
- public static bool IsCase(String str)
- {
- return Regex.IsMatch(str, @"(^|\s+|\}+)case(\s+|\(+|$)");
- }
- }
-}
+++ /dev/null
-using System;
-
-class X {
- static void w (string s)
- {
- Console.WriteLine ("\t" + s);
- }
-
- static void Main ()
- {
- object [,] names =
- { { "Byte", "byte" },
- { "SByte", "sbyte" },
- { "Short", "short" },
- { "UShort", "ushort" },
- { "Int", "int32" },
- { "UInt", "uint32" },
- { "Long", "int64" },
- { "ULong", "uint64" },
- { "Float", "float" },
- { "Double", "double" },
- { null, null }
- };
-
- for (int i = 0; names [i,0] != null; i++){
- string big = names [i, 0] + "Constant";
- string small = "TypeManager." + names [i, 1] + "_type";
- string nat = ((string) names [i,0]).ToLower ();
-
- w ("\t\tif (expr is " + big + "){");
- w ("\t\t\t" + nat + " v = ((" + big + ") expr).Value;");
- w ("");
-
- for (int j = 0; names [j,0] != null; j++){
- string b = names [j, 0] + "Constant";
- string s = "TypeManager." + names [j, 1] + "_type";
- string n = ((string) names [j,0]).ToLower ();
-
- if (i == j)
- continue;
-
- w ("\t\t\tif (target_type == " + s + ")");
- w ("\t\t\t\treturn new " + b + " ((" + n + ") v);");
- }
- w ("\t\t}");
- }
- }
-}
-
+++ /dev/null
-//
-// Serialize.cs
-//
-// This program creates a SerializationInfo and requests an object
-// to serialize itself.
-//
-// We serialize because we need to know the *exact* names that are
-// used for the values being serialized.
-//
-// Author: Miguel de Icaza
-// Duncan Mak
-//
-// (C) Ximian, Inc.
-//
-
-using System;
-using System.Collections;
-using System.Globalization;
-using System.Runtime.Serialization;
-using System.Runtime.Serialization.Formatters.Soap;
-using System.IO;
-
-namespace Mono.Serialize {
- class Driver {
- static object StaticCreateObject ()
- {
- //
- // Change the object type here.
- //
- return null;
- }
-
- static object LiveCreateObject (Type obj, Type[] types, string[] values)
- {
- if (types.Length != values.Length)
- throw new ArgumentException ();
-
- object[] a = new object [types.Length];
-
- for (int i = 0; i < a.Length; i++)
- a [i] = Convert.ChangeType (values [i], types [i]);
-
- return Activator.CreateInstance (obj, a);
- }
-
- static void Main (string[] args)
- {
- object x = null;
- string strTypes = null;
- string argValues = null;
-
- if (args.Length == 1) {
- Type t = Type.GetType (args[0]);
- Console.WriteLine ("\nPlease enter the arguments to the constructor for type {0}", t.ToString());
- strTypes = Console.ReadLine ();
- Console.WriteLine ("\nPlease enter the values");
- argValues = Console.ReadLine ();
- Type[] types = ToTypeArray (strTypes.Split (','));
- string[] param = argValues.Split (',');
-
- x = LiveCreateObject (t, types, param);
- } else {
- x = StaticCreateObject ();
- }
-
- string fileName = x.GetType().FullName + ".xml";
- Stream output = new FileStream (fileName, FileMode.Create,
- FileAccess.Write, FileShare.None);
- IFormatter formatter = new SoapFormatter ();
-
- formatter.Serialize ((Stream) output, x);
- output.Close ();
- }
-
- public static Type[] ToTypeArray (string[] strTypes)
- {
- Type[] t = new Type [strTypes.Length];
-
- for (int i = 0; i < strTypes.Length; i++)
- t [i] = StringToType (strTypes [i]);
- return t;
- }
-
- public static Type StringToType (string s)
- {
- switch (s) {
- case "bool":
- return typeof (System.Boolean);
- break;
- case "byte":
- return typeof (System.Byte);
- break;
- case "sbyte":
- return typeof (System.SByte);
- break;
- case "char":
- return typeof (System.Char);
- break;
- case "decimal":
- return typeof (System.Decimal);
- break;
- case "double":
- return typeof (System.Double);
- break;
- case "float":
- return typeof (System.Single);
- break;
- case "int":
- return typeof (System.Int32);
- break;
- case "uint":
- return typeof (System.UInt32);
- break;
- case "long":
- return typeof (System.Int64);
- break;
- case "ulong":
- return typeof (System.UInt64);
- break;
- case "object":
- return typeof (System.Object);
- break;
- case "short":
- return typeof (System.Int16);
- break;
- case "ushort":
- return typeof (System.UInt16);
- break;
- case "string":
- return typeof (System.String);
- break;
- default:
- return Type.GetType (s);
- break;
- }
- }
- }
-}
+++ /dev/null
-//
-// verifier.cs: compares two assemblies and reports differences.
-//
-// Author:
-// Sergey Chaban (serge@wildwestsoftware.com)
-//
-// (C) Sergey Chaban (serge@wildwestsoftware.com)
-//
-
-using System;
-using System.IO;
-using System.Collections;
-using System.Reflection;
-
-namespace Mono.Verifier {
-
-
-
- ////////////////////////////////
- // Collections
- ////////////////////////////////
-
- public abstract class MemberCollection : IEnumerable {
-
- public delegate MemberInfo [] InfoQuery (Type type, BindingFlags bindings);
- public delegate bool MemberComparer (MemberInfo mi1, MemberInfo mi2);
-
- protected SortedList list;
- protected MemberComparer comparer;
-
- protected BindingFlags bindings;
-
- protected MemberCollection (Type type, InfoQuery query, MemberComparer comparer, BindingFlags bindings)
- {
- if (query == null)
- throw new NullReferenceException ("Invalid query delegate.");
-
- if (comparer == null)
- throw new NullReferenceException ("Invalid comparer.");
-
- this.comparer = comparer;
- this.bindings = bindings;
-
- this.list = new SortedList ();
-
- MemberInfo [] data = query (type, bindings);
- foreach (MemberInfo info in data) {
- this.list [info.Name] = info;
- }
- }
-
-
-
- public MemberInfo this [string name] {
- get {
- return list [name] as MemberInfo;
- }
- }
-
-
- public override int GetHashCode ()
- {
- return list.GetHashCode ();
- }
-
-
- public override bool Equals (object o)
- {
- bool res = (o is MemberCollection);
- if (res) {
- MemberCollection another = o as MemberCollection;
- IEnumerator it = GetEnumerator ();
- while (it.MoveNext () && res) {
- MemberInfo inf1 = it.Current as MemberInfo;
- MemberInfo inf2 = another [inf1.Name];
- res &= comparer (inf1, inf2);
- }
- }
- return res;
- }
-
-
-
- public static bool operator == (MemberCollection c1, MemberCollection c2)
- {
- return c1.Equals (c2);
- }
-
- public static bool operator != (MemberCollection c1, MemberCollection c2)
- {
- return !(c1 == c2);
- }
-
-
-
- public IEnumerator GetEnumerator()
- {
- return new Iterator (this);
- }
-
-
- internal class Iterator : IEnumerator {
- private MemberCollection host;
- private int pos;
-
- internal Iterator (MemberCollection host)
- {
- this.host=host;
- this.Reset ();
- }
-
- /// <summary></summary>
- public object Current
- {
- get {
- if (host != null && pos >=0 && pos < host.list.Count) {
- return host.list.GetByIndex (pos);
- } else {
- return null;
- }
- }
- }
-
- /// <summary></summary>
- public bool MoveNext ()
- {
- if (host!=null) {
- return (++pos) < host.list.Count;
- } else {
- return false;
- }
- }
-
- /// <summary></summary>
- public void Reset ()
- {
- this.pos = -1;
- }
- }
-
- }
-
-
-
-
- //--- Method collections
-
- /// <summary>
- /// Abstract collection of class' methods.
- /// </summary>
- public abstract class MethodCollectionBase : MemberCollection {
-
-
- protected MethodCollectionBase (Type type, BindingFlags bindings)
- : base (type, new InfoQuery (Query), new MemberComparer (Comparer), bindings)
- {
- }
-
-
- private static MemberInfo [] Query (Type type, BindingFlags bindings)
- {
- // returns MethodInfo []
- return type.GetMethods (bindings);
- }
-
- private static bool Comparer (MemberInfo mi1, MemberInfo mi2)
- {
- bool res = false;
- if (mi1 is MethodInfo && (mi2 == null || mi2 is MethodInfo)) {
- MethodInfo inf1 = mi1 as MethodInfo;
- MethodInfo inf2 = mi2 as MethodInfo;
- res = Compare.Methods (inf1, inf2);
- } else {
- Verifier.log.Write ("internal-error", "Wrong comparer arguments.", ImportanceLevel.HIGH);
- }
- return res;
- }
- }
-
-
-
- /// <summary>
- /// Collection of public instance methods of a class.
- /// </summary>
- public class PublicMethods : MethodCollectionBase {
-
- public PublicMethods (Type type)
- : base (type, BindingFlags.Public | BindingFlags.Instance)
- {
- }
- }
-
- /// <summary>
- /// Collection of public static methods of a class.
- /// </summary>
- public class PublicStaticMethods : MethodCollectionBase {
-
- public PublicStaticMethods (Type type)
- : base (type, BindingFlags.Public | BindingFlags.Static)
- {
- }
- }
-
- /// <summary>
- /// Collection of non-public instance methods of a class.
- /// </summary>
- public class NonPublicMethods : MethodCollectionBase {
-
- public NonPublicMethods (Type type)
- : base (type, BindingFlags.NonPublic | BindingFlags.Instance)
- {
- }
- }
-
- /// <summary>
- /// Collection of non-public static methods of a class.
- /// </summary>
- public class NonPublicStaticMethods : MethodCollectionBase {
-
- public NonPublicStaticMethods (Type type)
- : base (type, BindingFlags.NonPublic | BindingFlags.Static)
- {
- }
- }
-
-
-
-
-
- //--- Field collections
-
- public abstract class FieldCollectionBase : MemberCollection {
-
-
- protected FieldCollectionBase (Type type, BindingFlags bindings)
- : base (type, new InfoQuery (Query), new MemberComparer (Comparer), bindings)
- {
- }
-
-
- private static MemberInfo [] Query (Type type, BindingFlags bindings)
- {
- // returns FieldInfo []
- return type.GetFields (bindings);
- }
-
- private static bool Comparer (MemberInfo mi1, MemberInfo mi2)
- {
- bool res = false;
- if (mi1 is FieldInfo && (mi2 == null || mi2 is FieldInfo)) {
- FieldInfo inf1 = mi1 as FieldInfo;
- FieldInfo inf2 = mi2 as FieldInfo;
- res = Compare.Fields (inf1, inf2);
- } else {
- Verifier.log.Write ("internal-error", "Wrong comparer arguments.", ImportanceLevel.HIGH);
- }
- return res;
- }
- }
-
-
- public class PublicFields : FieldCollectionBase {
-
- public PublicFields (Type type)
- : base (type, BindingFlags.Public | BindingFlags.Instance)
- {
- }
- }
-
- public class PublicStaticFields : FieldCollectionBase {
-
- public PublicStaticFields (Type type)
- : base (type, BindingFlags.Public | BindingFlags.Static)
- {
- }
- }
-
- public class NonPublicFields : FieldCollectionBase {
-
- public NonPublicFields (Type type)
- : base (type, BindingFlags.NonPublic | BindingFlags.Instance)
- {
- }
- }
-
- public class NonPublicStaticFields : FieldCollectionBase {
-
- public NonPublicStaticFields (Type type)
- : base (type, BindingFlags.NonPublic | BindingFlags.Static)
- {
- }
- }
-
-
-
-
-
- public abstract class AbstractTypeStuff {
- public readonly Type type;
-
- public AbstractTypeStuff (Type type)
- {
- if (type == null)
- throw new NullReferenceException ("Invalid type.");
-
- this.type = type;
- }
-
- public override int GetHashCode ()
- {
- return type.GetHashCode ();
- }
-
- public static bool operator == (AbstractTypeStuff t1, AbstractTypeStuff t2)
- {
- if ((t1 as object) == null) {
- if ((t2 as object) == null) return true;
- return false;
- }
- return t1.Equals (t2);
- }
-
- public static bool operator != (AbstractTypeStuff t1, AbstractTypeStuff t2)
- {
- return !(t1 == t2);
- }
-
- public override bool Equals (object o)
- {
- return (o is AbstractTypeStuff && CompareTypes (o as AbstractTypeStuff));
- }
-
- protected virtual bool CompareTypes (AbstractTypeStuff that)
- {
- Verifier.Log.Write ("info", "Comparing types.", ImportanceLevel.LOW);
- bool res;
-
- res = Compare.Types (this.type, that.type);
-
- return res;
- }
-
- }
-
-
-
-
- /// <summary>
- /// Represents a class.
- /// </summary>
- public class ClassStuff : AbstractTypeStuff {
-
- public PublicMethods publicMethods;
- public PublicStaticMethods publicStaticMethods;
- public NonPublicMethods nonpublicMethods;
- public NonPublicStaticMethods nonpublicStaticMethods;
-
- public PublicFields publicFields;
- public PublicStaticFields publicStaticFields;
- public NonPublicFields nonpublicFields;
- public NonPublicStaticFields nonpublicStaticFields;
-
- public ClassStuff (Type type) : base (type)
- {
- publicMethods = new PublicMethods (type);
- publicStaticMethods = new PublicStaticMethods (type);
- nonpublicMethods = new NonPublicMethods (type);
- nonpublicStaticMethods = new NonPublicStaticMethods (type);
-
- publicFields = new PublicFields (type);
- publicStaticFields = new PublicStaticFields (type);
- nonpublicFields = new NonPublicFields (type);
- nonpublicStaticFields = new NonPublicStaticFields (type);
- }
-
-
- public override int GetHashCode ()
- {
- return base.GetHashCode ();
- }
-
- private bool CompareMethods (ClassStuff that)
- {
- bool res = true;
- bool ok;
-
- Verifier.Log.Write ("info", "Comparing public instance methods.", ImportanceLevel.LOW);
- ok = (this.publicMethods == that.publicMethods);
- res &= ok;
- if (!ok && Verifier.stopOnError) return res;
-
- Verifier.Log.Write ("info", "Comparing public static methods.", ImportanceLevel.LOW);
- ok = (this.publicStaticMethods == that.publicStaticMethods);
- res &= ok;
- if (!ok && Verifier.stopOnError) return res;
-
- Verifier.Log.Write ("info", "Comparing non-public instance methods.", ImportanceLevel.LOW);
- ok = (this.nonpublicMethods == that.nonpublicMethods);
- res &= ok;
- if (!ok && Verifier.stopOnError) return res;
-
- Verifier.Log.Write ("info", "Comparing non-public static methods.", ImportanceLevel.LOW);
- ok = (this.nonpublicStaticMethods == that.nonpublicStaticMethods);
- res &= ok;
- if (!ok && Verifier.stopOnError) return res;
-
- return res;
- }
-
-
- private bool CompareFields (ClassStuff that)
- {
- bool res = true;
- bool ok;
-
- Verifier.Log.Write ("info", "Comparing public instance fields.", ImportanceLevel.LOW);
- ok = (this.publicFields == that.publicFields);
- res &= ok;
- if (!ok && Verifier.stopOnError) return res;
-
- Verifier.Log.Write ("info", "Comparing public static fields.", ImportanceLevel.LOW);
- ok = (this.publicStaticFields == that.publicStaticFields);
- res &= ok;
- if (!ok && Verifier.stopOnError) return res;
-
- Verifier.Log.Write ("info", "Comparing non-public instance fields.", ImportanceLevel.LOW);
- ok = (this.nonpublicFields == that.nonpublicFields);
- res &= ok;
- if (!ok && Verifier.stopOnError) return res;
-
- Verifier.Log.Write ("info", "Comparing non-public static fields.", ImportanceLevel.LOW);
- ok = (this.nonpublicStaticFields == that.nonpublicStaticFields);
- res &= ok;
- if (!ok && Verifier.stopOnError) return res;
-
- return res;
- }
-
-
- public override bool Equals (object o)
- {
- bool res = (o is ClassStuff);
- if (res) {
- ClassStuff that = o as ClassStuff;
-
- res &= this.CompareTypes (that);
- if (!res && Verifier.stopOnError) return res;
-
- res &= this.CompareMethods (that);
- if (!res && Verifier.stopOnError) return res;
-
- res &= this.CompareFields (that);
- if (!res && Verifier.stopOnError) return res;
-
- }
- return res;
- }
-
- }
-
-
-
- /// <summary>
- /// Represents an interface.
- /// </summary>
- public class InterfaceStuff : AbstractTypeStuff {
-
- public PublicMethods publicMethods;
-
- public InterfaceStuff (Type type) : base (type)
- {
- publicMethods = new PublicMethods (type);
- }
-
- public override int GetHashCode ()
- {
- return base.GetHashCode ();
- }
-
- public override bool Equals (object o)
- {
- bool res = (o is InterfaceStuff);
- if (res) {
- bool ok;
- InterfaceStuff that = o as InterfaceStuff;
-
- res = this.CompareTypes (that);
- if (!res && Verifier.stopOnError) return res;
-
- Verifier.Log.Write ("info", "Comparing interface methods.", ImportanceLevel.LOW);
- ok = (this.publicMethods == that.publicMethods);
- res &= ok;
- if (!ok && Verifier.stopOnError) return res;
- }
- return res;
- }
-
- }
-
-
-
- /// <summary>
- /// Represents an enumeration.
- /// </summary>
- public class EnumStuff : AbstractTypeStuff {
-
- //public FieldInfo [] members;
-
- public string baseType;
- public Hashtable enumTable;
- public bool isFlags;
-
- public EnumStuff (Type type) : base (type)
- {
- //members = type.GetFields (BindingFlags.Public | BindingFlags.Static);
-
- Array values = Enum.GetValues (type);
- Array names = Enum.GetNames (type);
-
- baseType = Enum.GetUnderlyingType (type).Name;
-
- enumTable = new Hashtable ();
-
- object [] attrs = type.GetCustomAttributes (false);
- isFlags = (attrs != null && attrs.Length > 0);
- if (isFlags) {
- foreach (object attr in attrs) {
- isFlags |= (attr is FlagsAttribute);
- }
- }
-
- int indx = 0;
- foreach (string id in names) {
- enumTable [id] = Convert.ToInt64(values.GetValue(indx) as Enum);
- ++indx;
- }
- }
-
- public override int GetHashCode ()
- {
- return base.GetHashCode ();
- }
-
- public override bool Equals (object o)
- {
- bool res = (o is EnumStuff);
- bool ok;
-
- if (res) {
- EnumStuff that = o as EnumStuff;
- ok = this.CompareTypes (that);
- res &= ok;
- if (!ok && Verifier.stopOnError) return res;
-
- ok = (this.baseType == that.baseType);
- res &= ok;
- if (!ok) {
- Verifier.log.Write ("error",
- String.Format ("Underlying types mismatch [{0}, {1}].", this.baseType, that.baseType),
- ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
- Verifier.Log.Write ("info", "Comparing [Flags] attribute.");
- ok = !(this.isFlags ^ that.isFlags);
- res &= ok;
- if (!ok) {
- Verifier.log.Write ("error",
- String.Format ("[Flags] attribute mismatch ({0} : {1}).", this.isFlags ? "Yes" : "No", that.isFlags ? "Yes" : "No"),
- ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
- Verifier.Log.Write ("info", "Comparing enum values.");
-
- ICollection names = enumTable.Keys;
- foreach (string id in names) {
- ok = that.enumTable.ContainsKey (id);
- res &= ok;
- if (!ok) {
- Verifier.log.Write ("error", String.Format("{0} absent in enumeration.", id),
- ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
- if (ok) {
- long val1 = (long) this.enumTable [id];
- long val2 = (long) that.enumTable [id];
- ok = (val1 == val2);
- res &= ok;
- if (!ok) {
- Verifier.log.Write ("error",
- String.Format ("Enum values mismatch [{0}: {1} != {2}].", id, val1, val2),
- ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
- }
- }
- }
- return res;
- }
- }
-
-
-
- public sealed class TypeArray {
- public static readonly TypeArray empty = new TypeArray (Type.EmptyTypes);
-
- public Type [] types;
-
- public TypeArray (Type [] types)
- {
- this.types = new Type [types.Length];
- for (int i = 0; i < types.Length; i++) {
- this.types.SetValue (types.GetValue (i), i);
- }
- }
- }
-
-
-
- public class AssemblyLoader {
- public delegate void Hook (TypeArray assemblyTypes);
-
- private static Hashtable cache;
-
- private Hook hook;
-
- static AssemblyLoader ()
- {
- cache = new Hashtable (11);
- }
-
- public AssemblyLoader (Hook hook)
- {
- if (hook == null)
- throw new NullReferenceException ("Invalid loader hook.");
-
- this.hook = hook;
- }
-
-
- public bool LoadFrom (string assemblyName)
- {
- bool res = false;
- try {
- TypeArray types = TypeArray.empty;
-
- lock (cache) {
- if (cache.Contains (assemblyName)) {
- types = (cache [assemblyName] as TypeArray);
- if (types == null) types = TypeArray.empty;
- } else {
- Assembly asm = Assembly.LoadFrom (assemblyName);
- Type [] allTypes = asm.GetTypes ();
- if (allTypes == null) allTypes = Type.EmptyTypes;
- types = new TypeArray (allTypes);
- cache [assemblyName] = types;
- }
- }
- hook (types);
- res = true;
- } catch (ReflectionTypeLoadException rtle) {
- // FIXME: Should we try to recover? Use loaded portion of types.
- Type [] loaded = rtle.Types;
- for (int i = 0, xCnt = 0; i < loaded.Length; i++) {
- if (loaded [i] == null) {
- Verifier.log.Write ("fatal error",
- String.Format ("Unable to load {0}, reason - {1}", loaded [i], rtle.LoaderExceptions [xCnt++]),
- ImportanceLevel.LOW);
- }
- }
- } catch (FileNotFoundException fnfe) {
- Verifier.log.Write ("fatal error", fnfe.ToString (), ImportanceLevel.LOW);
- } catch (Exception x) {
- Verifier.log.Write ("fatal error", x.ToString (), ImportanceLevel.LOW);
- }
-
- return res;
- }
-
- }
-
-
-
-
- public abstract class AbstractTypeCollection : SortedList {
-
- private AssemblyLoader loader;
-
- public AbstractTypeCollection ()
- {
- loader = new AssemblyLoader (new AssemblyLoader.Hook (LoaderHook));
- }
-
- public AbstractTypeCollection (string assemblyName) : this ()
- {
- LoadFrom (assemblyName);
- }
-
- public abstract void LoaderHook (TypeArray types);
-
-
- public bool LoadFrom (string assemblyName)
- {
- return loader.LoadFrom (assemblyName);
- }
-
- }
-
-
-
- public class ClassCollection : AbstractTypeCollection {
-
- public ClassCollection () : base ()
- {
- }
-
- public ClassCollection (string assemblyName)
- : base (assemblyName)
- {
- }
-
-
- public override void LoaderHook (TypeArray types)
- {
- foreach (Type type in types.types) {
- if (type.IsClass) {
- this [type.FullName] = new ClassStuff (type);
- }
- }
- }
-
- }
-
-
- public class InterfaceCollection : AbstractTypeCollection {
-
- public InterfaceCollection () : base ()
- {
- }
-
- public InterfaceCollection (string assemblyName)
- : base (assemblyName)
- {
- }
-
-
- public override void LoaderHook (TypeArray types)
- {
- foreach (Type type in types.types) {
- if (type.IsInterface) {
- this [type.FullName] = new InterfaceStuff (type);
- }
- }
- }
-
- }
-
-
-
- public class EnumCollection : AbstractTypeCollection {
-
- public EnumCollection () : base ()
- {
- }
-
- public EnumCollection (string assemblyName)
- : base (assemblyName)
- {
- }
-
- public override void LoaderHook (TypeArray types)
- {
- foreach (Type type in types.types) {
- if (type.IsEnum) {
- this [type.FullName] = new EnumStuff (type);
- }
- }
- }
- }
-
-
-
- public class AssemblyStuff {
-
- public string name;
- public bool valid;
-
- public ClassCollection classes;
- public InterfaceCollection interfaces;
- public EnumCollection enums;
-
-
- protected delegate bool Comparer (AssemblyStuff asm1, AssemblyStuff asm2);
- private static ArrayList comparers;
-
- static AssemblyStuff ()
- {
- comparers = new ArrayList ();
- comparers.Add (new Comparer (CompareNumClasses));
- comparers.Add (new Comparer (CompareNumInterfaces));
- comparers.Add (new Comparer (CompareClasses));
- comparers.Add (new Comparer (CompareInterfaces));
- comparers.Add (new Comparer (CompareEnums));
- }
-
- protected static bool CompareNumClasses (AssemblyStuff asm1, AssemblyStuff asm2)
- {
- bool res = (asm1.classes.Count == asm2.classes.Count);
- if (!res) Verifier.Log.Write ("error", "Number of classes mismatch.", ImportanceLevel.MEDIUM);
- return res;
- }
-
- protected static bool CompareNumInterfaces (AssemblyStuff asm1, AssemblyStuff asm2)
- {
- bool res = (asm1.interfaces.Count == asm2.interfaces.Count);
- if (!res) Verifier.Log.Write ("error", "Number of interfaces mismatch.", ImportanceLevel.MEDIUM);
- return res;
- }
-
-
- protected static bool CompareClasses (AssemblyStuff asm1, AssemblyStuff asm2)
- {
- bool res = true;
- Verifier.Log.Write ("info", "Comparing classes.");
-
- foreach (DictionaryEntry c in asm1.classes) {
- string className = c.Key as string;
-
- if (Verifier.Excluded.Contains (className)) {
- Verifier.Log.Write ("info", String.Format ("Ignoring class {0}.", className), ImportanceLevel.MEDIUM);
- continue;
- }
-
- Verifier.Log.Write ("class", className);
-
- ClassStuff class1 = c.Value as ClassStuff;
- ClassStuff class2 = asm2.classes [className] as ClassStuff;
-
- if (class2 == null) {
- Verifier.Log.Write ("error", String.Format ("There is no such class in {0}", asm2.name));
- res = false;
- if (Verifier.stopOnError || !Verifier.ignoreMissingTypes) return res;
- continue;
- }
-
- res &= (class1 == class2);
- if (!res && Verifier.stopOnError) return res;
- }
-
- return res;
- }
-
-
- protected static bool CompareInterfaces (AssemblyStuff asm1, AssemblyStuff asm2)
- {
- bool res = true;
- Verifier.Log.Write ("info", "Comparing interfaces.");
-
- foreach (DictionaryEntry ifc in asm1.interfaces) {
- string ifcName = ifc.Key as string;
- Verifier.Log.Write ("interface", ifcName);
-
- InterfaceStuff ifc1 = ifc.Value as InterfaceStuff;
- InterfaceStuff ifc2 = asm2.interfaces [ifcName] as InterfaceStuff;
-
- if (ifc2 == null) {
- Verifier.Log.Write ("error", String.Format ("There is no such interface in {0}", asm2.name));
- res = false;
- if (Verifier.stopOnError || !Verifier.ignoreMissingTypes) return res;
- continue;
- }
-
- res &= (ifc1 == ifc2);
- if (!res && Verifier.stopOnError) return res;
-
- }
-
- return res;
- }
-
-
- protected static bool CompareEnums (AssemblyStuff asm1, AssemblyStuff asm2)
- {
- bool res = true;
- Verifier.Log.Write ("info", "Comparing enums.");
-
- foreach (DictionaryEntry e in asm1.enums) {
- string enumName = e.Key as string;
- Verifier.Log.Write ("enum", enumName);
-
- EnumStuff e1 = e.Value as EnumStuff;
- EnumStuff e2 = asm2.enums [enumName] as EnumStuff;
-
- if (e2 == null) {
- Verifier.Log.Write ("error", String.Format ("There is no such enum in {0}", asm2.name));
- res = false;
- if (Verifier.stopOnError || !Verifier.ignoreMissingTypes) return res;
- continue;
- }
- res &= (e1 == e2);
- if (!res && Verifier.stopOnError) return res;
- }
-
- return res;
- }
-
-
-
- public AssemblyStuff (string assemblyName)
- {
- this.name = assemblyName;
- valid = false;
- }
-
- public bool Load ()
- {
- bool res = true;
- bool ok;
-
- classes = new ClassCollection ();
- ok = classes.LoadFrom (name);
- res &= ok;
- if (!ok) Verifier.log.Write ("error", String.Format ("Unable to load classes from {0}.", name), ImportanceLevel.HIGH);
-
- interfaces = new InterfaceCollection ();
- ok = interfaces.LoadFrom (name);
- res &= ok;
- if (!ok) Verifier.log.Write ("error", String.Format ("Unable to load interfaces from {0}.", name), ImportanceLevel.HIGH);
-
- enums = new EnumCollection ();
- ok = enums.LoadFrom (name);
- res &= ok;
- if (!ok) Verifier.log.Write ("error", String.Format ("Unable to load enums from {0}.", name), ImportanceLevel.HIGH);
-
- valid = res;
- return res;
- }
-
-
- public override bool Equals (object o)
- {
- bool res = (o is AssemblyStuff);
- if (res) {
- AssemblyStuff that = o as AssemblyStuff;
- IEnumerator it = comparers.GetEnumerator ();
- while ((res || !Verifier.stopOnError) && it.MoveNext ()) {
- Comparer compare = it.Current as Comparer;
- res &= compare (this, that);
- }
- }
- return res;
- }
-
-
- public static bool operator == (AssemblyStuff asm1, AssemblyStuff asm2)
- {
- return asm1.Equals (asm2);
- }
-
- public static bool operator != (AssemblyStuff asm1, AssemblyStuff asm2)
- {
- return !(asm1 == asm2);
- }
-
- public override int GetHashCode ()
- {
- return classes.GetHashCode () ^ interfaces.GetHashCode ();
- }
-
-
- public override string ToString ()
- {
- string res;
- if (valid) {
- res = String.Format ("Asssembly {0}, valid, {1} classes, {2} interfaces, {3} enums.",
- name, classes.Count, interfaces.Count, enums.Count);
- } else {
- res = String.Format ("Asssembly {0}, invalid.", name);
- }
- return res;
- }
-
- }
-
-
-
-
- ////////////////////////////////
- // Compare
- ////////////////////////////////
-
- public sealed class Compare {
-
- private Compare ()
- {
- }
-
-
- public static bool Parameters (ParameterInfo[] params1, ParameterInfo[] params2)
- {
- bool res = true;
- if (params1.Length != params2.Length) {
- Verifier.Log.Write ("Parameter count mismatch.");
- return false;
- }
-
- int count = params1.Length;
-
- for (int i = 0; i < count && res; i++) {
- if (params1 [i].Name != params2 [i].Name) {
- Verifier.Log.Write ("error", String.Format ("Parameters names mismatch {0}, {1}.", params1 [i].Name, params2 [i].Name));
- res = false;
- if (Verifier.stopOnError) break;
- }
-
- Verifier.Log.Write ("parameter", params1 [i].Name);
-
- if (!Compare.Types (params1 [i].ParameterType, params2 [i].ParameterType)) {
- Verifier.Log.Write ("error", String.Format ("Parameters types mismatch {0}, {1}.", params1 [i].ParameterType, params2 [i].ParameterType));
- res = false;
- if (Verifier.stopOnError) break;
- }
-
-
- if (Verifier.checkOptionalFlags) {
- if (params1 [i].IsIn != params2 [i].IsIn) {
- Verifier.Log.Write ("error", "[in] mismatch.");
- res = false;
- if (Verifier.stopOnError) break;
- }
-
- if (params1 [i].IsOut != params2 [i].IsOut) {
- Verifier.Log.Write ("error", "[out] mismatch.");
- res = false;
- if (Verifier.stopOnError) break;
- }
-
- if (params1 [i].IsRetval != params2 [i].IsRetval) {
- Verifier.Log.Write ("error", "[ref] mismatch.");
- res = false;
- if (Verifier.stopOnError) break;
- }
-
- if (params1 [i].IsOptional != params2 [i].IsOptional) {
- Verifier.Log.Write ("error", "Optional flag mismatch.");
- res = false;
- if (Verifier.stopOnError) break;
- }
-
- } // checkOptionalFlags
-
-
- }
-
- return res;
- }
-
-
-
- public static bool Methods (MethodInfo mi1, MethodInfo mi2)
- {
-
- if (mi2 == null) {
- Verifier.Log.Write ("error", String.Format ("There is no such method {0}.", mi1.Name), ImportanceLevel.MEDIUM);
- return false;
- }
-
-
- Verifier.Log.Flush ();
- Verifier.Log.Write ("method", String.Format ("{0}.", mi1.Name));
- bool res = true;
- bool ok;
- string expected;
-
- ok = Compare.Types (mi1.ReturnType, mi2.ReturnType);
- res &= ok;
- if (!ok) {
- Verifier.Log.Write ("error", "Return types mismatch.", ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
-
-
-
- ok = (mi1.IsAbstract == mi2.IsAbstract);
- res &= ok;
- if (!ok) {
- expected = (mi1.IsAbstract) ? "abstract" : "non-abstract";
- Verifier.Log.Write ("error", String.Format ("Expected to be {0}.", expected), ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
- ok = (mi1.IsVirtual == mi2.IsVirtual);
- res &= ok;
- if (!ok) {
- expected = (mi1.IsVirtual) ? "virtual" : "non-virtual";
- Verifier.Log.Write ("error", String.Format ("Expected to be {0}.", expected), ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
- ok = (mi1.IsFinal == mi2.IsFinal);
- res &= ok;
- if (!ok) {
- expected = (mi1.IsFinal) ? "final" : "overridable";
- Verifier.Log.Write ("error", String.Format ("Expected to be {0}.", expected), ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
-
-
- // compare access modifiers
-
- ok = (mi1.IsPrivate == mi2.IsPrivate);
- res &= ok;
- if (!ok) {
- expected = (mi1.IsPublic) ? "public" : "private";
- Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
-
- ok = (mi1.IsFamily == mi2.IsFamily);
- res &= ok;
- if (!ok) {
- expected = (mi1.IsFamily) ? "protected" : "!protected";
- Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
- ok = (mi1.IsAssembly == mi2.IsAssembly);
- res &= ok;
- if (!ok) {
- expected = (mi1.IsAssembly) ? "internal" : "!internal";
- Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
-
- ok = (mi1.IsStatic == mi2.IsStatic);
- res &= ok;
- if (!ok) {
- expected = (mi1.IsStatic) ? "static" : "instance";
- Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
-
-
- // parameters
-
- ok = Compare.Parameters (mi1.GetParameters (), mi2.GetParameters ());
- res &= ok;
- if (!ok && Verifier.stopOnError) return res;
-
-
- ok = (mi1.CallingConvention == mi2.CallingConvention);
- res &= ok;
- if (!ok) {
- Verifier.Log.Write ("error", "Calling conventions mismatch.", ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
-
-
-
- return res;
- }
-
-
- public static bool Fields (FieldInfo fi1, FieldInfo fi2)
- {
- if (fi2 == null) {
- Verifier.Log.Write ("error", String.Format ("There is no such field {0}.", fi1.Name), ImportanceLevel.MEDIUM);
- return false;
- }
-
- bool res = true;
- bool ok;
- string expected;
-
- Verifier.Log.Write ("field", String.Format ("{0}.", fi1.Name));
-
- ok = (fi1.IsPrivate == fi2.IsPrivate);
- res &= ok;
- if (!ok) {
- expected = (fi1.IsPublic) ? "public" : "private";
- Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
- ok = (fi1.IsFamily == fi2.IsFamily);
- res &= ok;
- if (!ok) {
- expected = (fi1.IsFamily) ? "protected" : "!protected";
- Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
- ok = (fi1.IsAssembly == fi2.IsAssembly);
- res &= ok;
- if (!ok) {
- expected = (fi1.IsAssembly) ? "internal" : "!internal";
- Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
- ok = (fi1.IsInitOnly == fi2.IsInitOnly);
- res &= ok;
- if (!ok) {
- expected = (fi1.IsInitOnly) ? "readonly" : "!readonly";
- Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
- ok = (fi1.IsStatic == fi2.IsStatic);
- res &= ok;
- if (!ok) {
- expected = (fi1.IsStatic) ? "static" : "instance";
- Verifier.Log.Write ("error", String.Format ("Accessibility levels mismatch (expected [{0}]).", expected), ImportanceLevel.MEDIUM);
- if (Verifier.stopOnError) return res;
- }
-
- return res;
- }
-
-
-
- public static bool Types (Type type1, Type type2)
- {
- // NOTE:
- // simply calling type1.Equals (type2) won't work,
- // types are in different assemblies hence they have
- // different (fully-qualified) names.
- int eqFlags = 0;
- eqFlags |= (type1.IsAbstract == type2.IsAbstract) ? 0 : 0x001;
- eqFlags |= (type1.IsClass == type2.IsClass) ? 0 : 0x002;
- eqFlags |= (type1.IsValueType == type2.IsValueType) ? 0 : 0x004;
- eqFlags |= (type1.IsPublic == type2.IsPublic) ? 0 : 0x008;
- eqFlags |= (type1.IsSealed == type2.IsSealed) ? 0 : 0x010;
- eqFlags |= (type1.IsEnum == type2.IsEnum) ? 0 : 0x020;
- eqFlags |= (type1.IsPointer == type2.IsPointer) ? 0 : 0x040;
- eqFlags |= (type1.IsPrimitive == type2.IsPrimitive) ? 0 : 0x080;
- bool res = (eqFlags == 0);
-
- if (!res) {
- // TODO: convert flags into descriptive message.
- Verifier.Log.Write ("error", "Types mismatch (0x" + eqFlags.ToString("X") + ").", ImportanceLevel.HIGH);
- }
-
-
- bool ok;
-
- ok = (type1.Attributes & TypeAttributes.BeforeFieldInit) ==
- (type2.Attributes & TypeAttributes.BeforeFieldInit);
- if (!ok) {
- Verifier.Log.Write ("error", "Types attributes mismatch: BeforeFieldInit.", ImportanceLevel.HIGH);
- }
- res &= ok;
-
- ok = (type1.Attributes & TypeAttributes.ExplicitLayout) ==
- (type2.Attributes & TypeAttributes.ExplicitLayout);
- if (!ok) {
- Verifier.Log.Write ("error", "Types attributes mismatch: ExplicitLayout.", ImportanceLevel.HIGH);
- }
- res &= ok;
-
- ok = (type1.Attributes & TypeAttributes.SequentialLayout) ==
- (type2.Attributes & TypeAttributes.SequentialLayout);
- if (!ok) {
- Verifier.Log.Write ("error", "Types attributes mismatch: SequentialLayout.", ImportanceLevel.HIGH);
- }
- res &= ok;
-
- ok = (type1.Attributes & TypeAttributes.Serializable) ==
- (type2.Attributes & TypeAttributes.Serializable);
- if (!ok) {
- Verifier.Log.Write ("error", "Types attributes mismatch: Serializable.", ImportanceLevel.HIGH);
- }
- res &= ok;
-
- return res;
- }
-
- }
-
-
-
-
- ////////////////////////////////
- // Log
- ////////////////////////////////
-
- public enum ImportanceLevel : int {
- LOW = 0, MEDIUM, HIGH
- }
-
-
- public interface ILogger {
-
- void Write (string tag, string msg, ImportanceLevel importance);
- void Write (string msg, ImportanceLevel level);
- void Write (string tag, string msg);
- void Write (string msg);
- ImportanceLevel DefaultImportance {get; set;}
- void Flush ();
- void Close ();
- }
-
-
- public abstract class AbstractLogger : ILogger {
- private ImportanceLevel defImportance = ImportanceLevel.MEDIUM;
-
- public abstract void Write (string tag, string msg, ImportanceLevel importance);
- public abstract void Write (string msg, ImportanceLevel level);
-
- public virtual void Write (string tag, string msg)
- {
- Write (tag, msg, DefaultImportance);
- }
-
- public virtual void Write (string msg)
- {
- Write (msg, DefaultImportance);
- }
-
- public virtual ImportanceLevel DefaultImportance {
- get {
- return defImportance;
- }
- set {
- defImportance = value < ImportanceLevel.LOW
- ? ImportanceLevel.LOW
- : value > ImportanceLevel.HIGH
- ? ImportanceLevel.HIGH
- : value;
- }
- }
-
- public abstract void Flush ();
- public abstract void Close ();
-
- }
-
-
-
- public class TextLogger : AbstractLogger {
-
- private TextWriter writer;
-
- public TextLogger (TextWriter writer)
- {
- if (writer == null)
- throw new NullReferenceException ();
-
- this.writer = writer;
- }
-
- private void DoWrite (string tag, string msg)
- {
- if (tag != null && tag.Length > 0) {
- writer.WriteLine ("[{0}]\t{1}", tag, msg);
- } else {
- writer.WriteLine ("\t\t" + msg);
- }
- }
-
- public override void Write (string tag, string msg, ImportanceLevel importance)
- {
- int v = Log.VerboseLevel;
- switch (v) {
- case 0 :
- break;
- case 1 :
- if (importance >= ImportanceLevel.HIGH) {
- DoWrite (tag, msg);
- }
- break;
- case 2 :
- if (importance >= ImportanceLevel.MEDIUM) {
- DoWrite (tag, msg);
- }
- break;
- case 3 :
- DoWrite (tag, msg);
- break;
- default:
- break;
- }
- }
-
- public override void Write (string msg, ImportanceLevel importance)
- {
- Write (null, msg, importance);
- }
-
- public override void Flush ()
- {
- Console.Out.Flush ();
- }
-
- public override void Close ()
- {
- if (writer != Console.Out && writer != Console.Error) {
- writer.Close ();
- }
- }
- }
-
-
-
- public sealed class Log {
-
- private static int verbose = 3;
-
- private ArrayList consumers;
-
- public Log (bool useDefault)
- {
- consumers = new ArrayList ();
- if (useDefault) AddConsumer (new TextLogger (Console.Out));
- }
-
- public Log () : this (true)
- {
- }
-
-
- public static int VerboseLevel {
- get {
- return verbose;
- }
- set {
- verbose = (value < 0)
- ? 0
- : (value > 3)
- ? 3 : value;
- }
- }
-
- public void AddConsumer (ILogger consumer)
- {
- consumers.Add (consumer);
- }
-
-
- public void Write (string tag, string msg, ImportanceLevel importance)
- {
- foreach (ILogger logger in consumers) {
- if (tag == null || tag == "") {
- logger.Write (msg, importance);
- } else {
- logger.Write (tag, msg, importance);
- }
- }
- }
-
- public void Write (string msg, ImportanceLevel importance)
- {
- Write (null, msg, importance);
- }
-
-
- public void Write (string tag, string msg)
- {
- foreach (ILogger logger in consumers) {
- if (tag == null || tag == "") {
- logger.Write (msg);
- } else {
- logger.Write (tag, msg);
- }
- }
- }
-
- public void Write (string msg)
- {
- Write (null, msg);
- }
-
-
- public void Flush ()
- {
- foreach (ILogger logger in consumers) {
- logger.Flush ();
- }
- }
-
-
- public void Close ()
- {
- foreach (ILogger logger in consumers) {
- logger.Flush ();
- logger.Close ();
- }
- }
-
- }
-
-
-
-
-
-
- ////////////////////////////////
- // Main
- ////////////////////////////////
-
- public class Verifier {
-
- public static readonly Log log = new Log ();
- public static bool stopOnError = false;
- public static bool ignoreMissingTypes = true;
- public static bool checkOptionalFlags = true;
-
- private static readonly IList excluded;
-
- static Verifier ()
- {
- excluded = new ArrayList ();
- excluded.Add ("<PrivateImplementationDetails>");
- }
-
-
- private Verifier ()
- {
- }
-
- public static Log Log {
- get {
- return log;
- }
- }
-
- public static IList Excluded {
- get {
- return excluded;
- }
- }
-
-
-
- public static void Main (String [] args)
- {
- if (args.Length < 2) {
- Console.WriteLine ("Usage: verifier assembly1 assembly2");
- } else {
- string name1 = args [0];
- string name2 = args [1];
-
- bool ok = false;
-
- AssemblyStuff asm1 = new AssemblyStuff (name1);
- AssemblyStuff asm2 = new AssemblyStuff (name2);
- ok = asm1.Load ();
- if (!ok) {
- Console.WriteLine ("Unable to load assembly {0}.", name1);
- Environment.Exit (-1);
- }
-
- ok = asm2.Load ();
- if (!ok) {
- Console.WriteLine ("Unable to load assembly {0}.", name2);
- Environment.Exit (-1);
- }
-
-
- try {
- ok = (asm1 == asm2);
- } catch {
- ok = false;
- } finally {
- Log.Close ();
- }
-
- if (!ok) {
- Console.WriteLine ("--- not equal");
- Environment.Exit (-1);
- }
- }
- }
-
- }
-
-
-}
-
g_free (console_handle->filename);
- if (fd > 2)
+ if (fd > 2) {
+ if (console_handle->share_info)
+ _wapi_handle_share_release (console_handle->share_info);
close (fd);
+ }
}
static WapiFileType console_getfiletype(void)
/* No filename with pipe handles */
+ if (pipe_handle->share_info)
+ _wapi_handle_share_release (pipe_handle->share_info);
+
close (fd);
}
#endif
if (S_ISFIFO (statbuf.st_mode)) {
handle_type = WAPI_HANDLE_PIPE;
+ /* maintain invariant that pipes have no filename */
+ file_handle.filename = NULL;
+ g_free (filename);
+ filename = NULL;
} else if (S_ISCHR (statbuf.st_mode)) {
handle_type = WAPI_HANDLE_CONSOLE;
} else {
#define WaitForMultipleObjects wapi_WaitForMultipleObjects
#define WaitForMultipleObjectsEx wapi_WaitForMultipleObjectsEx
#define WaitForInputIdle wapi_WaitForInputIdle
+#define GetThreadPriority wapi_GetThreadPriority
+#define SetThreadPriority wapi_SetThreadPriority
#endif /* __WAPI_REMAP_H__ */
{"Mono.Security.Win32", 0},
{"Mono.Xml.Ext", 0},
{"Novell.Directory.Ldap", 0},
- {"Npgsql", 0},
{"PEAPI", 0},
{"System", 0},
{"System.ComponentModel.Composition", 2},
ICALL(MATH_18, "Tanh", ves_icall_System_Math_Tanh)
ICALL_TYPE(MCATTR, "System.MonoCustomAttrs", MCATTR_1)
-ICALL(MCATTR_1, "GetCustomAttributesDataInternal", mono_reflection_get_custom_attrs_data)
+ICALL(MCATTR_1, "GetCustomAttributesDataInternal", ves_icall_MonoCustomAttrs_GetCustomAttributesDataInternal)
ICALL(MCATTR_2, "GetCustomAttributesInternal", custom_attrs_get_by_type)
ICALL(MCATTR_3, "IsDefinedInternal", custom_attrs_defined_internal)
}
static MonoReflectionType *
-type_from_parsed_name (MonoTypeNameParse *info, MonoBoolean ignoreCase)
+type_from_parsed_name (MonoTypeNameParse *info, MonoBoolean ignoreCase, MonoError *error)
{
- MonoError error;
- MonoReflectionType *ret;
MonoMethod *m, *dest;
MonoType *type = NULL;
MonoAssembly *assembly = NULL;
gboolean type_resolve = FALSE;
+ mono_error_init (error);
+
/*
* We must compute the calling assembly as type loading must happen under a metadata context.
* For example. The main assembly is a.exe and Type.GetType is called from dir/b.dll. Without
if (!type)
return NULL;
- ret = mono_type_get_object_checked (mono_domain_get (), type, &error);
- mono_error_raise_exception (&error); /* FIXME don't raise here */
-
- return ret;
+ return mono_type_get_object_checked (mono_domain_get (), type, error);
}
-#ifdef UNUSED
-MonoReflectionType *
-mono_type_get (const char *str)
-{
- char *copy = g_strdup (str);
- MonoTypeNameParse info;
- MonoReflectionType *type;
- gboolean parsedOk;
-
- parsedOk = mono_reflection_parse_type(copy, &info);
- if (!parsedOk) {
- mono_reflection_free_type_info (&info);
- g_free(copy);
- return NULL;
- }
-
- type = type_from_parsed_name (&info, FALSE);
-
- mono_reflection_free_type_info (&info);
- g_free(copy);
-
- return type;
-}
-#endif
-
ICALL_EXPORT MonoReflectionType*
ves_icall_type_from_name (MonoString *name,
MonoBoolean throwOnError,
MonoBoolean ignoreCase)
{
+ MonoError error;
char *str = mono_string_to_utf8 (name);
MonoTypeNameParse info;
MonoReflectionType *type;
return NULL;
}
- type = type_from_parsed_name (&info, ignoreCase);
+ type = type_from_parsed_name (&info, ignoreCase, &error);
mono_reflection_free_type_info (&info);
g_free (str);
+ if (!mono_error_ok (&error)) {
+ if (throwOnError)
+ mono_error_set_pending_exception (&error);
+ else
+ mono_error_cleanup (&error);
+ return NULL;
+ }
+
if (type == NULL){
MonoException *e = NULL;
}
static MonoObject*
-create_version (MonoDomain *domain, guint32 major, guint32 minor, guint32 build, guint32 revision)
+create_version (MonoDomain *domain, guint32 major, guint32 minor, guint32 build, guint32 revision, MonoError *error)
{
static MonoClass *System_Version = NULL;
static MonoMethod *create_version = NULL;
- MonoError error;
MonoObject *result;
gpointer args [4];
+
+ mono_error_init (error);
if (!System_Version) {
System_Version = mono_class_from_name (mono_defaults.corlib, "System", "Version");
args [1] = &minor;
args [2] = &build;
args [3] = &revision;
- result = mono_object_new_checked (domain, System_Version, &error);
- mono_error_raise_exception (&error); /* FIXME don't raise here */
+ result = mono_object_new_checked (domain, System_Version, error);
+ return_val_if_nok (error, NULL);
- mono_runtime_invoke_checked (create_version, result, args, &error);
- mono_error_raise_exception (&error); /* FIXME don't raise here */
+ mono_runtime_invoke_checked (create_version, result, args, error);
+ return_val_if_nok (error, NULL);
return result;
}
}
for (i = 0; i < count; i++) {
+ MonoObject *version;
MonoReflectionAssemblyName *aname;
guint32 cols [MONO_ASSEMBLYREF_SIZE];
aname->flags = cols [MONO_ASSEMBLYREF_FLAGS];
aname->versioncompat = 1; /* SameMachine (default) */
aname->hashalg = ASSEMBLY_HASH_SHA1; /* SHA1 (default) */
- MONO_OBJECT_SETREF (aname, version, create_version (domain, aname->major, aname->minor, aname->build, aname->revision));
+
+ version = create_version (domain, aname->major, aname->minor, aname->build, aname->revision, &error);
+ mono_error_raise_exception (&error);
+
+ MONO_OBJECT_SETREF (aname, version, version);
if (create_culture) {
gpointer args [2];
}
static void
-fill_reflection_assembly_name (MonoDomain *domain, MonoReflectionAssemblyName *aname, MonoAssemblyName *name, const char *absolute, gboolean by_default_version, gboolean default_publickey, gboolean default_token)
+fill_reflection_assembly_name (MonoDomain *domain, MonoReflectionAssemblyName *aname, MonoAssemblyName *name, const char *absolute, gboolean by_default_version, gboolean default_publickey, gboolean default_token, MonoError *error)
{
static MonoMethod *create_culture = NULL;
- MonoError error;
MonoObject *obj;
gpointer args [2];
guint32 pkey_len;
gchar *codebase;
MonoBoolean assembly_ref = 0;
+ mono_error_init (error);
+
MONO_OBJECT_SETREF (aname, name, mono_string_new (domain, name->name));
aname->major = name->major;
aname->minor = name->minor;
aname->versioncompat = 1; /* SameMachine (default) */
aname->processor_architecture = name->arch;
- if (by_default_version)
- MONO_OBJECT_SETREF (aname, version, create_version (domain, name->major, name->minor, name->build, name->revision));
+ if (by_default_version) {
+ MonoObject *version;
+
+ version = create_version (domain, name->major, name->minor, name->build, name->revision, error);
+ return_if_nok (error);
+
+ MONO_OBJECT_SETREF (aname, version, version);
+ }
codebase = NULL;
if (absolute != NULL && *absolute != '\0') {
args [0] = mono_string_new (domain, name->culture);
args [1] = &assembly_ref;
- obj = mono_runtime_invoke_checked (create_culture, NULL, args, &error);
- mono_error_raise_exception (&error); /* FIXME don't raise here */
+ obj = mono_runtime_invoke_checked (create_culture, NULL, args, error);
+ return_if_nok (error);
MONO_OBJECT_SETREF (aname, cultureInfo, obj);
}
ICALL_EXPORT void
ves_icall_System_Reflection_Assembly_FillName (MonoReflectionAssembly *assembly, MonoReflectionAssemblyName *aname)
{
+ MonoError error;
gchar *absolute;
MonoAssembly *mass = assembly->assembly;
if (g_path_is_absolute (mass->image->name)) {
- fill_reflection_assembly_name (mono_object_domain (assembly),
- aname, &mass->aname, mass->image->name, TRUE,
- TRUE, TRUE);
+ fill_reflection_assembly_name (mono_object_domain (assembly), aname, &mass->aname, mass->image->name, TRUE, TRUE, TRUE, &error);
+ mono_error_set_pending_exception (&error);
return;
}
absolute = g_build_filename (mass->basedir, mass->image->name, NULL);
- fill_reflection_assembly_name (mono_object_domain (assembly),
- aname, &mass->aname, absolute, TRUE, TRUE,
- TRUE);
+ fill_reflection_assembly_name (mono_object_domain (assembly), aname, &mass->aname, absolute, TRUE, TRUE, TRUE, &error);
+ mono_error_set_pending_exception (&error);
g_free (absolute);
}
ICALL_EXPORT void
ves_icall_System_Reflection_Assembly_InternalGetAssemblyName (MonoString *fname, MonoReflectionAssemblyName *aname)
{
+ MonoError error;
char *filename;
MonoImageOpenStatus status = MONO_IMAGE_OK;
gboolean res;
return;
}
- fill_reflection_assembly_name (mono_domain_get (), aname, &name, filename,
- TRUE, FALSE, TRUE);
+ fill_reflection_assembly_name (mono_domain_get (), aname, &name, filename, TRUE, FALSE, TRUE, &error);
+ mono_error_set_pending_exception (&error);
- g_free (filename);
mono_image_close (image);
+ g_free (filename);
}
ICALL_EXPORT MonoBoolean
}
static MonoArray*
-mono_module_get_types (MonoDomain *domain, MonoImage *image, MonoArray **exceptions, MonoBoolean exportedOnly)
+mono_module_get_types (MonoDomain *domain, MonoImage *image, MonoArray **exceptions, MonoBoolean exportedOnly, MonoError *error)
{
- MonoError error;
MonoReflectionType *rt;
MonoArray *res;
MonoClass *klass;
MonoTableInfo *tdef = &image->tables [MONO_TABLE_TYPEDEF];
int i, count;
+ mono_error_init (error);
+
/* we start the count from 1 because we skip the special type <Module> */
if (exportedOnly) {
count = 0;
count = 0;
for (i = 1; i < tdef->rows; ++i) {
if (!exportedOnly || mono_module_type_is_visible (tdef, image, i + 1)) {
- klass = mono_class_get_checked (image, (i + 1) | MONO_TOKEN_TYPE_DEF, &error);
+ klass = mono_class_get_checked (image, (i + 1) | MONO_TOKEN_TYPE_DEF, error);
mono_loader_assert_no_error (); /* Plug any leaks */
- g_assert (mono_error_ok (&error));
+ mono_error_assert_ok (error);
if (klass) {
- rt = mono_type_get_object_checked (domain, &klass->byval_arg, &error);
- mono_error_raise_exception (&error); /* FIXME don't raise here */
+ rt = mono_type_get_object_checked (domain, &klass->byval_arg, error);
+ return_val_if_nok (error, NULL);
mono_array_setref (res, count, rt);
} else {
- MonoException *ex = mono_error_convert_to_exception (&error);
+ MonoException *ex = mono_error_convert_to_exception (error);
mono_array_setref (*exceptions, count, ex);
}
count++;
ICALL_EXPORT MonoArray*
ves_icall_System_Reflection_Assembly_GetTypes (MonoReflectionAssembly *assembly, MonoBoolean exportedOnly)
{
+ MonoError error;
MonoArray *res = NULL;
MonoArray *exceptions = NULL;
MonoImage *image = NULL;
g_assert (!assembly_is_dynamic (assembly->assembly));
image = assembly->assembly->image;
table = &image->tables [MONO_TABLE_FILE];
- res = mono_module_get_types (domain, image, &exceptions, exportedOnly);
+ res = mono_module_get_types (domain, image, &exceptions, exportedOnly, &error);
+ mono_error_raise_exception (&error);
/* Append data from all modules in the assembly */
for (i = 0; i < table->rows; ++i) {
MonoImage *loaded_image = mono_assembly_load_module (image->assembly, i + 1);
if (loaded_image) {
MonoArray *ex2;
- MonoArray *res2 = mono_module_get_types (domain, loaded_image, &ex2, exportedOnly);
+ MonoArray *res2;
+
+ res2 = mono_module_get_types (domain, loaded_image, &ex2, exportedOnly, &error);
+ mono_error_raise_exception (&error);
+
/* Append the new types to the end of the array */
if (mono_array_length (res2) > 0) {
guint32 len1, len2;
ICALL_EXPORT gboolean
ves_icall_System_Reflection_AssemblyName_ParseName (MonoReflectionAssemblyName *name, MonoString *assname)
{
+ MonoError error;
MonoAssemblyName aname;
MonoDomain *domain = mono_object_domain (name);
char *val;
return FALSE;
}
- fill_reflection_assembly_name (domain, name, &aname, "", is_version_defined,
- FALSE, is_token_defined);
+ fill_reflection_assembly_name (domain, name, &aname, "", is_version_defined, FALSE, is_token_defined, &error);
+ mono_error_set_pending_exception (&error);
mono_assembly_name_free (&aname);
g_free ((guint8*) aname.public_key);
ICALL_EXPORT MonoArray*
ves_icall_System_Reflection_Module_InternalGetTypes (MonoReflectionModule *module)
{
+ MonoError error;
MonoArray *exceptions;
int i;
if (!module->image)
return mono_array_new (mono_object_domain (module), mono_defaults.monotype_class, 0);
else {
- MonoArray *res = mono_module_get_types (mono_object_domain (module), module->image, &exceptions, FALSE);
+ MonoArray *res;
+
+ res = mono_module_get_types (mono_object_domain (module), module->image, &exceptions, FALSE, &error);
+ mono_error_raise_exception (&error);
+
for (i = 0; i < mono_array_length (exceptions); ++i) {
MonoException *ex = mono_array_get (exceptions, MonoException *, i);
if (ex) {
}
}
+ICALL_EXPORT MonoArray*
+ves_icall_MonoCustomAttrs_GetCustomAttributesDataInternal (MonoObject *obj)
+{
+ MonoError error;
+ MonoArray *result;
+ result = mono_reflection_get_custom_attrs_data_checked (obj, &error);
+ mono_error_set_pending_exception (&error);
+ return result;
+}
+
+
ICALL_EXPORT MonoString*
ves_icall_Mono_Runtime_GetDisplayName (void)
{
return ((guint64) value.t_free * page_size) / 1024;
#elif defined (__APPLE__)
mach_msg_type_number_t count = HOST_VM_INFO_COUNT;
+ mach_port_t host = mach_host_self();
+ vm_size_t page_size;
vm_statistics_data_t vmstat;
- if (KERN_SUCCESS != host_statistics(mach_host_self(), HOST_VM_INFO, (host_info_t)&vmstat, &count)) {
+ if (KERN_SUCCESS != host_statistics(host, HOST_VM_INFO, (host_info_t)&vmstat, &count)) {
g_warning ("Mono was unable to retrieve memory usage!");
return 0;
}
- return (guint64) vmstat.free_count;
+ host_page_size(host, &page_size);
+ return (guint64) vmstat.free_count * page_size;
#elif defined (HAVE_SYSCONF)
guint64 page_size = 0, num_pages = 0;
MonoObject*
mono_custom_attrs_get_attr_checked (MonoCustomAttrInfo *ainfo, MonoClass *attr_klass, MonoError *error);
+MonoArray*
+mono_reflection_get_custom_attrs_data_checked (MonoObject *obj, MonoError *error);
+
char*
mono_identifier_unescape_type_name_chars (char* identifier);
*/
MonoArray*
mono_reflection_get_custom_attrs_data (MonoObject *obj)
+{
+ MonoError error;
+ MonoArray* result;
+ result = mono_reflection_get_custom_attrs_data_checked (obj, &error);
+ mono_error_cleanup (&error); /* FIXME new API that doesn't swallow the error */
+ return result;
+}
+
+/*
+ * mono_reflection_get_custom_attrs_data_checked:
+ * @obj: a reflection obj handle
+ * @error: set on error
+ *
+ * Returns an array of System.Reflection.CustomAttributeData,
+ * which include information about attributes reflected on
+ * types loaded using the Reflection Only methods
+ */
+MonoArray*
+mono_reflection_get_custom_attrs_data_checked (MonoObject *obj, MonoError *error)
{
MonoArray *result;
MonoCustomAttrInfo *cinfo;
+ mono_error_init (error);
+
cinfo = mono_reflection_get_custom_attrs_info (obj);
if (cinfo) {
result = mono_custom_attrs_data_construct (cinfo);
} else
result = mono_array_new (mono_domain_get (), mono_defaults.customattribute_data_class, 0);
+ if (mono_loader_get_last_error ())
+ mono_error_set_from_loader_error (error);
+
return result;
}
MONO_API MonoArray* mono_reflection_get_custom_attrs_by_type (MonoObject *obj, MonoClass *attr_klass, MonoError *error);
MONO_API MonoArray* mono_reflection_get_custom_attrs (MonoObject *obj);
+MONO_RT_EXTERNAL_ONLY
MONO_API MonoArray* mono_reflection_get_custom_attrs_data (MonoObject *obj);
MONO_API MonoArray* mono_reflection_get_custom_attrs_blob (MonoReflectionAssembly *assembly, MonoObject *ctor, MonoArray *ctorArgs, MonoArray *properties, MonoArray *porpValues, MonoArray *fields, MonoArray* fieldValues);
static int last_major_gc_warned = -1;
static int num_degraded = 0;
- if (last_major_gc_warned < gc_stats.major_gc_count) {
+ if (last_major_gc_warned < (int)gc_stats.major_gc_count) {
++num_degraded;
if (num_degraded == 1 || num_degraded == 3)
mono_trace (G_LOG_LEVEL_INFO, MONO_TRACE_GC, "Warning: Degraded allocation. Consider increasing nursery-size if the warning persists.");
* Returns NULL if the something cannot be loaded.
*/
gpointer
-mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code)
+mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code, MonoError *error)
{
#ifdef MONO_ARCH_AOT_SUPPORTED
guint8 *p, *target, *plt_entry;
MonoAotModule *module = (MonoAotModule*)aot_module;
gboolean res, no_ftnptr = FALSE;
MonoMemPool *mp;
- MonoError error;
gboolean using_gsharedvt = FALSE;
+ mono_error_init (error);
+
//printf ("DYN: %p %d\n", aot_module, plt_info_offset);
p = &module->blob [plt_info_offset];
*/
if (mono_aot_only && ji.type == MONO_PATCH_INFO_METHOD && !ji.data.method->is_generic && !mono_method_check_context_used (ji.data.method) && !(ji.data.method->iflags & METHOD_IMPL_ATTRIBUTE_SYNCHRONIZED) &&
!mono_method_needs_static_rgctx_invoke (ji.data.method, FALSE) && !using_gsharedvt) {
- target = (guint8 *)mono_jit_compile_method (ji.data.method, &error);
- if (!mono_error_ok (&error))
- mono_error_raise_exception (&error);
+ target = (guint8 *)mono_jit_compile_method (ji.data.method, error);
+ if (!mono_error_ok (error))
+ return NULL;
no_ftnptr = TRUE;
} else {
- target = (guint8 *)mono_resolve_patch_target (NULL, mono_domain_get (), NULL, &ji, TRUE);
+ target = (guint8 *)mono_resolve_patch_target_checked (NULL, mono_domain_get (), NULL, &ji, TRUE, error);
+ if (!mono_error_ok (error))
+ return NULL;
}
/*
}
gpointer
-mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code)
+mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code, MonoError *error)
{
return NULL;
}
* To make async stack traces work, icalls which can block should have a wrapper.
* For Monitor.Enter, emit two calls: a fastpath which doesn't have a wrapper, and a slowpath, which does.
*/
- MonoBasicBlock *end_bb, *slowpath_bb;
+ MonoBasicBlock *end_bb;
NEW_BBLOCK (cfg, end_bb);
- NEW_BBLOCK (cfg, slowpath_bb);
- ins = mono_emit_jit_icall (cfg, is_v4 ? mono_monitor_enter_v4_fast : mono_monitor_enter_fast, args);
- MONO_EMIT_NEW_BIALU_IMM (cfg, OP_COMPARE_IMM, -1, ins->dreg, 0);
- MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_IBEQ, slowpath_bb);
- MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, end_bb);
- MONO_START_BB (cfg, slowpath_bb);
- ins = mono_emit_jit_icall (cfg, is_v4 ? mono_monitor_enter_v4 : mono_monitor_enter, args);
- MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_BR, end_bb);
+ ins = mono_emit_jit_icall (cfg, is_v4 ? (gpointer)mono_monitor_enter_v4_fast : (gpointer)mono_monitor_enter_fast, args);
+ MONO_EMIT_NEW_BIALU_IMM (cfg, OP_ICOMPARE_IMM, -1, ins->dreg, 0);
+ MONO_EMIT_NEW_BRANCH_BLOCK (cfg, OP_IBNE_UN, end_bb);
+ ins = mono_emit_jit_icall (cfg, is_v4 ? (gpointer)mono_monitor_enter_v4 : (gpointer)mono_monitor_enter, args);
MONO_START_BB (cfg, end_bb);
return ins;
}
#include <llvm/IR/Function.h>
#include <llvm/IR/IRBuilder.h>
#include <llvm/IR/Module.h>
+#include <llvm/IR/DIBuilder.h>
#include "mini-llvm-cpp.h"
{
unwrap<CallInst>(func)->setCallingConv (CallingConv::PreserveAll);
}
+
+void
+mono_llvm_create_di_compile_unit (LLVMModuleRef module)
+{
+ DIBuilder d(*unwrap(module));
+
+ d.createCompileUnit (0, "X", "Y", "Z", false, "", 0, "", DIBuilder::DebugEmissionKind::FullDebug, true);
+}
void
default_mono_llvm_unhandled_exception (void);
+void
+mono_llvm_create_di_compile_unit (LLVMModuleRef module);
+
G_END_DECLS
#endif /* __MONO_MINI_LLVM_CPP_H__ */
emit_dbg_info (&aot_module, filename, cu_name);
emit_aot_file_info (&aot_module);
+ mono_llvm_create_di_compile_unit (aot_module.lmodule);
+
/*
* Replace GOT entries for directly callable methods with the methods themselves.
* It would be easier to implement this by predefining all methods before compiling
}
gpointer
-mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors)
+mono_resolve_patch_target_checked (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors, MonoError *error)
{
unsigned char *ip = patch_info->ip.i + code;
gconstpointer target = NULL;
+ mono_error_init (error);
+
switch (patch_info->type) {
case MONO_PATCH_INFO_BB:
/*
case MONO_PATCH_INFO_TYPE_FROM_HANDLE: {
gpointer handle;
MonoClass *handle_class;
- MonoError error;
handle = mono_ldtoken_checked (patch_info->data.token->image,
- patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, &error);
- if (!mono_error_ok (&error))
- g_error ("Could not patch ldtoken due to %s", mono_error_get_message (&error));
+ patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, error);
+ if (!mono_error_ok (error))
+ g_error ("Could not patch ldtoken due to %s", mono_error_get_message (error));
mono_class_init (handle_class);
mono_class_init (mono_class_from_mono_type ((MonoType *)handle));
- target = mono_type_get_object_checked (domain, (MonoType *)handle, &error);
- mono_error_raise_exception (&error);
-
+ target = mono_type_get_object_checked (domain, (MonoType *)handle, error);
+ if (!mono_error_ok (error))
+ return NULL;
break;
}
case MONO_PATCH_INFO_LDTOKEN: {
gpointer handle;
MonoClass *handle_class;
- MonoError error;
handle = mono_ldtoken_checked (patch_info->data.token->image,
- patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, &error);
- if (!mono_error_ok (&error))
- g_error ("Could not patch ldtoken due to %s", mono_error_get_message (&error));
+ patch_info->data.token->token, &handle_class, patch_info->data.token->has_context ? &patch_info->data.token->context : NULL, error);
+ if (!mono_error_ok (error))
+ g_error ("Could not patch ldtoken due to %s", mono_error_get_message (error));
mono_class_init (handle_class);
target = handle;
if (run_cctors) {
target = mono_lookup_pinvoke_call (patch_info->data.method, &exc_class, &exc_arg);
if (!target) {
- if (mono_aot_only)
- mono_raise_exception (mono_exception_from_name_msg (mono_defaults.corlib, "System", exc_class, exc_arg));
+ if (mono_aot_only) {
+ mono_error_set_exception_instance (error, mono_exception_from_name_msg (mono_defaults.corlib, "System", exc_class, exc_arg));
+ return NULL;
+ }
g_error ("Unable to resolve pinvoke method '%s' Re-run with MONO_LOG_LEVEL=debug for more information.\n", mono_method_full_name (patch_info->data.method, TRUE));
}
} else {
return (gpointer)target;
}
+gpointer
+mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors)
+{
+ MonoError error;
+ gpointer res;
+
+ res = mono_resolve_patch_target_checked (method, domain, code, patch_info, run_cctors, &error);
+ mono_error_raise_exception (&error); /* FIXME don't raise here */
+ return res;
+}
+
void
mini_init_gsctx (MonoDomain *domain, MonoMemPool *mp, MonoGenericContext *context, MonoGenericSharingContext *gsctx)
{
{
guint32 plt_info_offset = mono_aot_get_plt_info_offset (regs, code);
gpointer res;
+ MonoError error;
trampoline_calls ++;
- res = mono_aot_plt_resolve (aot_module, plt_info_offset, code);
+ res = mono_aot_plt_resolve (aot_module, plt_info_offset, code, &error);
if (!res) {
+ if (!mono_error_ok (&error)) {
+ mono_error_set_pending_exception (&error);
+ return NULL;
+ }
if (mono_loader_get_last_error ()) {
MonoError error;
gint mono_patch_info_equal (gconstpointer ka, gconstpointer kb);
MonoJumpInfo *mono_patch_info_list_prepend (MonoJumpInfo *list, int ip, MonoJumpInfoType type, gconstpointer target);
gpointer mono_resolve_patch_target (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors) MONO_LLVM_INTERNAL;
+gpointer mono_resolve_patch_target_checked (MonoMethod *method, MonoDomain *domain, guint8 *code, MonoJumpInfo *patch_info, gboolean run_cctors, MonoError *error) MONO_LLVM_INTERNAL;
gpointer mono_jit_find_compiled_method_with_jit_info (MonoDomain *domain, MonoMethod *method, MonoJitInfo **ji);
gpointer mono_jit_find_compiled_method (MonoDomain *domain, MonoMethod *method);
gpointer mono_jit_compile_method (MonoMethod *method, MonoError *error);
gboolean mono_aot_get_cached_class_info (MonoClass *klass, MonoCachedClassInfo *res);
gboolean mono_aot_get_class_from_name (MonoImage *image, const char *name_space, const char *name, MonoClass **klass);
MonoJitInfo* mono_aot_find_jit_info (MonoDomain *domain, MonoImage *image, gpointer addr);
-gpointer mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code);
+gpointer mono_aot_plt_resolve (gpointer aot_module, guint32 plt_info_offset, guint8 *code, MonoError *error);
void mono_aot_patch_plt_entry (guint8 *code, guint8 *plt_entry, gpointer *got, mgreg_t *regs, guint8 *addr);
gpointer mono_aot_get_method_from_vt_slot (MonoDomain *domain, MonoVTable *vtable, int slot);
gpointer mono_aot_create_specific_trampoline (MonoImage *image, gpointer arg1, MonoTrampolineType tramp_type, MonoDomain *domain, guint32 *code_len);
if (!for_mature) {
sgen_client_degraded_allocation (size);
SGEN_ATOMIC_ADD_P (degraded_mode, size);
- sgen_ensure_free_space (size);
+ sgen_ensure_free_space (size, GENERATION_OLD);
} else {
if (sgen_need_major_collection (size))
sgen_perform_collection (size, GENERATION_OLD, "mature allocation failure", !for_mature);
* always loop we will loop endlessly in the case of
* OOM).
*/
- sgen_ensure_free_space (real_size);
+ sgen_ensure_free_space (real_size, GENERATION_NURSERY);
if (!degraded_mode)
p = (void **)sgen_nursery_alloc (size);
}
p = (void **)sgen_nursery_alloc_range (tlab_size, size, &alloc_size);
if (!p) {
/* See comment above in similar case. */
- sgen_ensure_free_space (tlab_size);
+ sgen_ensure_free_space (tlab_size, GENERATION_NURSERY);
if (!degraded_mode)
p = (void **)sgen_nursery_alloc_range (tlab_size, size, &alloc_size);
}
*/
#define SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO 0.33
-/*
- * How much more we allow the heap to grow, relative to the allowance, while doing
- * a concurrent collection, before forcing its finish.
- */
-#define SGEN_DEFAULT_CONCURRENT_HEAP_ALLOWANCE_RATIO 0.25
-
/*
* Default ratio of memory we want to release in a major collection in relation to the the current heap size.
*
sgen_pin_stats_print_class_stats ();
- sgen_drain_gray_stack (ctx);
-
/* FIXME: Why do we do this at this specific, seemingly random, point? */
sgen_client_collecting_minor (&fin_ready_queue, &critical_fin_queue);
time_major_fragment_creation += TV_ELAPSED (atv, btv);
binary_protocol_sweep_begin (GENERATION_OLD, !major_collector.sweeps_lazily);
+ sgen_memgov_major_pre_sweep ();
TV_GETTIME (atv);
time_major_free_bigobjs += TV_ELAPSED (btv, atv);
* LOCKING: The GC lock MUST be held.
*/
void
-sgen_ensure_free_space (size_t size)
+sgen_ensure_free_space (size_t size, int generation)
{
int generation_to_collect = -1;
const char *reason = NULL;
- if (size > SGEN_MAX_SMALL_OBJ_SIZE) {
+ if (generation == GENERATION_OLD) {
if (sgen_need_major_collection (size)) {
reason = "LOS overflow";
generation_to_collect = GENERATION_OLD;
void sgen_pin_object (GCObject *object, SgenGrayQueue *queue);
void sgen_set_pinned_from_failed_allocation (mword objsize);
-void sgen_ensure_free_space (size_t size);
+void sgen_ensure_free_space (size_t size, int generation);
void sgen_gc_collect (int generation);
void sgen_perform_collection (size_t requested_size, int generation_to_collect, const char *reason, gboolean wait_to_finish);
los_segment_index += size + sizeof (LOSObject);
g_assert (los_segment_index <= LOS_SEGMENT_SIZE);
#else
- sgen_ensure_free_space (size);
+ sgen_ensure_free_space (size, GENERATION_OLD);
#ifdef USE_MALLOC
obj = malloc (size + sizeof (LOSObject));
int count = 0;
#ifdef __GNUC__
- if (sizeof (mword) == sizeof (unsigned long))
- count += __builtin_popcountl (d);
+ if (sizeof (mword) == 8)
+ count += __builtin_popcountll (d);
else
count += __builtin_popcount (d);
#else
/* use this to tune when to do a major/minor collection */
static mword major_collection_trigger_size;
+static mword major_pre_sweep_heap_size;
+static mword major_start_heap_size;
+
static mword last_major_num_sections = 0;
static mword last_los_memory_usage = 0;
sgen_memgov_calculate_minor_collection_allowance (void)
{
size_t new_major, new_heap_size, allowance_target, allowance;
+ size_t decrease;
if (!need_calculate_minor_collection_allowance)
return;
allowance = MAX (allowance_target, MIN_MINOR_COLLECTION_ALLOWANCE);
+ /*
+ * For the concurrent collector, we decrease the allowance relative to the memory
+ * growth during the M&S phase, survival rate of the collection and the allowance
+ * ratio.
+ */
+ decrease = (major_pre_sweep_heap_size - major_start_heap_size) * ((float)new_heap_size / major_pre_sweep_heap_size) * (SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO + 1);
+ if (decrease > allowance)
+ decrease = allowance;
+ allowance -= decrease;
+
if (new_heap_size + allowance > soft_heap_limit) {
if (new_heap_size > soft_heap_limit)
allowance = MIN_MINOR_COLLECTION_ALLOWANCE;
if (heap_size <= major_collection_trigger_size)
return FALSE;
- /* We allow the heap to grow an additional third of the allowance during a concurrent collection */
- if ((heap_size - major_collection_trigger_size) >
- (major_collection_trigger_size
- * (SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO / (SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO + 1))
- * SGEN_DEFAULT_CONCURRENT_HEAP_ALLOWANCE_RATIO)) {
+ /*
+ * The more the heap grows, the more we need to decrease the allowance above,
+ * in order to have similar trigger sizes as the synchronous collector.
+ * If the heap grows so much that we would need to have a negative allowance,
+ * we force the finishing of the collection, to avoid increased memory usage.
+ */
+ if ((heap_size - major_start_heap_size) > major_start_heap_size * SGEN_DEFAULT_ALLOWANCE_HEAP_SIZE_RATIO)
return TRUE;
- }
return FALSE;
}
{
}
+void
+sgen_memgov_major_pre_sweep (void)
+{
+ if (sgen_concurrent_collection_in_progress ()) {
+ major_pre_sweep_heap_size = get_heap_size ();
+ } else {
+ /* We decrease the allowance only in the concurrent case */
+ major_pre_sweep_heap_size = major_start_heap_size;
+ }
+}
+
void
sgen_memgov_major_collection_start (void)
{
need_calculate_minor_collection_allowance = TRUE;
+ major_start_heap_size = get_heap_size ();
if (debug_print_allowance) {
- SGEN_LOG (0, "Starting collection with heap size %ld bytes", (long)get_heap_size ());
+ SGEN_LOG (0, "Starting collection with heap size %ld bytes", (long)major_start_heap_size);
}
}
void sgen_memgov_minor_collection_start (void);
void sgen_memgov_minor_collection_end (void);
+void sgen_memgov_major_pre_sweep (void);
void sgen_memgov_major_collection_start (void);
void sgen_memgov_major_collection_end (gboolean forced);
return 2;
}
+ public static int test_0_reflection_on_field_with_missing_custom_attr () {
+ var t = typeof (BadOverridesDriver).Assembly.GetType ("FieldWithMissingCustomAttribute");
+ try {
+ Console.WriteLine (t.GetFields ()[0].CustomAttributes);
+ return 1;
+ } catch (FileNotFoundException) {
+ return 0;
+ }
+ return 2;
+ }
public static int Main () {
return TestDriver.RunTests (typeof (Tests));
{\r
.ver 0:0:0:0\r
}\r
+.assembly extern notFoundAssembly\r
+{\r
+ .ver 0:0:0:0\r
+}\r
\r
.assembly 'load-missing'\r
{\r
.field public class [t]Missing BrokenField\r
.field public static int32 WorkingField\r
}\r
+\r
+.class public auto ansi beforefieldinit FieldWithMissingCustomAttribute\r
+{\r
+ .field public object f\r
+ .custom instance void class [notFoundAssembly]SomeAttribute::'.ctor'() = (01 00 00 00 ) // ....\r
+}\r
mono_install_assembly_refonly_preload_hook
mono_install_assembly_refonly_search_hook
mono_install_assembly_search_hook
+mono_install_load_aot_data_hook
mono_install_runtime_cleanup
mono_install_unhandled_exception_hook
mono_is_debugger_attached
mono_thread_set_main
mono_thread_set_manage_callback
mono_thread_stop
+mono_threads_assert_gc_safe_region
+mono_threads_assert_gc_unsafe_region
mono_threads_attach_tools_thread
+mono_threads_enter_gc_safe_region
mono_threads_enter_gc_unsafe_region
+mono_threads_exit_gc_safe_region
mono_threads_exit_gc_unsafe_region
mono_threads_get_default_stacksize
mono_threads_request_thread_dump
mono_install_assembly_refonly_preload_hook
mono_install_assembly_refonly_search_hook
mono_install_assembly_search_hook
+mono_install_load_aot_data_hook
mono_install_runtime_cleanup
mono_install_unhandled_exception_hook
mono_is_debugger_attached
mono_thread_set_main
mono_thread_set_manage_callback
mono_thread_stop
+mono_threads_assert_gc_safe_region
+mono_threads_assert_gc_unsafe_region
mono_threads_attach_tools_thread
+mono_threads_enter_gc_safe_region
mono_threads_enter_gc_unsafe_region
+mono_threads_exit_gc_safe_region
mono_threads_exit_gc_unsafe_region
mono_threads_get_default_stacksize
mono_threads_request_thread_dump
</project>
<project dir="class/corlib" library="corlib-tests-net_4_x">
<boot>false</boot>
- <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -lib:./../../class/lib/net_4_x -debug -optimize -r:./../../class/lib/net_4_x/mscorlib.dll -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -debug -nowarn:168,219,618,672 -unsafe -r:Mono.Posix.dll -r:System.Core.dll -define:MONO_DATACONVERTER_STATIC_METHODS -resource:Test/resources/Resources.resources</flags>
+ <flags>/codepage:65001 -unsafe -nostdlib -nowarn:612,618,1635 -d:INSIDE_CORLIB,MONO_CULTURE_DATA -d:LIBC -d:FEATURE_PAL,GENERICS_WORK,FEATURE_LIST_PREDICATES,FEATURE_SERIALIZATION,FEATURE_ASCII,FEATURE_LATIN1,FEATURE_UTF7,FEATURE_UTF32,MONO_HYBRID_ENCODING_SUPPORT,FEATURE_ASYNC_IO,NEW_EXPERIMENTAL_ASYNC_IO,FEATURE_UTF32,FEATURE_EXCEPTIONDISPATCHINFO,FEATURE_CORRUPTING_EXCEPTIONS,FEATURE_EXCEPTION_NOTIFICATIONS,FEATURE_STRONGNAME_MIGRATION,FEATURE_USE_LCID,FEATURE_FUSION,FEATURE_CRYPTO,FEATURE_X509_SECURESTRINGS,FEATURE_SYNCHRONIZATIONCONTEXT,FEATURE_SYNCHRONIZATIONCONTEXT_WAIT -d:FEATURE_REMOTING,MONO_COM,FEATURE_COMINTEROP,FEATURE_ROLE_BASED_SECURITY -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -lib:./../../class/lib/net_4_x -debug -optimize -r:./../../class/lib/net_4_x/mscorlib.dll -d:MONO_FEATURE_THREAD_ABORT -d:MONO_FEATURE_THREAD_SUSPEND_RESUME -d:MONO_FEATURE_MULTIPLE_APPDOMAINS -debug -nowarn:168,219,618,672 -unsafe -r:Mono.Posix.dll -r:System.Core.dll -r:System.dll -define:MONO_DATACONVERTER_STATIC_METHODS -resource:Test/resources/Resources.resources</flags>
<output>net_4_x_corlib_test.dll</output>
<built_sources></built_sources>
<library_output>net_4_x_corlib_test.dll</library_output>
</project>
<project dir="class/System.Web.Extensions" library="System.Web.Extensions-tests-net_4_x">
<boot>false</boot>
- <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -lib:./../../class/lib/net_4_x -r:mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -unsafe -define:NET_3_5 -define:SYSTEM_WEB_EXTENSIONS -r:mscorlib.dll -r:System.Web.ApplicationServices.dll /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.js -r:System -r:System.Core -r:System.Drawing -r:System.Data -r:System.Data.Linq -r:System.Xml -r:System.Web -r:System.Web.Services -r:System.Configuration -r:System.EnterpriseServices -r:System.ServiceModel -doc:net_4_x_System.Web.Extensions_test.xml -nowarn:219,169,1591 /resource:Test/resources/Web.mono.config /resource:Test/resources/profile.config.4.x /resource:Test/resources/ListViewSort.aspx /resource:Test/resources/ListViewTest.aspx /resource:Test/resources/ListViewTotalRowCount_Bug535701_1.aspx /resource:Test/resources/ListViewTotalRowCount_Bug535701_2.aspx /resource:Test/resources/ListViewTotalRowCount_Bug604053.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx.cs /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/My.ashx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithDerivedMaster.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMaster.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMasterInvalidPlaceHolder.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/My.master /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyDerived.master -r:SystemWebTestShim.dll -define:SYSTEM_WEB_EXTENSIONS</flags>
+ <flags>/codepage:65001 -d:NET_4_0 -d:NET_4_5 -d:NET_4_6 -d:MONO -d:DISABLE_CAS_USE -nowarn:1699 -nostdlib -lib:./../../class/lib/net_4_x -r:mscorlib.dll -debug -optimize -r:./../../class/lib/net_4_x/System.Web.Extensions.dll -unsafe -define:NET_3_5 -define:SYSTEM_WEB_EXTENSIONS -r:mscorlib.dll -r:System.Web.ApplicationServices.dll /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjax.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxTimer.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.debug.js /resource:../MicrosoftAjaxLibrary/System.Web.Extensions/3.5.0.0/3.5.21022.8/MicrosoftAjaxWebForms.js -r:System -r:System.Core -r:System.Drawing -r:System.Data -r:System.Data.Linq -r:System.Xml -r:System.Web -r:System.Web.Services -r:System.Configuration -r:System.EnterpriseServices -r:System.ServiceModel -doc:net_4_x_System.Web.Extensions_test.xml -nowarn:219,169,1591 /resource:Test/resources/Web.mono.config /resource:Test/resources/profile.config.4.x /resource:Test/resources/ListViewSort.aspx /resource:Test/resources/ListViewTest.aspx /resource:Test/resources/ListViewTotalRowCount_Bug535701_1.aspx /resource:Test/resources/ListViewTotalRowCount_Bug535701_2.aspx /resource:Test/resources/ListViewTotalRowCount_Bug604053.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx.cs /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/Global.asax /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/My.ashx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPage.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithDerivedMaster.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMaster.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyPageWithMasterInvalidPlaceHolder.aspx /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/MyDerived.master /resource:../System.Web/Test/mainsoft/NunitWeb/NunitWeb/Resources/My.master -r:SystemWebTestShim.dll -define:SYSTEM_WEB_EXTENSIONS</flags>
<output>net_4_x_System.Web.Extensions_test.dll</output>
<built_sources></built_sources>
<library_output>net_4_x_System.Web.Extensions_test.dll</library_output>