Imported Upstream version 4.6.0.125

Former-commit-id: a2155e9bd80020e49e72e86c44da02a8ac0e57a4
This commit is contained in:
Xamarin Public Jenkins (auto-signing)
2016-08-03 10:59:49 +00:00
parent a569aebcfd
commit e79aa3c0ed
17047 changed files with 3137615 additions and 392334 deletions

View File

@ -0,0 +1,57 @@
using System.Runtime.CompilerServices;
using System.Windows.Markup;
// Define XAML namespace mappings
[assembly: XmlnsDefinition("http://schemas.microsoft.com/netfx/2009/xaml/servicemodel", "System.ServiceModel")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/netfx/2009/xaml/servicemodel", "System.ServiceModel.Channels")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/netfx/2009/xaml/servicemodel", "System.ServiceModel.Description")]
[assembly: XmlnsDefinition("http://schemas.microsoft.com/netfx/2009/xaml/servicemodel", "System.ServiceModel.Security")]
// type forwards to System.ServiceModel.Activation.dll
[assembly: TypeForwardedTo(typeof(System.ServiceModel.ServiceHostingEnvironment))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Activation.ServiceHostFactory))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Activation.HostedTransportConfiguration))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Activation.ServiceBuildProvider))]
// type forwards to System.IdentityModel.dll
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Security.BinarySecretKeyIdentifierClause))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Security.Tokens.BinarySecretSecurityToken))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Security.Tokens.BufferedGenericXmlSecurityToken))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Security.Tokens.WrappedKeySecurityToken))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Security.EncryptedKey))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Security.EncryptedType))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Security.ISspiNegotiation))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Security.ISspiNegotiationInfo))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Security.ReferenceList))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Security.RelAssertionDirectKeyIdentifierClause))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Security.SamlAssertionDirectKeyIdentifierClause))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Security.KeyNameIdentifierClause))]
[assembly: TypeForwardedTo(typeof(System.ServiceModel.Security.EncryptedKeyHashIdentifierClause))]
[assembly: TypeForwardedTo( typeof( System.ServiceModel.Security.SecurityContextKeyIdentifierClause ) )]
[assembly: TypeForwardedTo( typeof( System.ServiceModel.Security.X509CertificateValidationMode ) )]
[assembly: InternalsVisibleToAttribute("System.ServiceModel.Friend, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleToAttribute("WCF.Unit.System.ServiceModel, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleToAttribute("WCF.CIT.ChannelModel, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleToAttribute("WCF.CIT.ServiceModel, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleToAttribute("SMSvcHost, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleToAttribute("Microsoft.Transactions.Bridge, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleToAttribute("System.ServiceModel.WasHosting, PublicKey=00000000000000000400000000000000")]
[assembly: InternalsVisibleToAttribute("System.WorkflowServices, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleToAttribute("System.ServiceModel.Web, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleToAttribute("Microsoft.ServiceModel.Web.Test, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleToAttribute("WsatSerialization, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleToAttribute("PplScript.Protocol, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleToAttribute("System.ServiceModel.Activities, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleToAttribute("System.ServiceModel.Channels, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleToAttribute("System.ServiceModel.Discovery, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleToAttribute("System.ServiceModel.Routing, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleToAttribute("System.ServiceModel.ServiceMoniker40, PublicKey=00000000000000000400000000000000")]
[assembly: InternalsVisibleToAttribute("System.ServiceModel.Activation, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleToAttribute("System.ServiceModel.LocalChannel, PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
[assembly: InternalsVisibleToAttribute("WireTool, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleToAttribute("WsatTest, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleToAttribute("WsatSerialization, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleToAttribute("WsatLogEntrySerialization, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]
[assembly: InternalsVisibleToAttribute("Indigo_ServiceModelUnitMetadata, PublicKey=002400000480000094000000060200000024000052534131000400000100010007d1fa57c4aed9f0a32e84aa0faefd0de9e8fd6aec8f87fb03766c834c99921eb23be79ad9d5dcc1dd9ad236132102900b723cf980957fc4e177108fc607774f29e8320e92ea05ece4e821c0a5efe8f1645c4c0c93c1ab99285d622caa652c1dfad63d745d6f2de5f17e5eaf0fc4963d261c8a12436518206dc093344d5ad293")]

View File

@ -0,0 +1,169 @@
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
using System;
using System.Collections.Generic;
namespace System
{
internal static partial class AppContextDefaultValues
{
public static void PopulateDefaultValues()
{
string platformIdentifier, profile;
int version;
ParseTargetFrameworkName(out platformIdentifier, out profile, out version);
// Call into each library to populate their default switches
PopulateDefaultValuesPartial(platformIdentifier, profile, version);
}
/// <summary>
/// We have this separate method for getting the parsed elements out of the TargetFrameworkName so we can
/// more easily support this on other platforms.
/// </summary>
private static void ParseTargetFrameworkName(out string identifier, out string profile, out int version)
{
string targetFrameworkMoniker = AppDomain.CurrentDomain.SetupInformation.TargetFrameworkName;
// If we don't have a TFM then we should default to the 4.0 behavior where all quirks are turned on.
if (!TryParseFrameworkName(targetFrameworkMoniker, out identifier, out version, out profile))
{
#if FEATURE_CORECLR
if (CompatibilitySwitches.UseLatestBehaviorWhenTFMNotSpecified)
{
// If we want to use the latest behavior it is enough to set the value of the switch to string.Empty.
// When the get to the caller of this method (PopulateDefaultValuesPartial) we are going to use the
// identifier we just set to decide which switches to turn on. By having an empty string as the
// identifier we are simply saying -- don't turn on any switches, and we are going to get the latest
// behavior for all the switches
identifier = string.Empty;
}
else
#endif
{
identifier = ".NETFramework";
version = 40000;
profile = string.Empty;
}
}
}
// This code was a constructor copied from the FrameworkName class, which is located in System.dll.
// Parses strings in the following format: "<identifier>, Version=[v|V]<version>, Profile=<profile>"
// - The identifier and version is required, profile is optional
// - Only three components are allowed.
// - The version string must be in the System.Version format; an optional "v" or "V" prefix is allowed
private static bool TryParseFrameworkName(String frameworkName, out String identifier, out int version, out String profile)
{
// For parsing a target Framework moniker, from the FrameworkName class
const char c_componentSeparator = ',';
const char c_keyValueSeparator = '=';
const char c_versionValuePrefix = 'v';
const String c_versionKey = "Version";
const String c_profileKey = "Profile";
identifier = profile = string.Empty;
version = 0;
if (frameworkName == null || frameworkName.Length == 0)
{
return false;
}
String[] components = frameworkName.Split(c_componentSeparator);
version = 0;
// Identifer and Version are required, Profile is optional.
if (components.Length < 2 || components.Length > 3)
{
return false;
}
//
// 1) Parse the "Identifier", which must come first. Trim any whitespace
//
identifier = components[0].Trim();
if (identifier.Length == 0)
{
return false;
}
bool versionFound = false;
profile = null;
//
// The required "Version" and optional "Profile" component can be in any order
//
for (int i = 1; i < components.Length; i++)
{
// Get the key/value pair separated by '='
string[] keyValuePair = components[i].Split(c_keyValueSeparator);
if (keyValuePair.Length != 2)
{
return false;
}
// Get the key and value, trimming any whitespace
string key = keyValuePair[0].Trim();
string value = keyValuePair[1].Trim();
//
// 2) Parse the required "Version" key value
//
if (key.Equals(c_versionKey, StringComparison.OrdinalIgnoreCase))
{
versionFound = true;
// Allow the version to include a 'v' or 'V' prefix...
if (value.Length > 0 && (value[0] == c_versionValuePrefix || value[0] == 'V'))
{
value = value.Substring(1);
}
Version realVersion = new Version(value);
// The version class will represent some unset values as -1 internally (instead of 0).
version = realVersion.Major * 10000;
if (realVersion.Minor > 0)
version += realVersion.Minor * 100;
if (realVersion.Build > 0)
version += realVersion.Build;
}
//
// 3) Parse the optional "Profile" key value
//
else if (key.Equals(c_profileKey, StringComparison.OrdinalIgnoreCase))
{
if (!String.IsNullOrEmpty(value))
{
profile = value;
}
}
else
{
return false;
}
}
if (!versionFound)
{
return false;
}
return true;
}
// This is a partial method. Platforms (such as Desktop) can provide an implementation of it that will read override value
// from whatever mechanism is available on that platform. If no implementation is provided, the compiler is going to remove the calls
// to it from the code
static partial void TryGetSwitchOverridePartial(string switchName, ref bool overrideFound, ref bool overrideValue);
/// This is a partial method. This method is responsible for populating the default values based on a TFM.
/// It is partial because each library should define this method in their code to contain their defaults.
static partial void PopulateDefaultValuesPartial(string platformIdentifier, string profile, int version);
}
}

View File

@ -0,0 +1,128 @@
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
// NOTE: This file should not be included in mscorlib. This should only be included in FX libraries that need to provide switches
using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Threading;
namespace System
{
internal static partial class LocalAppContext
{
private delegate bool TryGetSwitchDelegate(string switchName, out bool value);
private static TryGetSwitchDelegate TryGetSwitchFromCentralAppContext;
private static bool s_canForwardCalls;
private static Dictionary<string, bool> s_switchMap = new Dictionary<string, bool>();
private static readonly object s_syncLock = new object();
private static bool DisableCaching { get; set; }
static LocalAppContext()
{
// Try to setup the callback into the central AppContext
s_canForwardCalls = SetupDelegate();
// Populate the default values of the local app context
AppContextDefaultValues.PopulateDefaultValues();
// Cache the value of the switch that help with testing
DisableCaching = IsSwitchEnabled(@"TestSwitch.LocalAppContext.DisableCaching");
}
public static bool IsSwitchEnabled(string switchName)
{
if (s_canForwardCalls)
{
bool isEnabledCentrally;
if (TryGetSwitchFromCentralAppContext(switchName, out isEnabledCentrally))
{
// we found the switch, so return whatever value it has
return isEnabledCentrally;
}
// if we could not get the value from the central authority, try the local storage.
}
return IsSwitchEnabledLocal(switchName);
}
private static bool IsSwitchEnabledLocal(string switchName)
{
// read the value from the set of local defaults
bool isEnabled, isPresent;
lock (s_switchMap)
{
isPresent = s_switchMap.TryGetValue(switchName, out isEnabled);
}
// If the value is in the set of local switches, reutrn the value
if (isPresent)
{
return isEnabled;
}
// if we could not find the switch name, we should return 'false'
// This will preserve the concept of switches been 'off' unless explicitly set to 'on'
return false;
}
private static bool SetupDelegate()
{
Type appContextType = typeof(object).Assembly.GetType("System.AppContext");
if (appContextType == null)
return false;
MethodInfo method = appContextType.GetMethod(
"TryGetSwitch", // the method name
BindingFlags.Static | BindingFlags.Public, // binding flags
null, // use the default binder
new Type[] { typeof(string), typeof(bool).MakeByRefType() },
null); // parameterModifiers - this is ignored by the default binder
if (method == null)
return false;
// Create delegate if we found the method.
TryGetSwitchFromCentralAppContext = (TryGetSwitchDelegate)Delegate.CreateDelegate(typeof(TryGetSwitchDelegate), method);
return true;
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
internal static bool GetCachedSwitchValue(string switchName, ref int switchValue)
{
if (switchValue < 0) return false;
if (switchValue > 0) return true;
return GetCachedSwitchValueInternal(switchName, ref switchValue);
}
private static bool GetCachedSwitchValueInternal(string switchName, ref int switchValue)
{
if (LocalAppContext.DisableCaching)
{
return LocalAppContext.IsSwitchEnabled(switchName);
}
bool isEnabled = LocalAppContext.IsSwitchEnabled(switchName);
switchValue = isEnabled ? 1 /*true*/ : -1 /*false*/;
return isEnabled;
}
/// <summary>
/// This method is going to be called from the AppContextDefaultValues class when setting up the
/// default values for the switches. !!!! This method is called during the static constructor so it does not
/// take a lock !!!! If you are planning to use this outside of that, please ensure proper locking.
/// </summary>
internal static void DefineSwitchDefault(string switchName, bool initialValue)
{
s_switchMap[switchName] = initialValue;
}
}
}

View File

@ -0,0 +1,275 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.Xml
{
// Element => StartElement Attribute* Content EndElement
// | StartElement Attribute* Text // Text must be WithEndElement
// | Array StartElement Attribute* EndElement type MB32(Count) byte[Count * sizeof(type)]
// StartElement => ShortElementNode Name(LocalName)
// | ElementNode Name(Prefix) Name(LocalName)
// | ShortDictionaryElementNode MB32(LocalName)
// | PrefixDictionaryElement[A-Z]Node MB32(LocalName)
// | DictionaryElementNode Name(Prefix) MB32(LocalName)
// | PrefixElement[A-Z]Node Name(LocalName)
// EndElement => EndElementNode
// Content => (Element | ArrayElement | Text | Comment)*
// Attribute => ShortAttributeNode Name(LocalName) Text
// | AttributeNode Name(Prefix) Name(LocalName) Text
// | ShortDictionaryAttributeNode MB32(LocalName) Text
// | DictionaryAttributeNode Name(Prefix) MB32(LocalName) Text
// | ShortXmlnsAttributeNode Name(Namespace)
// | XmlnsAttributeNode Name(Prefix) Name(Namespace)
// | ShortDictionaryXmlnsAttributeNode MB32(Namespace)
// | DictionaryXmlnsAttributeNode Name(Prefix) MB32(Namespace)
// | PrefixAttribute[A-Z] Name(LocalName) Text
// | PrefixDictionaryAttribute[A-Z] MB32(LocalName) Text
// Text => BinaryTextNode
// | CharsTextNode
// | EmptyTextNode
// | DictionaryTextNode MB32(Id)
// | ZeroTextNode
// | OneTextNode
// | TrueTextNode
// | FalseTextNode
// | Int8TextNode Int8
// | Int16TextNode Int16
// | Int32TextNode Int32
// | Int64TextNode Int64
// | FloatTextNode Float
// | DoubleTextNode Double
// | DecimalTextNode Decimal
// | DateTimeTextNode DateTime
// | StartListNode Text* EndListNode // Restriction: Cannot nest ListNode
// | UniqueIdTextNode byte[16] // byte[16] is a Guid (from Guid.ToBinary()) (urn:uuid:xxxx-xxxx-xxx)
// | GuidTextNode byte[16] // byte[16] is a Guid (from Guid.ToBinary()) (xxxx-xxxx-xxx)
// | TimeSpanNode Int64
// | UInt64TextNode UInt64
// | BoolTextNode Int8
// BinaryText => Bytes8TextNode UInt8 byte*
// | Bytes16TextNode UInt16 byte*
// | Bytes32TextNode UInt31 byte*
// CharsText => Chars8TextNode UInt8 byte* // UTF8Chars
// | Chars16TextNode UInt16 byte*
// | Chars32TextNode Unt31 byte*
// | UnicodeChars8TextNode UInt8 char*
// | UnicodeChars16TextNode UInt16 char*
// | UnicodeChars32TextNode UInt31 char*
// | QNameDictionaryTextNode UInt8 MB32(LocalName) // UInt8 0-25 => 'a'-'z'
// Comment => CommentNode Name(Text)
// Name => MB32 byte* // Length, UTF8Chars
// MB32(x:x>=0x80) => byte(0x80 | (x & 0x7F)) MB32(x >> 7)
// MB32(x:x<0x80) => byte(x)
// In order to help differentiate text from binary (where someone mixes up format and implementation) we overlay binary
// nodes that are illegal to start a document with text characters that are legal to start a document. Specifically these values are:
// ' ' = 32
// '\t' = 9
// '\n' = 10
// '\r' = 13
// '<' = 60
// The attribute nodes (MinAttribute to MaxAttribute) overlay all of these values and are invalid as the first byte of the document
enum XmlBinaryNodeType
{
// ProcessingInstruction = 0, // Reserved (Not supported)
EndElement = 1,
Comment = 2,
Array = 3,
MinAttribute = Array + 1,
ShortAttribute = MinAttribute + 0,
Attribute = MinAttribute + 1,
ShortDictionaryAttribute = MinAttribute + 2,
DictionaryAttribute = MinAttribute + 3,
ShortXmlnsAttribute = MinAttribute + 4,
XmlnsAttribute = MinAttribute + 5,
ShortDictionaryXmlnsAttribute = MinAttribute + 6,
DictionaryXmlnsAttribute = MinAttribute + 7,
PrefixDictionaryAttributeA = MinAttribute + 8,
PrefixDictionaryAttributeB = PrefixDictionaryAttributeA + 1,
PrefixDictionaryAttributeC = PrefixDictionaryAttributeB + 1,
PrefixDictionaryAttributeD = PrefixDictionaryAttributeC + 1,
PrefixDictionaryAttributeE = PrefixDictionaryAttributeD + 1,
PrefixDictionaryAttributeF = PrefixDictionaryAttributeE + 1,
PrefixDictionaryAttributeG = PrefixDictionaryAttributeF + 1,
PrefixDictionaryAttributeH = PrefixDictionaryAttributeG + 1,
PrefixDictionaryAttributeI = PrefixDictionaryAttributeH + 1,
PrefixDictionaryAttributeJ = PrefixDictionaryAttributeI + 1,
PrefixDictionaryAttributeK = PrefixDictionaryAttributeJ + 1,
PrefixDictionaryAttributeL = PrefixDictionaryAttributeK + 1,
PrefixDictionaryAttributeM = PrefixDictionaryAttributeL + 1,
PrefixDictionaryAttributeN = PrefixDictionaryAttributeM + 1,
PrefixDictionaryAttributeO = PrefixDictionaryAttributeN + 1,
PrefixDictionaryAttributeP = PrefixDictionaryAttributeO + 1,
PrefixDictionaryAttributeQ = PrefixDictionaryAttributeP + 1,
PrefixDictionaryAttributeR = PrefixDictionaryAttributeQ + 1,
PrefixDictionaryAttributeS = PrefixDictionaryAttributeR + 1,
PrefixDictionaryAttributeT = PrefixDictionaryAttributeS + 1,
PrefixDictionaryAttributeU = PrefixDictionaryAttributeT + 1,
PrefixDictionaryAttributeV = PrefixDictionaryAttributeU + 1,
PrefixDictionaryAttributeW = PrefixDictionaryAttributeV + 1,
PrefixDictionaryAttributeX = PrefixDictionaryAttributeW + 1,
PrefixDictionaryAttributeY = PrefixDictionaryAttributeX + 1,
PrefixDictionaryAttributeZ = PrefixDictionaryAttributeY + 1,
PrefixAttributeA = PrefixDictionaryAttributeZ + 1,
PrefixAttributeB = PrefixAttributeA + 1,
PrefixAttributeC = PrefixAttributeB + 1,
PrefixAttributeD = PrefixAttributeC + 1,
PrefixAttributeE = PrefixAttributeD + 1,
PrefixAttributeF = PrefixAttributeE + 1,
PrefixAttributeG = PrefixAttributeF + 1,
PrefixAttributeH = PrefixAttributeG + 1,
PrefixAttributeI = PrefixAttributeH + 1,
PrefixAttributeJ = PrefixAttributeI + 1,
PrefixAttributeK = PrefixAttributeJ + 1,
PrefixAttributeL = PrefixAttributeK + 1,
PrefixAttributeM = PrefixAttributeL + 1,
PrefixAttributeN = PrefixAttributeM + 1,
PrefixAttributeO = PrefixAttributeN + 1,
PrefixAttributeP = PrefixAttributeO + 1,
PrefixAttributeQ = PrefixAttributeP + 1,
PrefixAttributeR = PrefixAttributeQ + 1,
PrefixAttributeS = PrefixAttributeR + 1,
PrefixAttributeT = PrefixAttributeS + 1,
PrefixAttributeU = PrefixAttributeT + 1,
PrefixAttributeV = PrefixAttributeU + 1,
PrefixAttributeW = PrefixAttributeV + 1,
PrefixAttributeX = PrefixAttributeW + 1,
PrefixAttributeY = PrefixAttributeX + 1,
PrefixAttributeZ = PrefixAttributeY + 1,
MaxAttribute = PrefixAttributeZ,
MinElement = MaxAttribute + 1,
ShortElement = MinElement,
Element = MinElement + 1,
ShortDictionaryElement = MinElement + 2,
DictionaryElement = MinElement + 3,
PrefixDictionaryElementA = MinElement + 4,
PrefixDictionaryElementB = PrefixDictionaryElementA + 1,
PrefixDictionaryElementC = PrefixDictionaryElementB + 1,
PrefixDictionaryElementD = PrefixDictionaryElementC + 1,
PrefixDictionaryElementE = PrefixDictionaryElementD + 1,
PrefixDictionaryElementF = PrefixDictionaryElementE + 1,
PrefixDictionaryElementG = PrefixDictionaryElementF + 1,
PrefixDictionaryElementH = PrefixDictionaryElementG + 1,
PrefixDictionaryElementI = PrefixDictionaryElementH + 1,
PrefixDictionaryElementJ = PrefixDictionaryElementI + 1,
PrefixDictionaryElementK = PrefixDictionaryElementJ + 1,
PrefixDictionaryElementL = PrefixDictionaryElementK + 1,
PrefixDictionaryElementM = PrefixDictionaryElementL + 1,
PrefixDictionaryElementN = PrefixDictionaryElementM + 1,
PrefixDictionaryElementO = PrefixDictionaryElementN + 1,
PrefixDictionaryElementP = PrefixDictionaryElementO + 1,
PrefixDictionaryElementQ = PrefixDictionaryElementP + 1,
PrefixDictionaryElementR = PrefixDictionaryElementQ + 1,
PrefixDictionaryElementS = PrefixDictionaryElementR + 1,
PrefixDictionaryElementT = PrefixDictionaryElementS + 1,
PrefixDictionaryElementU = PrefixDictionaryElementT + 1,
PrefixDictionaryElementV = PrefixDictionaryElementU + 1,
PrefixDictionaryElementW = PrefixDictionaryElementV + 1,
PrefixDictionaryElementX = PrefixDictionaryElementW + 1,
PrefixDictionaryElementY = PrefixDictionaryElementX + 1,
PrefixDictionaryElementZ = PrefixDictionaryElementY + 1,
PrefixElementA = PrefixDictionaryElementZ + 1,
PrefixElementB = PrefixElementA + 1,
PrefixElementC = PrefixElementB + 1,
PrefixElementD = PrefixElementC + 1,
PrefixElementE = PrefixElementD + 1,
PrefixElementF = PrefixElementE + 1,
PrefixElementG = PrefixElementF + 1,
PrefixElementH = PrefixElementG + 1,
PrefixElementI = PrefixElementH + 1,
PrefixElementJ = PrefixElementI + 1,
PrefixElementK = PrefixElementJ + 1,
PrefixElementL = PrefixElementK + 1,
PrefixElementM = PrefixElementL + 1,
PrefixElementN = PrefixElementM + 1,
PrefixElementO = PrefixElementN + 1,
PrefixElementP = PrefixElementO + 1,
PrefixElementQ = PrefixElementP + 1,
PrefixElementR = PrefixElementQ + 1,
PrefixElementS = PrefixElementR + 1,
PrefixElementT = PrefixElementS + 1,
PrefixElementU = PrefixElementT + 1,
PrefixElementV = PrefixElementU + 1,
PrefixElementW = PrefixElementV + 1,
PrefixElementX = PrefixElementW + 1,
PrefixElementY = PrefixElementX + 1,
PrefixElementZ = PrefixElementY + 1,
MaxElement = PrefixElementZ,
// MinorVersion = MaxElement + 1, // Reserved (Not supported)
MinText = 0x80, // Must be even
ZeroText = MinText,
OneText = MinText + 1 * 2,
FalseText = MinText + 2 * 2,
TrueText = MinText + 3 * 2,
Int8Text = MinText + 4 * 2,
Int16Text = MinText + 5 * 2,
Int32Text = MinText + 6 * 2,
Int64Text = MinText + 7 * 2,
FloatText = MinText + 8 * 2,
DoubleText = MinText + 9 * 2,
DecimalText = MinText + 10 * 2,
DateTimeText = MinText + 11 * 2,
Chars8Text = MinText + 12 * 2,
Chars16Text = MinText + 13 * 2,
Chars32Text = MinText + 14 * 2,
Bytes8Text = MinText + 15 * 2,
Bytes16Text = MinText + 16 * 2,
Bytes32Text = MinText + 17 * 2,
StartListText = MinText + 18 * 2,
EndListText = MinText + 19 * 2,
EmptyText = MinText + 20 * 2,
DictionaryText = MinText + 21 * 2,
UniqueIdText = MinText + 22 * 2,
TimeSpanText = MinText + 23 * 2,
GuidText = MinText + 24 * 2,
UInt64Text = MinText + 25 * 2,
BoolText = MinText + 26 * 2,
UnicodeChars8Text = MinText + 27 * 2,
UnicodeChars16Text = MinText + 28 * 2,
UnicodeChars32Text = MinText + 29 * 2,
QNameDictionaryText = MinText + 30 * 2,
ZeroTextWithEndElement = ZeroText + 1,
OneTextWithEndElement = OneText + 1,
FalseTextWithEndElement = FalseText + 1,
TrueTextWithEndElement = TrueText + 1,
Int8TextWithEndElement = Int8Text + 1,
Int16TextWithEndElement = Int16Text + 1,
Int32TextWithEndElement = Int32Text + 1,
Int64TextWithEndElement = Int64Text + 1,
FloatTextWithEndElement = FloatText + 1,
DoubleTextWithEndElement = DoubleText + 1,
DecimalTextWithEndElement = DecimalText + 1,
DateTimeTextWithEndElement = DateTimeText + 1,
Chars8TextWithEndElement = Chars8Text + 1,
Chars16TextWithEndElement = Chars16Text + 1,
Chars32TextWithEndElement = Chars32Text + 1,
Bytes8TextWithEndElement = Bytes8Text + 1,
Bytes16TextWithEndElement = Bytes16Text + 1,
Bytes32TextWithEndElement = Bytes32Text + 1,
StartListTextWithEndElement = StartListText + 1,
EndListTextWithEndElement = EndListText + 1,
EmptyTextWithEndElement = EmptyText + 1,
DictionaryTextWithEndElement = DictionaryText + 1,
UniqueIdTextWithEndElement = UniqueIdText + 1,
TimeSpanTextWithEndElement = TimeSpanText + 1,
GuidTextWithEndElement = GuidText + 1,
UInt64TextWithEndElement = UInt64Text + 1,
BoolTextWithEndElement = BoolText + 1,
UnicodeChars8TextWithEndElement = UnicodeChars8Text + 1,
UnicodeChars16TextWithEndElement = UnicodeChars16Text + 1,
UnicodeChars32TextWithEndElement = UnicodeChars32Text + 1,
QNameDictionaryTextWithEndElement = QNameDictionaryText + 1,
MaxText = QNameDictionaryTextWithEndElement
}
}

View File

@ -0,0 +1 @@
0332ed27e5c10687a1a63c72103b5f8b114f39e4

View File

@ -0,0 +1,78 @@
//----------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------
namespace System.Collections.ObjectModel
{
using System;
using System.Collections.Generic;
using System.ServiceModel;
class FreezableCollection<T> : Collection<T>, ICollection<T>
{
bool frozen;
public FreezableCollection()
: base()
{
}
public FreezableCollection(IList<T> list)
: base(list)
{
}
public bool IsFrozen
{
get
{
return this.frozen;
}
}
bool ICollection<T>.IsReadOnly
{
get
{
return this.frozen;
}
}
public void Freeze()
{
this.frozen = true;
}
protected override void ClearItems()
{
ThrowIfFrozen();
base.ClearItems();
}
protected override void InsertItem(int index, T item)
{
ThrowIfFrozen();
base.InsertItem(index, item);
}
protected override void RemoveItem(int index)
{
ThrowIfFrozen();
base.RemoveItem(index);
}
protected override void SetItem(int index, T item)
{
ThrowIfFrozen();
base.SetItem(index, item);
}
void ThrowIfFrozen()
{
if (this.frozen)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.ObjectIsReadOnly));
}
}
}
}

View File

@ -0,0 +1,55 @@
//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel
{
using System;
using System.Runtime;
using System.Runtime.Serialization;
using System.ServiceModel.Channels;
[Serializable]
internal class ActionMismatchAddressingException : ProtocolException
{
string httpActionHeader;
string soapActionHeader;
public ActionMismatchAddressingException(string message, string soapActionHeader, string httpActionHeader)
: base(message)
{
this.httpActionHeader = httpActionHeader;
this.soapActionHeader = soapActionHeader;
}
protected ActionMismatchAddressingException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
}
public string HttpActionHeader
{
get
{
return httpActionHeader;
}
}
public string SoapActionHeader
{
get
{
return soapActionHeader;
}
}
internal Message ProvideFault(MessageVersion messageVersion)
{
Fx.Assert(messageVersion.Addressing == AddressingVersion.WSAddressing10, "");
WSAddressing10ProblemHeaderQNameFault phf = new WSAddressing10ProblemHeaderQNameFault(this);
Message message = System.ServiceModel.Channels.Message.CreateMessage(messageVersion, phf, messageVersion.Addressing.FaultAction);
phf.AddHeaders(message.Headers);
return message;
}
}
}

View File

@ -0,0 +1,29 @@
//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel
{
using System;
using System.Runtime;
using System.Runtime.Serialization;
using System.ServiceModel.Channels;
[Serializable]
public class ActionNotSupportedException : CommunicationException
{
public ActionNotSupportedException() { }
public ActionNotSupportedException(string message) : base(message) { }
public ActionNotSupportedException(string message, Exception innerException) : base(message, innerException) { }
protected ActionNotSupportedException(SerializationInfo info, StreamingContext context) : base(info, context) { }
internal Message ProvideFault(MessageVersion messageVersion)
{
Fx.Assert(messageVersion.Addressing != AddressingVersion.None, "");
FaultCode code = FaultCode.CreateSenderFaultCode(AddressingStrings.ActionNotSupported, messageVersion.Addressing.Namespace);
string reason = this.Message;
return System.ServiceModel.Channels.Message.CreateMessage(
messageVersion, code, reason, messageVersion.Addressing.FaultAction);
}
}
}

View File

@ -0,0 +1,59 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.Activation
{
using System.Collections.Generic;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.Collections.ObjectModel;
using System.ServiceModel.Dispatcher;
// This attribute specifies what the service implementation requires for AspNet Integration mode.
[AttributeUsage(ServiceModelAttributeTargets.ServiceBehavior)]
public sealed class AspNetCompatibilityRequirementsAttribute : Attribute, IServiceBehavior
{
// AppCompat: The default has been changed in 4.5 to Allowed so that fewer people need to change it.
// For deployment compat purposes, apps targeting 4.0 should behave the same as if 4.5 was not installed.
AspNetCompatibilityRequirementsMode requirementsMode = OSEnvironmentHelper.IsApplicationTargeting45 ?
AspNetCompatibilityRequirementsMode.Allowed : AspNetCompatibilityRequirementsMode.NotAllowed;
// NotAllowed: Validates that the service is not running in the AspNetCompatibility mode.
//
// Required: Validates that service runs in the AspNetCompatibility mode only.
//
// Allowed: Allows both AspNetCompatibility mode and the default Indigo mode.
//
public AspNetCompatibilityRequirementsMode RequirementsMode
{
get
{
return this.requirementsMode;
}
set
{
AspNetCompatibilityRequirementsModeHelper.Validate(value);
this.requirementsMode = value;
}
}
void IServiceBehavior.AddBindingParameters(ServiceDescription description, ServiceHostBase serviceHostBase, Collection<ServiceEndpoint> endpoints, BindingParameterCollection parameters)
{
}
void IServiceBehavior.Validate(ServiceDescription description, ServiceHostBase serviceHostBase)
{
if (description == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("description");
}
AspNetEnvironment.Current.ValidateCompatibilityRequirements(RequirementsMode);
}
void IServiceBehavior.ApplyDispatchBehavior(ServiceDescription description, ServiceHostBase serviceHostBase)
{
}
}
}

View File

@ -0,0 +1,35 @@
//------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------
namespace System.ServiceModel.Activation
{
using System.ComponentModel;
public enum AspNetCompatibilityRequirementsMode
{
NotAllowed,
Allowed,
Required,
}
static class AspNetCompatibilityRequirementsModeHelper
{
static public bool IsDefined(AspNetCompatibilityRequirementsMode x)
{
return
x == AspNetCompatibilityRequirementsMode.NotAllowed ||
x == AspNetCompatibilityRequirementsMode.Allowed ||
x == AspNetCompatibilityRequirementsMode.Required ||
false;
}
public static void Validate(AspNetCompatibilityRequirementsMode value)
{
if (!IsDefined(value))
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException("value", (int)value,
typeof(AspNetCompatibilityRequirementsMode)));
}
}
}
}

View File

@ -0,0 +1,370 @@
//----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
namespace System.ServiceModel.Activation
{
using System.Collections.Generic;
using System.Configuration;
using System.Net;
using System.Runtime;
using System.Security;
using System.Security.Authentication.ExtendedProtection;
using System.Security.Permissions;
using System.ServiceModel.Channels;
using System.ServiceModel.Description;
using System.ServiceModel.Dispatcher;
class AspNetEnvironment
{
static readonly object thisLock = new object();
// Double-checked locking pattern requires volatile for read/write synchronization
static volatile AspNetEnvironment current;
static bool isEnabled;
static bool? isApplicationDomainHosted;
protected AspNetEnvironment()
{
}
public static AspNetEnvironment Current
{
get
{
if (current == null)
{
lock (thisLock)
{
if (current == null)
{
current = new AspNetEnvironment();
}
}
}
return current;
}
// AspNetEnvironment.Current is set by System.ServiceModel.Activation when it is brought into memory through
// the ASP.Net hosting environment. It is the only "real" implementer of this class.
protected set
{
Fx.Assert(!isEnabled, "should only be explicitly set once");
Fx.Assert(value != null, "should only be set to a valid environment");
current = value;
isEnabled = true;
}
}
public static bool Enabled
{
get
{
return isEnabled;
}
}
public bool RequiresImpersonation
{
get
{
return AspNetCompatibilityEnabled;
}
}
public virtual bool AspNetCompatibilityEnabled
{
get
{
// subclass will check AspNetCompatibility mode
return false;
}
}
public virtual string ConfigurationPath
{
get
{
return AppDomain.CurrentDomain.SetupInformation.ConfigurationFile;
}
}
// these ideally would be replaced with public APIs
public virtual bool IsConfigurationBased
{
get
{
// subclass will check ServiceActivationElement presence
return false;
}
}
public virtual string CurrentVirtualPath
{
get
{
// subclass will use calculation from HostingManager.CreateService
return null;
}
}
public virtual string XamlFileBaseLocation
{
get
{
// subclass will use calculation from HostingManager.CreateService
return null;
}
}
public virtual bool UsingIntegratedPipeline
{
get
{
return false;
}
}
public virtual string WebSocketVersion
{
get
{
return null;
}
}
// Indicates if the WebSocket module is loaded. When IIS hosted, it throws an exception when called before we determined if the module is loaded or not.
public bool IsWebSocketModuleLoaded
{
get
{
return this.WebSocketVersion != null;
}
}
public virtual void AddHostingBehavior(ServiceHostBase serviceHost, ServiceDescription description)
{
// subclass will add HostedBindingBehavior
}
public virtual bool IsWindowsAuthenticationConfigured()
{
// subclass will check Asp.Net authentication mode
return false;
}
public virtual List<Uri> GetBaseAddresses(Uri addressTemplate)
{
// subclass will provide multiple base address support
return null;
}
// check if ((System.Web.Configuration.WebContext)configHostingContext).ApplicationLevel == WebApplicationLevel.AboveApplication
public virtual bool IsWebConfigAboveApplication(object configHostingContext)
{
// there are currently only two known implementations of HostingContext, so we are
// pretty much guaranteed to be hosted in ASP.Net here. However, it may not be
// through our BuildProvider, so we still need to do some work in the base class.
// The HostedAspNetEnvironment subclass can perform more efficiently using reflection
return SystemWebHelper.IsWebConfigAboveApplication(configHostingContext);
}
public virtual void EnsureCompatibilityRequirements(ServiceDescription description)
{
// subclass will ensure AspNetCompatibilityRequirementsAttribute is in the behaviors collection
}
public virtual bool TryGetFullVirtualPath(out string virtualPath)
{
// subclass will use the virtual path from the compiled string
virtualPath = null;
return false;
}
public virtual string GetAnnotationFromHost(ServiceHostBase host)
{
// subclass will return "Website name\Application Virtual Path|\relative service virtual path|serviceName"
return string.Empty;
}
public virtual void EnsureAllReferencedAssemblyLoaded()
{
}
public virtual BaseUriWithWildcard GetBaseUri(string transportScheme, Uri listenUri)
{
return null;
}
public virtual void ValidateHttpSettings(string virtualPath, bool isMetadataListener, bool usingDefaultSpnList, ref AuthenticationSchemes supportedSchemes, ref ExtendedProtectionPolicy extendedProtectionPolicy, ref string realm)
{
}
// returns whether or not the caller should use the hosted client certificate mapping
public virtual bool ValidateHttpsSettings(string virtualPath, ref bool requireClientCertificate)
{
return false;
}
public virtual void ProcessNotMatchedEndpointAddress(Uri uri, string endpointName)
{
// subclass will throw as appropriate for compat mode
}
public virtual void ValidateCompatibilityRequirements(AspNetCompatibilityRequirementsMode compatibilityMode)
{
// validate that hosting settings are compatible with the requested requirements
if (compatibilityMode == AspNetCompatibilityRequirementsMode.Required)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidOperationException(SR.GetString(SR.Hosting_CompatibilityServiceNotHosted)));
}
}
public virtual IAspNetMessageProperty GetHostingProperty(Message message)
{
// subclass will gen up a HostingMessageProperty
return null;
}
public virtual IAspNetMessageProperty GetHostingProperty(Message message, bool removeFromMessage)
{
// subclass will return the hosting property from the message
// and remove it from the message's properties.
return null;
}
public virtual void PrepareMessageForDispatch(Message message)
{
// subclass will wrap ReceiveContext for Busy Count
}
public virtual void ApplyHostedContext(TransportChannelListener listener, BindingContext context)
{
// subclass will push hosted information to the transport listeners
}
internal virtual void AddMetadataBindingParameters(Uri listenUri, KeyedByTypeCollection<IServiceBehavior> serviceBehaviors, BindingParameterCollection bindingParameters)
{
bindingParameters.Add(new ServiceMetadataExtension.MetadataBindingParameter());
}
internal virtual bool IsMetadataListener(BindingParameterCollection bindingParameters)
{
return bindingParameters.Find<ServiceMetadataExtension.MetadataBindingParameter>() != null;
}
public virtual void IncrementBusyCount()
{
// subclass will increment HostingEnvironment.BusyCount
}
public virtual void DecrementBusyCount()
{
// subclass will decrement HostingEnvironment.BusyCount
}
public virtual bool TraceIncrementBusyCountIsEnabled()
{
// subclass will return true if tracing for IncrementBusyCount is enabled.
//kept as a separate check from TraceIncrementBusyCount to avoid creating source string if Tracing is not enabled.
return false;
}
public virtual bool TraceDecrementBusyCountIsEnabled()
{
// subclass will return true if tracing for DecrementBusyCount is enabled.
//kept as a separate check from TraceDecrementBusyCount to avoid creating source string if Tracing is not enabled.
return false;
}
public virtual void TraceIncrementBusyCount(string data)
{
//callers are expected to check if TraceIncrementBusyCountIsEnabled() is true
//before calling this method
// subclass will emit trace for IncrementBusyCount
// data is emitted in the Trace as the source of the call to Increment.
}
public virtual void TraceDecrementBusyCount(string data)
{
//callers are expected to check if TraceDecrementBusyCountIsEnabled() is true
//before calling this method
// subclass will emit trace for DecrementBusyCount
// data is emitted in the Trace as the source of the call to Decrement.
}
public virtual object GetConfigurationSection(string sectionPath)
{
// subclass will interact with web.config system
return ConfigurationManager.GetSection(sectionPath);
}
// Be sure to update UnsafeGetSection if you modify this method
[Fx.Tag.SecurityNote(Critical = "Uses SecurityCritical method UnsafeGetSectionFromConfigurationManager which elevates.")]
[SecurityCritical]
public virtual object UnsafeGetConfigurationSection(string sectionPath)
{
// subclass will interact with web.config system
return UnsafeGetSectionFromConfigurationManager(sectionPath);
}
public virtual AuthenticationSchemes GetAuthenticationSchemes(Uri baseAddress)
{
// subclass will grab settings from the metabase
return AuthenticationSchemes.None;
}
public virtual bool IsSimpleApplicationHost
{
get
{
// subclass will grab settings from the ServiceHostingEnvironment
return false;
}
}
[Fx.Tag.SecurityNote(Critical = "Asserts ConfigurationPermission in order to fetch config from ConfigurationManager,"
+ "caller must guard return value.")]
[SecurityCritical]
[ConfigurationPermission(SecurityAction.Assert, Unrestricted = true)]
static object UnsafeGetSectionFromConfigurationManager(string sectionPath)
{
return ConfigurationManager.GetSection(sectionPath);
}
public virtual bool IsWithinApp(string absoluteVirtualPath)
{
return true;
}
internal static bool IsApplicationDomainHosted()
{
if (!AspNetEnvironment.isApplicationDomainHosted.HasValue)
{
lock (AspNetEnvironment.thisLock)
{
if (!AspNetEnvironment.isApplicationDomainHosted.HasValue)
{
bool isApplicationDomainHosted = false;
if (AspNetEnvironment.Enabled)
{
isApplicationDomainHosted = AspNetEnvironment.IsSystemWebAssemblyLoaded();
}
AspNetEnvironment.isApplicationDomainHosted = isApplicationDomainHosted;
}
}
}
return AspNetEnvironment.isApplicationDomainHosted.Value;
}
private static bool IsSystemWebAssemblyLoaded()
{
const string systemWebName = "System.Web,";
foreach (var assembly in AppDomain.CurrentDomain.GetAssemblies())
{
if (assembly.FullName.StartsWith(systemWebName, StringComparison.OrdinalIgnoreCase))
{
return true;
}
}
return false;
}
}
}

View File

@ -0,0 +1,56 @@
//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Activation.Configuration
{
using System;
using System.Configuration;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
internal static class ConfigurationStrings
{
static string GetSectionPath(string sectionName)
{
return string.Format(CultureInfo.InvariantCulture, @"{0}/{1}", ConfigurationStrings.SectionGroupName, sectionName);
}
static internal string DiagnosticSectionPath
{
get { return ConfigurationStrings.GetSectionPath(ConfigurationStrings.DiagnosticSectionName); }
}
static internal string NetTcpSectionPath
{
get { return ConfigurationStrings.GetSectionPath(ConfigurationStrings.NetTcpSectionName); }
}
static internal string NetPipeSectionPath
{
get { return ConfigurationStrings.GetSectionPath(ConfigurationStrings.NetPipeSectionName); }
}
internal const string SectionGroupName = "system.serviceModel.activation";
// Sid for the built-in group IIS_IUSRS for IIS7
internal const string IIS_IUSRSSid = "S-1-5-32-568";
internal const string DiagnosticSectionName = "diagnostics";
internal const string NetTcpSectionName = "net.tcp";
internal const string NetPipeSectionName = "net.pipe";
internal const string AllowAccounts = "allowAccounts";
internal const string Enabled = "enabled";
internal const string ListenBacklog = "listenBacklog";
internal const string MaxPendingAccepts = "maxPendingAccepts";
internal const string MaxPendingConnections = "maxPendingConnections";
internal const string PerformanceCountersEnabled = "performanceCountersEnabled";
internal const string ReceiveTimeout = "receiveTimeout";
internal const string SecurityIdentifier = "securityIdentifier";
internal const string TeredoEnabled = "teredoEnabled";
internal const string TimeSpanOneTick = "00:00:00.0000001";
internal const string TimeSpanZero = "00:00:00";
}
}

View File

@ -0,0 +1,37 @@
//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Activation.Configuration
{
using System;
using System.Configuration;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
public sealed partial class DiagnosticSection : ConfigurationSection
{
public DiagnosticSection()
: base()
{
}
static internal DiagnosticSection GetSection()
{
DiagnosticSection retval = (DiagnosticSection)ConfigurationManager.GetSection(ConfigurationStrings.DiagnosticSectionPath);
if (retval == null)
{
retval = new DiagnosticSection();
}
return retval;
}
[ConfigurationProperty(ConfigurationStrings.PerformanceCountersEnabled, DefaultValue = ListenerConstants.DefaultPerformanceCountersEnabled)]
public bool PerformanceCountersEnabled
{
get { return (bool)base[ConfigurationStrings.PerformanceCountersEnabled]; }
set { base[ConfigurationStrings.PerformanceCountersEnabled] = value; }
}
}
}

View File

@ -0,0 +1,82 @@
//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Activation.Configuration
{
using System;
using System.Configuration;
using System.ServiceModel.Channels;
using System.ServiceModel.Configuration;
public sealed partial class NetPipeSection : ConfigurationSection
{
PropertyInformationCollection propertyInfo;
public NetPipeSection()
: base()
{
propertyInfo = this.ElementInformation.Properties;
}
[ConfigurationProperty(ConfigurationStrings.AllowAccounts)]
public SecurityIdentifierElementCollection AllowAccounts
{
get { return (SecurityIdentifierElementCollection)base[ConfigurationStrings.AllowAccounts]; }
}
static internal NetPipeSection GetSection()
{
NetPipeSection retval = (NetPipeSection)ConfigurationManager.GetSection(ConfigurationStrings.NetPipeSectionPath);
if (retval == null)
{
retval = new NetPipeSection();
}
return retval;
}
protected override void InitializeDefault()
{
this.AllowAccounts.SetDefaultIdentifiers();
}
[ConfigurationProperty(ConfigurationStrings.MaxPendingConnections, DefaultValue = ListenerConstants.DefaultMaxPendingConnections)]
[IntegerValidator(MinValue = 0)]
public int MaxPendingConnections
{
get { return (int)base[ConfigurationStrings.MaxPendingConnections]; }
set { base[ConfigurationStrings.MaxPendingConnections] = value; }
}
[ConfigurationProperty(ConfigurationStrings.MaxPendingAccepts, DefaultValue = ListenerConstants.DefaultMaxPendingAccepts)]
[IntegerValidator(MinValue = 0)]
public int MaxPendingAccepts
{
get
{
int maxPendingAccepts = (int)base[ConfigurationStrings.MaxPendingAccepts];
if (maxPendingAccepts != ListenerConstants.DefaultMaxPendingAccepts)
{
// if the user changed the default, return user's value
return maxPendingAccepts;
}
else
{
// otherwise return 2 * transport default, since SMSvcHost defaults are global
return 2 * ConnectionOrientedTransportDefaults.GetMaxPendingAccepts();
}
}
set { base[ConfigurationStrings.MaxPendingAccepts] = value; }
}
[ConfigurationProperty(ConfigurationStrings.ReceiveTimeout, DefaultValue = ListenerConstants.DefaultReceiveTimeoutString)]
[System.ComponentModel.TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
[System.ServiceModel.Configuration.ServiceModelTimeSpanValidator(MinValueString = ConfigurationStrings.TimeSpanZero)]
public TimeSpan ReceiveTimeout
{
get { return (TimeSpan)base[ConfigurationStrings.ReceiveTimeout]; }
set { base[ConfigurationStrings.ReceiveTimeout] = value; }
}
}
}

View File

@ -0,0 +1,111 @@
//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Activation.Configuration
{
using System;
using System.Configuration;
using System.ServiceModel.Channels;
using System.ServiceModel.Configuration;
public sealed partial class NetTcpSection : ConfigurationSection
{
PropertyInformationCollection propertyInfo;
public NetTcpSection()
: base()
{
propertyInfo = this.ElementInformation.Properties;
}
[ConfigurationProperty(ConfigurationStrings.AllowAccounts)]
public SecurityIdentifierElementCollection AllowAccounts
{
get { return (SecurityIdentifierElementCollection)base[ConfigurationStrings.AllowAccounts]; }
}
static internal NetTcpSection GetSection()
{
NetTcpSection retval = (NetTcpSection)ConfigurationManager.GetSection(ConfigurationStrings.NetTcpSectionPath);
if (retval == null)
{
retval = new NetTcpSection();
}
return retval;
}
protected override void InitializeDefault()
{
this.AllowAccounts.SetDefaultIdentifiers();
}
[ConfigurationProperty(ConfigurationStrings.ListenBacklog, DefaultValue = ListenerConstants.DefaultListenBacklog)]
[IntegerValidator(MinValue = 0)]
public int ListenBacklog
{
get
{
int listenBacklog = (int)base[ConfigurationStrings.ListenBacklog];
if (listenBacklog != ListenerConstants.DefaultListenBacklog)
{
// if the user changed the default, return user's value
return listenBacklog;
}
else
{
// otherwise return the transport default
return TcpTransportDefaults.GetListenBacklog();
}
}
set { base[ConfigurationStrings.ListenBacklog] = value; }
}
[ConfigurationProperty(ConfigurationStrings.MaxPendingConnections, DefaultValue = ListenerConstants.DefaultMaxPendingConnections)]
[IntegerValidator(MinValue = 0)]
public int MaxPendingConnections
{
get { return (int)base[ConfigurationStrings.MaxPendingConnections]; }
set { base[ConfigurationStrings.MaxPendingConnections] = value; }
}
[ConfigurationProperty(ConfigurationStrings.MaxPendingAccepts, DefaultValue = ListenerConstants.DefaultMaxPendingAccepts)]
[IntegerValidator(MinValue = 0)]
public int MaxPendingAccepts
{
get
{
int maxPendingAccepts = (int)base[ConfigurationStrings.MaxPendingAccepts];
if (maxPendingAccepts != ListenerConstants.DefaultMaxPendingAccepts)
{
// if the user changed the default, return user's value
return maxPendingAccepts;
}
else
{
// otherwise return 2 * transport default, since SMSvcHost defaults are global
return 2 * ConnectionOrientedTransportDefaults.GetMaxPendingAccepts();
}
}
set { base[ConfigurationStrings.MaxPendingAccepts] = value; }
}
[ConfigurationProperty(ConfigurationStrings.ReceiveTimeout, DefaultValue = ListenerConstants.DefaultReceiveTimeoutString)]
[System.ComponentModel.TypeConverter(typeof(TimeSpanOrInfiniteConverter))]
[System.ServiceModel.Configuration.ServiceModelTimeSpanValidator(MinValueString = ConfigurationStrings.TimeSpanZero)]
public TimeSpan ReceiveTimeout
{
get { return (TimeSpan)base[ConfigurationStrings.ReceiveTimeout]; }
set { base[ConfigurationStrings.ReceiveTimeout] = value; }
}
[ConfigurationProperty(ConfigurationStrings.TeredoEnabled, DefaultValue = ListenerConstants.DefaultTeredoEnabled)]
public bool TeredoEnabled
{
get { return (bool)base[ConfigurationStrings.TeredoEnabled]; }
set { base[ConfigurationStrings.TeredoEnabled] = value; }
}
}
}

View File

@ -0,0 +1,58 @@
//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Activation.Configuration
{
using System;
using System.ComponentModel;
using System.ComponentModel.Design.Serialization;
using System.Runtime;
using System.Security.Principal;
class SecurityIdentifierConverter : TypeConverter
{
public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceType)
{
if (typeof(string) == sourceType)
{
return true;
}
return base.CanConvertFrom(context, sourceType);
}
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
if (typeof(InstanceDescriptor) == destinationType)
{
return true;
}
return base.CanConvertTo(context, destinationType);
}
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
Fx.Assert(this.CanConvertFrom(context, value.GetType()), "");
if (value is string)
{
return new SecurityIdentifier((string)value);
}
return base.ConvertFrom(context, culture, value);
}
public override object ConvertTo(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value, Type destinationType)
{
Fx.Assert(this.CanConvertTo(context, destinationType), "");
if (destinationType == typeof(string) && value is SecurityIdentifier)
{
SecurityIdentifier sid = (SecurityIdentifier)value;
return sid.Value;
}
return base.ConvertTo(context, culture, value, destinationType);
}
}
}

View File

@ -0,0 +1,33 @@
//-----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//-----------------------------------------------------------------------------
namespace System.ServiceModel.Activation.Configuration
{
using System;
using System.ComponentModel;
using System.Configuration;
using System.Security.Principal;
public sealed partial class SecurityIdentifierElement : ConfigurationElement
{
public SecurityIdentifierElement()
: base()
{
}
public SecurityIdentifierElement(SecurityIdentifier sid)
: this()
{
this.SecurityIdentifier = sid;
}
[ConfigurationProperty(ConfigurationStrings.SecurityIdentifier, DefaultValue = null, Options = ConfigurationPropertyOptions.IsKey)]
[TypeConverter(typeof(SecurityIdentifierConverter))]
public SecurityIdentifier SecurityIdentifier
{
get { return (SecurityIdentifier)base[ConfigurationStrings.SecurityIdentifier]; }
set { base[ConfigurationStrings.SecurityIdentifier] = value; }
}
}
}

View File

@ -0,0 +1,48 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.ServiceModel.Activation.Configuration
{
using System;
using System.Collections;
using System.Configuration;
using System.Globalization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Configuration;
using System.ServiceModel.Channels;
using System.Security.Principal;
[ConfigurationCollection(typeof(SecurityIdentifierElement))]
public sealed class SecurityIdentifierElementCollection : ServiceModelConfigurationElementCollection<SecurityIdentifierElement>
{
public SecurityIdentifierElementCollection() : base() { }
protected override Object GetElementKey(ConfigurationElement element)
{
if (element == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("element");
}
SecurityIdentifierElement configElementKey = (SecurityIdentifierElement)element;
return configElementKey.SecurityIdentifier.Value;
}
internal void SetDefaultIdentifiers()
{
if (Iis7Helper.IisVersion >= 7)
{
this.Add(new SecurityIdentifierElement(new SecurityIdentifier(ConfigurationStrings.IIS_IUSRSSid)));
}
this.Add(new SecurityIdentifierElement(new SecurityIdentifier(WellKnownSidType.LocalSystemSid, null)));
this.Add(new SecurityIdentifierElement(new SecurityIdentifier(WellKnownSidType.BuiltinAdministratorsSid, null)));
this.Add(new SecurityIdentifierElement(new SecurityIdentifier(WellKnownSidType.LocalServiceSid, null)));
this.Add(new SecurityIdentifierElement(new SecurityIdentifier(WellKnownSidType.NetworkServiceSid, null)));
}
}
}

View File

@ -0,0 +1,39 @@
//------------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//------------------------------------------------------------------------------
namespace System.ServiceModel.Activation.Configuration
{
using System;
using System.Configuration;
public sealed class ServiceModelActivationSectionGroup : ConfigurationSectionGroup
{
public DiagnosticSection Diagnostics
{
get { return (DiagnosticSection)this.Sections[ConfigurationStrings.DiagnosticSectionName]; }
}
static public ServiceModelActivationSectionGroup GetSectionGroup(Configuration config)
{
if (config == null)
{
throw DiagnosticUtility.ExceptionUtility.ThrowHelperArgumentNull("config");
}
#pragma warning suppress 56506 // [....], Configuration.SectionGroups cannot be null
return (ServiceModelActivationSectionGroup)config.SectionGroups[ConfigurationStrings.SectionGroupName];
}
public NetPipeSection NetPipe
{
get { return (NetPipeSection)this.Sections[ConfigurationStrings.NetPipeSectionName]; }
}
public NetTcpSection NetTcp
{
get { return (NetTcpSection)this.Sections[ConfigurationStrings.NetTcpSectionName]; }
}
}
}

View File

@ -0,0 +1,45 @@
//----------------------------------------------------------------------------
// Copyright (c) Microsoft Corporation. All rights reserved.
//----------------------------------------------------------------------------
namespace System.ServiceModel.Activation
{
using System;
using System.IO;
using System.Runtime.Serialization;
using System.Net.Sockets;
[DataContract]
[KnownType(typeof(TcpDuplicateContext))]
[KnownType(typeof(NamedPipeDuplicateContext))]
class DuplicateContext
{
[DataMember]
Uri via;
[DataMember]
byte[] readData;
protected DuplicateContext(Uri via, byte[] readData)
{
this.via = via;
this.readData = readData;
}
public Uri Via
{
get
{
return this.via;
}
}
public byte[] ReadData
{
get
{
return this.readData;
}
}
}
}

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