Imported Upstream version 5.18.0.142

Former-commit-id: 7467d4b717762eeaf652d77f1486dd11ffb1ff1f
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2018-10-09 08:20:59 +00:00
parent e52655b4dc
commit 0abdbe5a7d
1547 changed files with 93792 additions and 47893 deletions

View File

@@ -46,9 +46,13 @@ namespace System.Configuration
{
if (s_machineConfigFilePath == null)
{
#if !MONO
string directory = AppDomain.CurrentDomain.BaseDirectory;
s_machineConfigFilePath = Path.Combine(Path.Combine(directory, MachineConfigSubdirectory),
MachineConfigFilename);
#else
s_machineConfigFilePath = DefaultConfig.MachineConfigPath;
#endif
}
return s_machineConfigFilePath;

View File

@@ -51,17 +51,30 @@ namespace System.Configuration
public override Stream OpenStreamForRead(string streamName)
{
#if MONO
// if machine.config is embedded, use it instead of whatever is being requested
if ((s_embeddedMachineConfig != null) && (streamName == _machineStreamName))
{
return new MemoryStream(Encoding.UTF8.GetBytes(s_embeddedMachineConfig));
}
#endif
Stream stream = base.OpenStreamForRead(streamName);
if (stream == null && streamName == _machineStreamName)
{
#if MONO
throw new ConfigurationException ("Cannot find " + streamName);
#else
// We only want to inject if we aren't able to load
stream = new MemoryStream(Encoding.UTF8.GetBytes(s_implicitMachineConfig));
#endif
}
return stream;
}
#if !MONO
private static string s_implicitMachineConfig =
@"<configuration>
<configSections>
@@ -83,5 +96,10 @@ namespace System.Configuration
<add name = 'LocalSqlServer' connectionString='data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true' providerName='System.Data.SqlClient' />
</connectionStrings>
</configuration>";
#else
private static string s_embeddedMachineConfig = DefaultConfig.BundledMachineConfig;
#endif
}
}

View File

@@ -7,9 +7,15 @@ using System.Reflection;
namespace System.Configuration
{
internal static class TypeUtil
internal static partial class TypeUtil
{
#if MONO
// Ensures we can load types from the old place.
internal const string ConfigurationManagerAssemblyName = "System.Configuration";
#else
internal const string ConfigurationManagerAssemblyName = "System.Configuration.ConfigurationManager";
#endif
// Deliberately not being explicit about the versions to make
// things simpler for consumers of System.Configuration.