You've already forked linux-packaging-mono
Imported Upstream version 5.8.0.22
Former-commit-id: df344e34b07851d296efb3e6604c8db42b6f7aa3
This commit is contained in:
parent
5f4a27cc8a
commit
7d05485754
@@ -3,8 +3,8 @@
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
<PropertyGroup>
|
||||
<ProjectGuid>{FD6AA2B9-56DB-4BCC-85E0-7727506562B0}</ProjectGuid>
|
||||
<!-- UAP10.1 is not yet mapped to netstandard2.0, manually duplicate this ref -->
|
||||
<PackageTargetFramework Condition="'$(TargetGroup)' == 'netstandard'">netstandard2.0;uap10.1</PackageTargetFramework>
|
||||
<!-- UAPvNext is not yet mapped to netstandard2.0, manually duplicate this ref -->
|
||||
<PackageTargetFramework Condition="'$(TargetGroup)' == 'netstandard'">netstandard2.0;$(UAPvNextTFM)</PackageTargetFramework>
|
||||
<IsPartialFacadeAssembly Condition="'$(TargetGroup)' == 'netfx'">true</IsPartialFacadeAssembly>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netfx-Debug|AnyCPU'" />
|
||||
@@ -12,7 +12,7 @@
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Debug|AnyCPU'" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'netstandard-Release|AnyCPU'" />
|
||||
<ItemGroup>
|
||||
<SuppressPackageTargetFrameworkCompatibility Include="uap10.1" />
|
||||
<SuppressPackageTargetFrameworkCompatibility Include="$(UAPvNextTFM)" />
|
||||
<Compile Include="System.Configuration.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="'$(IsPartialFacadeAssembly)' == 'true'">
|
||||
@@ -20,6 +20,7 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
|
||||
@@ -1 +1 @@
|
||||
2b328ec1492492f6fc4170d4560abc3a5031fee6
|
||||
e7ec34477d033511dee8f3189b17d4727d180f0e
|
||||
@@ -243,6 +243,7 @@
|
||||
<Compile Include="System\Configuration\WhiteSpaceTrimStringConverter.cs" />
|
||||
<Compile Include="System\Configuration\XmlUtil.cs" />
|
||||
<Compile Include="System\Configuration\XmlUtilWriter.cs" />
|
||||
<Compile Include="System\Drawing\Configuration\SystemDrawingSection.cs" />
|
||||
<Compile Include="$(CommonPath)\System\Security\IdentityHelper.cs">
|
||||
<Link>Common\System\Security\IdentityHelper.cs</Link>
|
||||
</Compile>
|
||||
@@ -266,6 +267,7 @@
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
|
||||
|
||||
@@ -10,7 +10,7 @@ using System.Reflection;
|
||||
namespace System.Configuration
|
||||
{
|
||||
/// <summary>
|
||||
/// Base settings class for client applications.
|
||||
/// Base settings class for client applications.
|
||||
/// </summary>
|
||||
public abstract class ApplicationSettingsBase : SettingsBase, INotifyPropertyChanged
|
||||
{
|
||||
@@ -67,17 +67,17 @@ namespace System.Configuration
|
||||
|
||||
if (owner.Site != null)
|
||||
{
|
||||
ISettingsProviderService provSvc = owner.Site.GetService(typeof(ISettingsProviderService)) as ISettingsProviderService;
|
||||
if (provSvc != null)
|
||||
ISettingsProviderService providerService = owner.Site.GetService(typeof(ISettingsProviderService)) as ISettingsProviderService;
|
||||
if (providerService != null)
|
||||
{
|
||||
// The component's site has a settings provider service. We pass each SettingsProperty to it
|
||||
// to see if it wants to override the current provider.
|
||||
foreach (SettingsProperty sp in Properties)
|
||||
foreach (SettingsProperty property in Properties)
|
||||
{
|
||||
SettingsProvider prov = provSvc.GetSettingsProvider(sp);
|
||||
if (prov != null)
|
||||
SettingsProvider provider = providerService.GetSettingsProvider(property);
|
||||
if (provider != null)
|
||||
{
|
||||
sp.Provider = prov;
|
||||
property.Provider = provider;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -311,10 +311,7 @@ namespace System.Configuration
|
||||
/// </summary>
|
||||
protected virtual void OnPropertyChanged(object sender, PropertyChangedEventArgs e)
|
||||
{
|
||||
if (_onPropertyChanged != null)
|
||||
{
|
||||
_onPropertyChanged(this, e);
|
||||
}
|
||||
_onPropertyChanged?.Invoke(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -322,10 +319,7 @@ namespace System.Configuration
|
||||
/// </summary>
|
||||
protected virtual void OnSettingChanging(object sender, SettingChangingEventArgs e)
|
||||
{
|
||||
if (_onSettingChanging != null)
|
||||
{
|
||||
_onSettingChanging(this, e);
|
||||
}
|
||||
_onSettingChanging?.Invoke(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -333,10 +327,7 @@ namespace System.Configuration
|
||||
/// </summary>
|
||||
protected virtual void OnSettingsLoaded(object sender, SettingsLoadedEventArgs e)
|
||||
{
|
||||
if (_onSettingsLoaded != null)
|
||||
{
|
||||
_onSettingsLoaded(this, e);
|
||||
}
|
||||
_onSettingsLoaded?.Invoke(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -344,10 +335,7 @@ namespace System.Configuration
|
||||
/// </summary>
|
||||
protected virtual void OnSettingsSaving(object sender, CancelEventArgs e)
|
||||
{
|
||||
if (_onSettingsSaving != null)
|
||||
{
|
||||
_onSettingsSaving(this, e);
|
||||
}
|
||||
_onSettingsSaving?.Invoke(this, e);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -430,7 +418,8 @@ namespace System.Configuration
|
||||
if (!e.Cancel)
|
||||
{
|
||||
base[propertyName] = value;
|
||||
//CONSIDER: Should we call this even if canceled? I guess not.
|
||||
|
||||
// CONSIDER: Should we call this even if canceled?
|
||||
PropertyChangedEventArgs pe = new PropertyChangedEventArgs(propertyName);
|
||||
OnPropertyChanged(this, pe);
|
||||
}
|
||||
@@ -461,106 +450,114 @@ namespace System.Configuration
|
||||
/// <summary>
|
||||
/// Creates a SettingsProperty object using the metadata on the given property
|
||||
/// and returns it.
|
||||
///
|
||||
/// Implementation note: Initialization method - be careful not to access properties here
|
||||
/// to prevent stack overflow.
|
||||
/// </summary>
|
||||
private SettingsProperty CreateSetting(PropertyInfo propInfo)
|
||||
private SettingsProperty CreateSetting(PropertyInfo propertyInfo)
|
||||
{
|
||||
object[] attributes = propInfo.GetCustomAttributes(false);
|
||||
SettingsProperty sp = new SettingsProperty(Initializer);
|
||||
// Initialization method -
|
||||
// be careful not to access properties here to prevent stack overflow.
|
||||
|
||||
object[] attributes = propertyInfo.GetCustomAttributes(false);
|
||||
SettingsProperty settingsProperty = new SettingsProperty(Initializer);
|
||||
bool explicitSerialize = _explicitSerializeOnClass;
|
||||
|
||||
sp.Name = propInfo.Name;
|
||||
sp.PropertyType = propInfo.PropertyType;
|
||||
settingsProperty.Name = propertyInfo.Name;
|
||||
settingsProperty.PropertyType = propertyInfo.PropertyType;
|
||||
|
||||
for (int i = 0; i < attributes.Length; i++)
|
||||
{
|
||||
Attribute attr = attributes[i] as Attribute;
|
||||
if (attr != null)
|
||||
Attribute attribute = attributes[i] as Attribute;
|
||||
if (attribute == null)
|
||||
continue;
|
||||
|
||||
if (attribute is DefaultSettingValueAttribute)
|
||||
{
|
||||
if (attr is DefaultSettingValueAttribute)
|
||||
settingsProperty.DefaultValue = ((DefaultSettingValueAttribute)attribute).Value;
|
||||
}
|
||||
else if (attribute is ReadOnlyAttribute)
|
||||
{
|
||||
settingsProperty.IsReadOnly = true;
|
||||
}
|
||||
else if (attribute is SettingsProviderAttribute)
|
||||
{
|
||||
string providerTypeName = ((SettingsProviderAttribute)attribute).ProviderTypeName;
|
||||
Type providerType = Type.GetType(providerTypeName);
|
||||
if (providerType == null)
|
||||
{
|
||||
sp.DefaultValue = ((DefaultSettingValueAttribute)attr).Value;
|
||||
throw new ConfigurationErrorsException(string.Format(SR.ProviderTypeLoadFailed, providerTypeName));
|
||||
}
|
||||
else if (attr is ReadOnlyAttribute)
|
||||
{
|
||||
sp.IsReadOnly = true;
|
||||
}
|
||||
else if (attr is SettingsProviderAttribute)
|
||||
{
|
||||
string providerTypeName = ((SettingsProviderAttribute)attr).ProviderTypeName;
|
||||
Type providerType = Type.GetType(providerTypeName);
|
||||
if (providerType != null)
|
||||
{
|
||||
SettingsProvider spdr = TypeUtil.CreateInstance(providerType) as SettingsProvider;
|
||||
|
||||
if (spdr != null)
|
||||
{
|
||||
spdr.Initialize(null, null);
|
||||
spdr.ApplicationName = ConfigurationManagerInternalFactory.Instance.ExeProductName;
|
||||
SettingsProvider settingsProvider = TypeUtil.CreateInstance(providerType) as SettingsProvider;
|
||||
|
||||
// See if we already have a provider of the same name in our collection. If so,
|
||||
// re-use the existing instance, since we cannot have multiple providers of the same name.
|
||||
SettingsProvider existing = _providers[spdr.Name];
|
||||
if (existing != null)
|
||||
{
|
||||
spdr = existing;
|
||||
}
|
||||
|
||||
sp.Provider = spdr;
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ConfigurationErrorsException(string.Format(SR.ProviderInstantiationFailed, providerTypeName));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw new ConfigurationErrorsException(string.Format(SR.ProviderTypeLoadFailed, providerTypeName));
|
||||
}
|
||||
}
|
||||
else if (attr is SettingsSerializeAsAttribute)
|
||||
if (settingsProvider == null)
|
||||
{
|
||||
sp.SerializeAs = ((SettingsSerializeAsAttribute)attr).SerializeAs;
|
||||
explicitSerialize = true;
|
||||
throw new ConfigurationErrorsException(string.Format(SR.ProviderInstantiationFailed, providerTypeName));
|
||||
}
|
||||
else
|
||||
{
|
||||
// This isn't an attribute we care about, so simply pass it on
|
||||
// to the SettingsProvider.
|
||||
// NOTE: The key is the type. So if an attribute was found at class
|
||||
// level and also property level, the latter overrides the former
|
||||
// for a given setting. This is exactly the behavior we want.
|
||||
|
||||
sp.Attributes.Add(attr.GetType(), attr);
|
||||
settingsProvider.Initialize(null, null);
|
||||
settingsProvider.ApplicationName = ConfigurationManagerInternalFactory.Instance.ExeProductName;
|
||||
|
||||
// See if we already have a provider of the same name in our collection. If so,
|
||||
// re-use the existing instance, since we cannot have multiple providers of the same name.
|
||||
SettingsProvider existing = _providers[settingsProvider.Name];
|
||||
if (existing != null)
|
||||
{
|
||||
settingsProvider = existing;
|
||||
}
|
||||
|
||||
settingsProperty.Provider = settingsProvider;
|
||||
}
|
||||
else if (attribute is SettingsSerializeAsAttribute)
|
||||
{
|
||||
settingsProperty.SerializeAs = ((SettingsSerializeAsAttribute)attribute).SerializeAs;
|
||||
explicitSerialize = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// This isn't an attribute we care about, so simply pass it on
|
||||
// to the SettingsProvider.
|
||||
//
|
||||
// NOTE: The key is the type. So if an attribute was found at class
|
||||
// level and also property level, the latter overrides the former
|
||||
// for a given setting. This is exactly the behavior we want.
|
||||
|
||||
settingsProperty.Attributes.Add(attribute.GetType(), attribute);
|
||||
}
|
||||
}
|
||||
|
||||
if (!explicitSerialize)
|
||||
{
|
||||
sp.SerializeAs = GetSerializeAs(propInfo.PropertyType);
|
||||
// Serialization method was not explicitly attributed.
|
||||
|
||||
TypeConverter tc = TypeDescriptor.GetConverter(propertyInfo.PropertyType);
|
||||
if (tc.CanConvertTo(typeof(string)) && tc.CanConvertFrom(typeof(string)))
|
||||
{
|
||||
// We can use string
|
||||
settingsProperty.SerializeAs = SettingsSerializeAs.String;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Fallback is Xml
|
||||
settingsProperty.SerializeAs = SettingsSerializeAs.Xml;
|
||||
}
|
||||
}
|
||||
|
||||
return sp;
|
||||
|
||||
return settingsProperty;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures this class is initialized. Initialization involves reflecting over properties and building
|
||||
/// a list of SettingsProperty's.
|
||||
///
|
||||
/// Implementation note: Initialization method - be careful not to access properties here
|
||||
/// to prevent stack overflow.
|
||||
/// </summary>
|
||||
private void EnsureInitialized()
|
||||
{
|
||||
// Initialization method -
|
||||
// be careful not to access properties here to prevent stack overflow.
|
||||
|
||||
if (!_initialized)
|
||||
{
|
||||
_initialized = true;
|
||||
|
||||
Type type = this.GetType();
|
||||
Type type = GetType();
|
||||
|
||||
if (_context == null)
|
||||
{
|
||||
@@ -603,12 +600,12 @@ namespace System.Configuration
|
||||
/// Returns a SettingsProperty used to initialize settings. We initialize a setting with values
|
||||
/// derived from class level attributes, if present. Otherwise, we initialize to
|
||||
/// reasonable defaults.
|
||||
///
|
||||
/// Implementation note: Initialization method - be careful not to access properties here
|
||||
/// to prevent stack overflow.
|
||||
/// </summary>
|
||||
private SettingsProperty Initializer
|
||||
{
|
||||
// Initialization method -
|
||||
// be careful not to access properties here to prevent stack overflow.
|
||||
|
||||
get
|
||||
{
|
||||
if (_init == null)
|
||||
@@ -748,26 +745,6 @@ namespace System.Configuration
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// When no explicit SerializeAs attribute is provided, this routine helps to decide how to
|
||||
/// serialize.
|
||||
/// </summary>
|
||||
private SettingsSerializeAs GetSerializeAs(Type type)
|
||||
{
|
||||
//First check whether this type has a TypeConverter that can convert to/from string
|
||||
//If so, that's our first choice
|
||||
TypeConverter tc = TypeDescriptor.GetConverter(type);
|
||||
bool toString = tc.CanConvertTo(typeof(string));
|
||||
bool fromString = tc.CanConvertFrom(typeof(string));
|
||||
if (toString && fromString)
|
||||
{
|
||||
return SettingsSerializeAs.String;
|
||||
}
|
||||
|
||||
//Else fallback to Xml Serialization
|
||||
return SettingsSerializeAs.Xml;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns true if this is a clickonce deployed app and this is the first run of the app
|
||||
/// since deployment or last upgrade.
|
||||
|
||||
@@ -5,12 +5,8 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Runtime.Versioning;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
using System.Xml;
|
||||
|
||||
namespace System.Configuration
|
||||
@@ -273,33 +269,6 @@ namespace System.Configuration
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Encapsulates the Version constructor so that we can return null when an exception is thrown.
|
||||
/// </summary>
|
||||
private Version CreateVersion(string name)
|
||||
{
|
||||
Version ver = null;
|
||||
|
||||
try
|
||||
{
|
||||
ver = new Version(name);
|
||||
}
|
||||
catch (ArgumentException)
|
||||
{
|
||||
ver = null;
|
||||
}
|
||||
catch (OverflowException)
|
||||
{
|
||||
ver = null;
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
ver = null;
|
||||
}
|
||||
|
||||
return ver;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Implementation of IClientSettingsProvider.GetPreviousVersion.
|
||||
/// </summary>
|
||||
@@ -339,43 +308,46 @@ namespace System.Configuration
|
||||
|
||||
if (string.IsNullOrEmpty(prevConfigFile))
|
||||
{
|
||||
string userConfigPath = isRoaming ? ConfigurationManagerInternalFactory.Instance.ExeRoamingConfigDirectory : ConfigurationManagerInternalFactory.Instance.ExeLocalConfigDirectory;
|
||||
Version curVer = CreateVersion(ConfigurationManagerInternalFactory.Instance.ExeProductVersion);
|
||||
Version prevVer = null;
|
||||
DirectoryInfo prevDir = null;
|
||||
string file = null;
|
||||
string userConfigPath = isRoaming
|
||||
? ConfigurationManagerInternalFactory.Instance.ExeRoamingConfigDirectory
|
||||
: ConfigurationManagerInternalFactory.Instance.ExeLocalConfigDirectory;
|
||||
|
||||
if (curVer == null)
|
||||
Version currentVersion;
|
||||
if (!Version.TryParse(ConfigurationManagerInternalFactory.Instance.ExeProductVersion, out currentVersion))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
DirectoryInfo parentDir = Directory.GetParent(userConfigPath);
|
||||
Version previousVersion = null;
|
||||
DirectoryInfo previousDirectory = null;
|
||||
string file = null;
|
||||
|
||||
if (parentDir.Exists)
|
||||
DirectoryInfo parentDirectory = Directory.GetParent(userConfigPath);
|
||||
|
||||
if (parentDirectory.Exists)
|
||||
{
|
||||
foreach (DirectoryInfo dir in parentDir.GetDirectories())
|
||||
foreach (DirectoryInfo directory in parentDirectory.GetDirectories())
|
||||
{
|
||||
Version tempVer = CreateVersion(dir.Name);
|
||||
Version tempVersion;
|
||||
|
||||
if (tempVer != null && tempVer < curVer)
|
||||
if (Version.TryParse(directory.Name, out tempVersion) && tempVersion < currentVersion)
|
||||
{
|
||||
if (prevVer == null)
|
||||
if (previousVersion == null)
|
||||
{
|
||||
prevVer = tempVer;
|
||||
prevDir = dir;
|
||||
previousVersion = tempVersion;
|
||||
previousDirectory = directory;
|
||||
}
|
||||
else if (tempVer > prevVer)
|
||||
else if (tempVersion > previousVersion)
|
||||
{
|
||||
prevVer = tempVer;
|
||||
prevDir = dir;
|
||||
previousVersion = tempVersion;
|
||||
previousDirectory = directory;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (prevDir != null)
|
||||
if (previousDirectory != null)
|
||||
{
|
||||
file = Path.Combine(prevDir.FullName, ConfigurationManagerInternalFactory.Instance.UserConfigFilename);
|
||||
file = Path.Combine(previousDirectory.FullName, ConfigurationManagerInternalFactory.Instance.UserConfigFilename);
|
||||
}
|
||||
|
||||
if (File.Exists(file))
|
||||
@@ -384,7 +356,7 @@ namespace System.Configuration
|
||||
}
|
||||
}
|
||||
|
||||
//Cache for future use.
|
||||
// Cache for future use.
|
||||
if (isRoaming)
|
||||
{
|
||||
_prevRoamingConfigFileName = prevConfigFile;
|
||||
@@ -496,10 +468,11 @@ namespace System.Configuration
|
||||
// SettingsPropertyValue returns a byte[] in the binary serialization case. We need to
|
||||
// encode this - we use base64 since SettingsPropertyValue understands it and we won't have
|
||||
// to special case while deserializing.
|
||||
byte[] buf = value.SerializedValue as byte[];
|
||||
if (buf != null)
|
||||
|
||||
byte[] buffer = value.SerializedValue as byte[];
|
||||
if (buffer != null)
|
||||
{
|
||||
serializedValue = Convert.ToBase64String(buf);
|
||||
serializedValue = Convert.ToBase64String(buffer);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -516,7 +489,7 @@ namespace System.Configuration
|
||||
|
||||
valueXml.InnerXml = serializedValue;
|
||||
|
||||
// Hack to remove the XmlDeclaration that the XmlSerializer adds.
|
||||
// Hack to remove the XmlDeclaration that the XmlSerializer adds.
|
||||
XmlNode unwanted = null;
|
||||
foreach (XmlNode child in valueXml.ChildNodes)
|
||||
{
|
||||
@@ -560,13 +533,13 @@ namespace System.Configuration
|
||||
|
||||
private class XmlEscaper
|
||||
{
|
||||
private XmlDocument doc;
|
||||
private XmlElement temp;
|
||||
private XmlDocument document;
|
||||
private XmlElement tempElement;
|
||||
|
||||
internal XmlEscaper()
|
||||
{
|
||||
doc = new XmlDocument();
|
||||
temp = doc.CreateElement("temp");
|
||||
document = new XmlDocument();
|
||||
tempElement = document.CreateElement("temp");
|
||||
}
|
||||
|
||||
internal string Escape(string xmlString)
|
||||
@@ -576,8 +549,8 @@ namespace System.Configuration
|
||||
return xmlString;
|
||||
}
|
||||
|
||||
temp.InnerText = xmlString;
|
||||
return temp.InnerXml;
|
||||
tempElement.InnerText = xmlString;
|
||||
return tempElement.InnerXml;
|
||||
}
|
||||
|
||||
internal string Unescape(string escapedString)
|
||||
@@ -587,8 +560,8 @@ namespace System.Configuration
|
||||
return escapedString;
|
||||
}
|
||||
|
||||
temp.InnerXml = escapedString;
|
||||
return temp.InnerText;
|
||||
tempElement.InnerXml = escapedString;
|
||||
return tempElement.InnerText;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
@@ -83,27 +84,22 @@ namespace System.Configuration
|
||||
|
||||
private object Deserialize()
|
||||
{
|
||||
object val = null;
|
||||
object value = null;
|
||||
|
||||
// Step 1: Try creating from Serailized value
|
||||
// Attempt 1: Try creating from SerializedValue
|
||||
if (SerializedValue != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (SerializedValue is string)
|
||||
{
|
||||
val = GetObjectFromString(Property.PropertyType, Property.SerializeAs, (string)SerializedValue);
|
||||
value = GetObjectFromString(Property.PropertyType, Property.SerializeAs, (string)SerializedValue);
|
||||
}
|
||||
else
|
||||
{
|
||||
MemoryStream ms = new System.IO.MemoryStream((byte[])SerializedValue);
|
||||
try
|
||||
using (MemoryStream ms = new MemoryStream((byte[])SerializedValue))
|
||||
{
|
||||
val = (new BinaryFormatter()).Deserialize(ms);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ms.Close();
|
||||
value = (new BinaryFormatter()).Deserialize(ms);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -128,12 +124,12 @@ namespace System.Configuration
|
||||
}
|
||||
}
|
||||
|
||||
if (val != null && !Property.PropertyType.IsAssignableFrom(val.GetType())) // is it the correct type
|
||||
val = null;
|
||||
if (value != null && !Property.PropertyType.IsAssignableFrom(value.GetType())) // is it the correct type
|
||||
value = null;
|
||||
}
|
||||
|
||||
// Step 2: Try creating from default value
|
||||
if (val == null)
|
||||
// Attempt 2: Try creating from default value
|
||||
if (value == null)
|
||||
{
|
||||
UsingDefaultValue = true;
|
||||
if (Property.DefaultValue == null || Property.DefaultValue.ToString() == "[null]")
|
||||
@@ -145,77 +141,71 @@ namespace System.Configuration
|
||||
}
|
||||
if (!(Property.DefaultValue is string))
|
||||
{
|
||||
val = Property.DefaultValue;
|
||||
value = Property.DefaultValue;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
val = GetObjectFromString(Property.PropertyType, Property.SerializeAs, (string)Property.DefaultValue);
|
||||
value = GetObjectFromString(Property.PropertyType, Property.SerializeAs, (string)Property.DefaultValue);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new ArgumentException(string.Format(SR.Could_not_create_from_default_value, Property.Name, e.Message));
|
||||
}
|
||||
}
|
||||
if (val != null && !Property.PropertyType.IsAssignableFrom(val.GetType())) // is it the correct type
|
||||
|
||||
if (value != null && !Property.PropertyType.IsAssignableFrom(value.GetType())) // is it the correct type
|
||||
throw new ArgumentException(string.Format(SR.Could_not_create_from_default_value_2, Property.Name));
|
||||
}
|
||||
|
||||
// Step 3: Create a new one by calling the parameterless constructor
|
||||
if (val == null)
|
||||
// Attempt 3: Create via the parameterless constructor
|
||||
if (value == null)
|
||||
{
|
||||
if (Property.PropertyType == typeof(string))
|
||||
{
|
||||
val = "";
|
||||
value = string.Empty;
|
||||
}
|
||||
else
|
||||
{
|
||||
try
|
||||
{
|
||||
val = TypeUtil.CreateInstance(Property.PropertyType);
|
||||
value = TypeUtil.CreateInstance(Property.PropertyType);
|
||||
}
|
||||
catch { }
|
||||
}
|
||||
}
|
||||
|
||||
return val;
|
||||
return value;
|
||||
}
|
||||
|
||||
private static object GetObjectFromString(Type type, SettingsSerializeAs serializeAs, string attValue)
|
||||
private static object GetObjectFromString(Type type, SettingsSerializeAs serializeAs, string serializedValue)
|
||||
{
|
||||
// Deal with string types
|
||||
if (type == typeof(string) && (attValue == null || attValue.Length < 1 || serializeAs == SettingsSerializeAs.String))
|
||||
return attValue;
|
||||
if (type == typeof(string) && (serializedValue == null || serializedValue.Length < 1 || serializeAs == SettingsSerializeAs.String))
|
||||
return serializedValue;
|
||||
|
||||
// Return null if there is nothing to convert
|
||||
if (attValue == null || attValue.Length < 1)
|
||||
if (serializedValue == null || serializedValue.Length < 1)
|
||||
return null;
|
||||
|
||||
// Convert based on the serialized type
|
||||
switch (serializeAs)
|
||||
{
|
||||
case SettingsSerializeAs.Binary:
|
||||
byte[] buf = Convert.FromBase64String(attValue);
|
||||
MemoryStream ms = null;
|
||||
try
|
||||
byte[] buffer = Convert.FromBase64String(serializedValue);
|
||||
using (MemoryStream ms = new MemoryStream(buffer))
|
||||
{
|
||||
ms = new MemoryStream(buf);
|
||||
return (new BinaryFormatter()).Deserialize(ms);
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (ms != null)
|
||||
ms.Close();
|
||||
}
|
||||
case SettingsSerializeAs.Xml:
|
||||
StringReader sr = new StringReader(attValue);
|
||||
StringReader sr = new StringReader(serializedValue);
|
||||
XmlSerializer xs = new XmlSerializer(type);
|
||||
return xs.Deserialize(sr);
|
||||
case SettingsSerializeAs.String:
|
||||
TypeConverter converter = TypeDescriptor.GetConverter(type);
|
||||
if (converter != null && converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string)))
|
||||
return converter.ConvertFromInvariantString(attValue);
|
||||
return converter.ConvertFromInvariantString(serializedValue);
|
||||
throw new ArgumentException(string.Format(SR.Unable_to_convert_type_from_string, type.ToString()), nameof(type));
|
||||
default:
|
||||
return null;
|
||||
@@ -230,21 +220,15 @@ namespace System.Configuration
|
||||
if (Property.SerializeAs != SettingsSerializeAs.Binary)
|
||||
return ConvertObjectToString(_value, Property.PropertyType, Property.SerializeAs, Property.ThrowOnErrorSerializing);
|
||||
|
||||
MemoryStream ms = new System.IO.MemoryStream();
|
||||
try
|
||||
using (MemoryStream ms = new MemoryStream())
|
||||
{
|
||||
BinaryFormatter bf = new BinaryFormatter();
|
||||
bf.Serialize(ms, _value);
|
||||
return ms.ToArray();
|
||||
}
|
||||
finally
|
||||
{
|
||||
ms.Close();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static string ConvertObjectToString(object propValue, Type type, SettingsSerializeAs serializeAs, bool throwOnError)
|
||||
private static string ConvertObjectToString(object propertyValue, Type type, SettingsSerializeAs serializeAs, bool throwOnError)
|
||||
{
|
||||
if (serializeAs == SettingsSerializeAs.ProviderSpecific)
|
||||
{
|
||||
@@ -261,27 +245,17 @@ namespace System.Configuration
|
||||
case SettingsSerializeAs.String:
|
||||
TypeConverter converter = TypeDescriptor.GetConverter(type);
|
||||
if (converter != null && converter.CanConvertTo(typeof(string)) && converter.CanConvertFrom(typeof(string)))
|
||||
return converter.ConvertToInvariantString(propValue);
|
||||
return converter.ConvertToInvariantString(propertyValue);
|
||||
throw new ArgumentException(string.Format(SR.Unable_to_convert_type_to_string, type.ToString()), nameof(type));
|
||||
case SettingsSerializeAs.Binary:
|
||||
MemoryStream ms = new System.IO.MemoryStream();
|
||||
try
|
||||
{
|
||||
BinaryFormatter bf = new BinaryFormatter();
|
||||
bf.Serialize(ms, propValue);
|
||||
byte[] buffer = ms.ToArray();
|
||||
return Convert.ToBase64String(buffer);
|
||||
}
|
||||
finally
|
||||
{
|
||||
ms.Close();
|
||||
}
|
||||
case SettingsSerializeAs.Xml:
|
||||
XmlSerializer xs = new XmlSerializer(type);
|
||||
StringWriter sw = new StringWriter(CultureInfo.InvariantCulture);
|
||||
|
||||
xs.Serialize(sw, propValue);
|
||||
xs.Serialize(sw, propertyValue);
|
||||
return sw.ToString();
|
||||
case SettingsSerializeAs.Binary:
|
||||
Debug.Fail("Should not have gotten here with Binary formatting");
|
||||
break;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
using System.Configuration;
|
||||
|
||||
namespace System.Drawing.Configuration
|
||||
{
|
||||
public sealed class SystemDrawingSection : ConfigurationSection
|
||||
{
|
||||
private const string BitmapSuffixSectionName = "bitmapSuffix";
|
||||
|
||||
static SystemDrawingSection() => s_properties.Add(s_bitmapSuffix);
|
||||
|
||||
[ConfigurationProperty(BitmapSuffixSectionName)]
|
||||
public string BitmapSuffix
|
||||
{
|
||||
get => (string)this[s_bitmapSuffix];
|
||||
set => this[s_bitmapSuffix] = value;
|
||||
}
|
||||
|
||||
protected internal override ConfigurationPropertyCollection Properties => s_properties;
|
||||
|
||||
private static readonly ConfigurationPropertyCollection s_properties = new ConfigurationPropertyCollection();
|
||||
|
||||
private static readonly ConfigurationProperty s_bitmapSuffix =
|
||||
new ConfigurationProperty(BitmapSuffixSectionName, typeof(string), null, ConfigurationPropertyOptions.None);
|
||||
}
|
||||
}
|
||||
@@ -113,7 +113,7 @@ namespace MonoTests.System.Configuration
|
||||
{
|
||||
CommaDelimitedStringCollectionConverter cv = new CommaDelimitedStringCollectionConverter();
|
||||
|
||||
Assert.Throws<ArgumentException>(() => cv.ConvertTo(null, null, 59, typeof(string)));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => cv.ConvertTo(null, null, 59, typeof(string)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -200,7 +200,7 @@ namespace MonoTests.System.Configuration
|
||||
ExeConfigurationFileMap map = new ExeConfigurationFileMap();
|
||||
map.RoamingUserConfigFilename = "roaminguser";
|
||||
|
||||
Assert.Throws<ArgumentException>(() => ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.PerUserRoaming));
|
||||
AssertExtensions.Throws<ArgumentException>("fileMap.ExeConfigFilename", () => ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.PerUserRoaming));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -225,7 +225,7 @@ namespace MonoTests.System.Configuration
|
||||
map.RoamingUserConfigFilename = "roaminguser";
|
||||
map.LocalUserConfigFilename = "localuser";
|
||||
|
||||
Assert.Throws<ArgumentException>(() => ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.PerUserRoamingAndLocal));
|
||||
AssertExtensions.Throws<ArgumentException>("fileMap.ExeConfigFilename", () => ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.PerUserRoamingAndLocal));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -237,7 +237,7 @@ namespace MonoTests.System.Configuration
|
||||
map.ExeConfigFilename = "execonfig";
|
||||
map.LocalUserConfigFilename = "localuser";
|
||||
|
||||
Assert.Throws<ArgumentException>(() => ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.PerUserRoamingAndLocal));
|
||||
AssertExtensions.Throws<ArgumentException>("fileMap.RoamingUserConfigFilename", () => ConfigurationManager.OpenMappedExeConfiguration(map, ConfigurationUserLevel.PerUserRoamingAndLocal));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -46,6 +46,7 @@ namespace MonoTests.System.Configuration
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[ActiveIssue(21000, TargetFrameworkMonikers.UapAot)]
|
||||
public void EditAfterAdd()
|
||||
{
|
||||
Config cfg = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace MonoTests.System.Configuration
|
||||
var map = new ExeConfigurationFileMap();
|
||||
map.ExeConfigFilename = filename;
|
||||
|
||||
Assert.Throws<ArgumentException>(() =>
|
||||
AssertExtensions.Throws<ArgumentException>("fileMap.RoamingUserConfigFilename", () =>
|
||||
ConfigurationManager.OpenMappedExeConfiguration(
|
||||
map, ConfigurationUserLevel.PerUserRoaming));
|
||||
});
|
||||
@@ -87,7 +87,7 @@ namespace MonoTests.System.Configuration
|
||||
var map = new ExeConfigurationFileMap();
|
||||
map.LocalUserConfigFilename = filename;
|
||||
|
||||
Assert.Throws<ArgumentException>(() =>
|
||||
AssertExtensions.Throws<ArgumentException>("fileMap.RoamingUserConfigFilename", () =>
|
||||
ConfigurationManager.OpenMappedExeConfiguration(
|
||||
map, ConfigurationUserLevel.PerUserRoamingAndLocal));
|
||||
});
|
||||
@@ -102,7 +102,7 @@ namespace MonoTests.System.Configuration
|
||||
map.ExeConfigFilename = filename;
|
||||
map.RoamingUserConfigFilename = filename;
|
||||
|
||||
Assert.Throws<ArgumentException>(() =>
|
||||
AssertExtensions.Throws<ArgumentException>("fileMap.LocalUserConfigFilename", () =>
|
||||
ConfigurationManager.OpenMappedExeConfiguration(
|
||||
map, ConfigurationUserLevel.PerUserRoamingAndLocal));
|
||||
});
|
||||
@@ -117,7 +117,7 @@ namespace MonoTests.System.Configuration
|
||||
map.RoamingUserConfigFilename = roaming;
|
||||
map.LocalUserConfigFilename = local;
|
||||
|
||||
Assert.Throws<ArgumentException>(() =>
|
||||
AssertExtensions.Throws<ArgumentException>("fileMap.ExeConfigFilename", () =>
|
||||
ConfigurationManager.OpenMappedExeConfiguration(
|
||||
map, ConfigurationUserLevel.PerUserRoamingAndLocal));
|
||||
});
|
||||
@@ -131,7 +131,7 @@ namespace MonoTests.System.Configuration
|
||||
var map = new ExeConfigurationFileMap();
|
||||
map.MachineConfigFilename = machine;
|
||||
|
||||
Assert.Throws<ArgumentException>(() =>
|
||||
AssertExtensions.Throws<ArgumentException>("fileMap.ExeConfigFilename", () =>
|
||||
ConfigurationManager.OpenMappedExeConfiguration(
|
||||
map, ConfigurationUserLevel.None));
|
||||
});
|
||||
|
||||
@@ -88,7 +88,7 @@ namespace MonoTests.System.Configuration
|
||||
public void ConvertFrom_Case()
|
||||
{
|
||||
GenericEnumConverter cv = new GenericEnumConverter(typeof(FooEnum));
|
||||
Assert.Throws<ArgumentException>(() => cv.ConvertFrom(null, null, "foo"));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => cv.ConvertFrom(null, null, "foo"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -97,7 +97,7 @@ namespace MonoTests.System.Configuration
|
||||
GenericEnumConverter cv = new GenericEnumConverter(typeof(FooEnum));
|
||||
object o = null;
|
||||
|
||||
Assert.Throws<ArgumentException>(() => o = cv.ConvertFrom(null, null, "baz"));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => o = cv.ConvertFrom(null, null, "baz"));
|
||||
Assert.Null(o);
|
||||
}
|
||||
|
||||
@@ -107,7 +107,7 @@ namespace MonoTests.System.Configuration
|
||||
GenericEnumConverter cv = new GenericEnumConverter(typeof(FooEnum));
|
||||
object o = null;
|
||||
|
||||
Assert.Throws<ArgumentException>(() => o = cv.ConvertFrom(null, null, null));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => o = cv.ConvertFrom(null, null, null));
|
||||
Assert.Null(o);
|
||||
}
|
||||
|
||||
|
||||
@@ -120,7 +120,7 @@ namespace MonoTests.System.Configuration
|
||||
{
|
||||
InfiniteIntConverter cv = new InfiniteIntConverter();
|
||||
|
||||
Assert.Throws<ArgumentException>(() => cv.ConvertTo(null, null, "hi", typeof(string)));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => cv.ConvertTo(null, null, "hi", typeof(string)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace MonoTests.System.Configuration
|
||||
{
|
||||
InfiniteTimeSpanConverter cv = new InfiniteTimeSpanConverter();
|
||||
|
||||
Assert.Throws<ArgumentException>(() => cv.ConvertTo(null, null, "hi", typeof(string)));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => cv.ConvertTo(null, null, "hi", typeof(string)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -118,7 +118,7 @@ namespace MonoTests.System.Configuration
|
||||
{
|
||||
InfiniteTimeSpanConverter cv = new InfiniteTimeSpanConverter();
|
||||
|
||||
Assert.Throws<ArgumentException>(() => cv.ConvertTo(null, null, 59, typeof(int)));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => cv.ConvertTo(null, null, 59, typeof(int)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -77,21 +77,21 @@ namespace MonoTests.System.Configuration
|
||||
public void Validate_Exclusive_fail1()
|
||||
{
|
||||
IntegerValidator v = new IntegerValidator(5000, 10000, true);
|
||||
Assert.Throws<ArgumentException>(() => v.Validate(5000));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate(5000));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_Exclusive_fail2()
|
||||
{
|
||||
IntegerValidator v = new IntegerValidator(5000, 10000, true);
|
||||
Assert.Throws<ArgumentException>(() => v.Validate(10000));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate(10000));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_Exclusive_fail3()
|
||||
{
|
||||
IntegerValidator v = new IntegerValidator(5000, 10000, true);
|
||||
Assert.Throws<ArgumentException>(() => v.Validate(7000));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate(7000));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -102,7 +102,7 @@ namespace MonoTests.System.Configuration
|
||||
false,
|
||||
3000);
|
||||
|
||||
Assert.Throws<ArgumentException>(() => v.Validate(40000));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate(40000));
|
||||
}
|
||||
|
||||
#region BNC654721 https://bugzilla.novell.com/show_bug.cgi?id=654721
|
||||
|
||||
@@ -72,21 +72,21 @@ namespace MonoTests.System.Configuration
|
||||
public void Validate_Exclusive_fail1()
|
||||
{
|
||||
LongValidator v = new LongValidator(5000L, 10000L, true);
|
||||
Assert.Throws<ArgumentException>(() => v.Validate(5000L));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate(5000L));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_Exclusive_fail2()
|
||||
{
|
||||
LongValidator v = new LongValidator(5000L, 10000L, true);
|
||||
Assert.Throws<ArgumentException>(() => v.Validate(10000L));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate(10000L));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_Exclusive_fail3()
|
||||
{
|
||||
LongValidator v = new LongValidator(5000L, 10000L, true);
|
||||
Assert.Throws<ArgumentException>(() => v.Validate(7000L));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate(7000L));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -97,7 +97,7 @@ namespace MonoTests.System.Configuration
|
||||
false,
|
||||
3000L);
|
||||
|
||||
Assert.Throws<ArgumentException>(() => v.Validate(40000L));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate(40000L));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -57,14 +57,14 @@ namespace MonoTests.System.Configuration
|
||||
public void Validate_fail1()
|
||||
{
|
||||
PositiveTimeSpanValidator v = new PositiveTimeSpanValidator();
|
||||
Assert.Throws<ArgumentException>(() => v.Validate(new TimeSpan(0)));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate(new TimeSpan(0)));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Validate_fail2()
|
||||
{
|
||||
PositiveTimeSpanValidator v = new PositiveTimeSpanValidator();
|
||||
Assert.Throws<ArgumentException>(() => v.Validate(new TimeSpan(-10000)));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate(new TimeSpan(-10000)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -61,13 +61,13 @@ namespace MonoTests.System.Configuration
|
||||
{
|
||||
RegexStringValidator v = new RegexStringValidator("[a-z]+");
|
||||
|
||||
Assert.Throws<ArgumentException>(() => v.Validate("1234"));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate("1234"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IllegalRegex()
|
||||
{
|
||||
Assert.Throws<ArgumentException>(() => new RegexStringValidator("[0-9+"));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => new RegexStringValidator("[0-9+"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,7 @@ namespace MonoTests.System.Configuration
|
||||
{
|
||||
StringValidator v = new StringValidator(1);
|
||||
|
||||
Assert.Throws<ArgumentException>(() => v.Validate(null));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate(null));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -77,7 +77,7 @@ namespace MonoTests.System.Configuration
|
||||
{
|
||||
StringValidator v = new StringValidator(5);
|
||||
|
||||
Assert.Throws<ArgumentException>(() => v.Validate("1234"));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate("1234"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -95,7 +95,7 @@ namespace MonoTests.System.Configuration
|
||||
{
|
||||
StringValidator v = new StringValidator(5, 7);
|
||||
|
||||
Assert.Throws<ArgumentException>(() => v.Validate("1234"));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate("1234"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -103,7 +103,7 @@ namespace MonoTests.System.Configuration
|
||||
{
|
||||
StringValidator v = new StringValidator(5, 7);
|
||||
|
||||
Assert.Throws<ArgumentException>(() => v.Validate("12345678"));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate("12345678"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -119,7 +119,7 @@ namespace MonoTests.System.Configuration
|
||||
{
|
||||
StringValidator v = new StringValidator(5, 7, "345");
|
||||
|
||||
Assert.Throws<ArgumentException>(() => v.Validate("123456"));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate("123456"));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -127,7 +127,7 @@ namespace MonoTests.System.Configuration
|
||||
{
|
||||
StringValidator v = new StringValidator(5, 7, "890");
|
||||
|
||||
Assert.Throws<ArgumentException>(() => v.Validate("12345678"));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate("12345678"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,7 +64,7 @@ namespace MonoTests.System.Configuration
|
||||
{
|
||||
SubclassTypeValidator v = new SubclassTypeValidator(typeof(B));
|
||||
|
||||
Assert.Throws<ArgumentException>(() => v.Validate(typeof(A)));
|
||||
AssertExtensions.Throws<ArgumentException>(null, () => v.Validate(typeof(A)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user