<Rule Id="CA1819" Action="None" /> <!-- Properties should not return arrays -->
<Rule Id="CA1820" Action="None" /> <!-- Test for empty strings using string length -->
<Rule Id="CA1822" Action="None" /> <!-- Mark members as static -->
- <Rule Id="CA1823" Action="None" /> <!-- Avoid unused private fields -->
<Rule Id="CA1827" Action="None" /> <!-- Do not use Count() when Any() can be used -->
<Rule Id="CA2000" Action="None" /> <!-- Dispose objects before losing scope -->
<Rule Id="CA2010" Action="None" /> <!-- Always consume the value returned by methods marked with PreserveSigAttribute -->
using System.Diagnostics;
using System.Runtime.InteropServices;
+#pragma warning disable CA1823 // analyzer incorrectly flags fixed buffer length const (https://github.com/dotnet/roslyn-analyzers/issues/2724)
internal static partial class Interop
{
using System.Diagnostics;
using System.Runtime.InteropServices;
+#pragma warning disable CA1823 // analyzer incorrectly flags fixed buffer length const (https://github.com/dotnet/roslyn-analyzers/issues/2724)
internal static partial class Interop
{
{
internal static partial class AppleCrypto
{
- private const string OidPbes2 = "1.2.840.113549.1.5.13";
- private const string OidPbkdf2 = "1.2.840.113549.1.5.12";
- private const string OidSha1 = "1.3.14.3.2.26";
- private const string OidTripleDesCbc = "1.2.840.113549.3.7";
-
private static readonly SafeCreateHandle s_nullExportString = new SafeCreateHandle();
- private static readonly SafeCreateHandle s_emptyExportString =
- CoreFoundation.CFStringCreateWithCString("");
-
[DllImport(Libraries.AppleCryptoNative)]
private static extern int AppleCryptoNative_SecKeyExport(
SafeSecKeyRefHandle key,
{
if (protocols.Count == 1 && protocols[0] == SslApplicationProtocol.Http2)
{
- cfProtocolsRefs = s_cfAlpnHttp211Protocols;
+ cfProtocolsRefs = s_cfAlpnHttp2Protocols;
}
else if (protocols.Count == 1 && protocols[0] == SslApplicationProtocol.Http11)
{
{
internal static partial class AppleCrypto
{
+ private static readonly SafeCreateHandle s_emptyExportString =
+ CoreFoundation.CFStringCreateWithCString("");
+
[DllImport(Libraries.AppleCryptoNative)]
private static extern int AppleCryptoNative_X509ImportCertificate(
byte[] pbKeyBlob,
using System.Runtime.InteropServices;
+#pragma warning disable CA1823 // unused private padding fields in MulticastOption structs
+
internal static partial class Interop
{
internal static partial class Sys
{
public IPAddress Address; // Destination IP Address
public int InterfaceIndex; // Interface index
- private int Padding; // Pad out to 8-byte alignment
+ private int _padding; // Pad out to 8-byte alignment
}
[DllImport(Libraries.SystemNative, EntryPoint = "SystemNative_GetControlMessageBufferSize")]
// 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;
-using System.Diagnostics;
using System.Runtime.InteropServices;
+#pragma warning disable CA1823 // unused private padding fields in MulticastOption structs
+
internal static partial class Interop
{
internal static partial class Sys
}
private const int HttpHeaderRequestMaximum = (int)HttpRequestHeader.UserAgent + 1;
- private const int HttpHeaderResponseMaximum = (int)HttpResponseHeader.WwwAuthenticate + 1;
internal static class HTTP_REQUEST_HEADER_ID
{
this.handle = value;
}
- private const uint CRYPT_ACQUIRE_SILENT_FLAG = 0x00000040;
-
protected override bool ReleaseHandle()
{
Interop.Crypt32.CertFreeCertificateContext(handle);
private static readonly Regex s_connectionStringRegex = new Regex(ConnectionStringPattern, RegexOptions.ExplicitCapture | RegexOptions.Compiled);
private static readonly Regex s_connectionStringRegexOdbc = new Regex(ConnectionStringPatternOdbc, RegexOptions.ExplicitCapture | RegexOptions.Compiled);
#endif
- private const string ConnectionStringValidKeyPattern = "^(?![;\\s])[^\\p{Cc}]+(?<!\\s)$"; // key not allowed to start with semi-colon or space or contain non-visible characters or end with space
- private const string ConnectionStringValidValuePattern = "^[^\u0000]*$"; // value not allowed to contain embedded null
- private const string ConnectionStringQuoteValuePattern = "^[^\"'=;\\s\\p{Cc}]*$"; // generally do not quote the value if it matches the pattern
- private const string ConnectionStringQuoteOdbcValuePattern = "^\\{([^\\}\u0000]|\\}\\})*\\}$"; // do not quote odbc value if it matches this pattern
internal const string DataDirectory = "|datadirectory|";
- private static readonly Regex s_connectionStringValidKeyRegex = new Regex(ConnectionStringValidKeyPattern, RegexOptions.Compiled);
- private static readonly Regex s_connectionStringValidValueRegex = new Regex(ConnectionStringValidValuePattern, RegexOptions.Compiled);
+#pragma warning disable CA1823 // used in some compilations and not others
+ private static readonly Regex s_connectionStringValidKeyRegex = new Regex("^(?![;\\s])[^\\p{Cc}]+(?<!\\s)$", RegexOptions.Compiled); // key not allowed to start with semi-colon or space or contain non-visible characters or end with space
+ private static readonly Regex s_connectionStringValidValueRegex = new Regex("^[^\u0000]*$", RegexOptions.Compiled); // value not allowed to contain embedded null
- private static readonly Regex s_connectionStringQuoteValueRegex = new Regex(ConnectionStringQuoteValuePattern, RegexOptions.Compiled);
- private static readonly Regex s_connectionStringQuoteOdbcValueRegex = new Regex(ConnectionStringQuoteOdbcValuePattern, RegexOptions.ExplicitCapture | RegexOptions.Compiled);
+ private static readonly Regex s_connectionStringQuoteValueRegex = new Regex("^[^\"'=;\\s\\p{Cc}]*$", RegexOptions.Compiled); // generally do not quote the value if it matches the pattern
+ private static readonly Regex s_connectionStringQuoteOdbcValueRegex = new Regex("^\\{([^\\}\u0000]|\\}\\})*\\}$", RegexOptions.ExplicitCapture | RegexOptions.Compiled); // do not quote odbc value if it matches this pattern
+#pragma warning restore CA1823
// connection string common keywords
private static class KEY
{
internal class DbMetaDataFactory
{
-
private DataSet _metaDataCollectionsDataSet;
private string _normalizedServerVersion;
private string _serverVersionString;
private const string _minimumVersion = "MinimumVersion";
private const string _dataSourceProductVersionNormalized = "DataSourceProductVersionNormalized";
private const string _dataSourceProductVersion = "DataSourceProductVersion";
- private const string _restrictionDefault = "RestrictionDefault";
private const string _restrictionNumber = "RestrictionNumber";
private const string _numberOfRestrictions = "NumberOfRestrictions";
private const string _restrictionName = "RestrictionName";
internal const int DECIMAL_PRECISION = 29; // Decimal.DecCalc also uses this value
- private const int MIN_SB_BUFFER_SIZE = 105;
-
private static bool IsWhite(char ch)
{
return (((ch) == 0x20) || ((ch) >= 0x09 && (ch) <= 0x0D));
using System.Security;
#endif
+#pragma warning disable CA1823 // not all IDs are used by all partial providers
+
namespace System.Net
{
// Implementation:
/// <summary>Valid states to be in when calling CloseAsync.</summary>
private static readonly WebSocketState[] s_validCloseStates = { WebSocketState.Open, WebSocketState.CloseReceived, WebSocketState.CloseSent };
+#pragma warning disable CA1823 // not used by System.Net.WebSockets.WebSocketProtocol.dll
/// <summary>Successfully completed task representing a close message.</summary>
private static readonly Task<WebSocketReceiveResult> s_cachedCloseTask = Task.FromResult(new WebSocketReceiveResult(0, WebSocketMessageType.Close, true));
+#pragma warning restore CA1823
/// <summary>The maximum size in bytes of a message frame header that includes mask bytes.</summary>
internal const int MaxMessageHeaderLength = 14;
{
// An initial size for our internal sorted list, to avoid extra resizes.
private const int AverageNameSize = 20 * 2; // chars in little endian Unicode
- private const int AverageValueSize = 40;
internal const string ResourceReaderFullyQualifiedName = "System.Resources.ResourceReader, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089";
private const string ResSetTypeName = "System.Resources.RuntimeResourceSet";
private const int ResSetVersion = 2;
<WarningsNotAsErrors>42025</WarningsNotAsErrors>
<DefineConstants>$(DefineConstants),LATEBINDING=True</DefineConstants>
<DefineConstants Condition="'$(TargetsWindows)' == 'true'">$(DefineConstants),PLATFORM_WINDOWS=True</DefineConstants>
+ <NoWarn Condition="'$(TargetsWindows)' != 'true'">$(NoWarn);CA1823</NoWarn> <!-- Avoid unused fields warnings in Unix build -->
<AssemblyName>Microsoft.VisualBasic.Core</AssemblyName>
<NoStdLib>true</NoStdLib>
<RemoveIntegerChecks>false</RemoveIntegerChecks>
Friend Const OptionCompareTextFlags As CompareOptions = (CompareOptions.IgnoreCase Or CompareOptions.IgnoreWidth Or CompareOptions.IgnoreKanaType)
- Private Shared ReadOnly s_resourceManagerSyncObj As Object = New Object
-
Friend Shared m_achIntlSpace() As Char = {chSpace, chIntlSpace}
Private Shared ReadOnly s_voidType As Type = System.Type.GetType("System.Void")
Private Shared s_VBRuntimeAssembly As System.Reflection.Assembly
Public Module Conversion
- Private Const NUMPRS_LEADING_WHITE As Integer = &H1I
- Private Const NUMPRS_TRAILING_WHITE As Integer = &H2I
Private Const NUMPRS_LEADING_PLUS As Integer = &H4I
- Private Const NUMPRS_TRAILING_PLUS As Integer = &H8I
Private Const NUMPRS_LEADING_MINUS As Integer = &H10I
- Private Const NUMPRS_TRAILING_MINUS As Integer = &H20I
Private Const NUMPRS_HEX_OCT As Integer = &H40I
- Private Const NUMPRS_PARENS As Integer = &H80I
Private Const NUMPRS_DECIMAL As Integer = &H100I
- Private Const NUMPRS_THOUSANDS As Integer = &H200I
- Private Const NUMPRS_CURRENCY As Integer = &H400I
Private Const NUMPRS_EXPONENT As Integer = &H800I
- Private Const NUMPRS_USE_ALL As Integer = &H1000I
- Private Const NUMPRS_STD As Integer = &H1FFFI
-
- ' flags used by dwOutFlags only:
- '
- Private Const NUMPRS_NEG As Integer = &H10000I
- Private Const NUMPRS_INEXACT As Integer = &H20000I
' flags used by VarNumFromParseNum to indicate acceptable result types:
'
- Private Const VTBIT_EMPTY As Integer = &H0
- Private Const VTBIT_NULL As Integer = &H2
Private Const VTBIT_I2 As Integer = &H4
Private Const VTBIT_I4 As Integer = &H8
Private Const VTBIT_R4 As Integer = &H10
Private Const VTBIT_R8 As Integer = &H20
- Private Const VTBIT_CY As Integer = &H40
Private Const VTBIT_DATE As Integer = &H80
Private Const VTBIT_BSTR As Integer = &H100
Private Const VTBIT_OBJECT As Integer = &H200
Private Const LCID_US_ENGLISH As Integer = &H409I
Private Const PRSFLAGS As Integer _
= (NUMPRS_LEADING_PLUS Or NUMPRS_LEADING_MINUS Or NUMPRS_HEX_OCT Or NUMPRS_DECIMAL Or NUMPRS_EXPONENT)
- 'Private Const VTBITS As Integer = (VTBIT_I2 Or VTBIT_I4 Or VTBIT_R8 Or VTBIT_CY Or VTBIT_DECIMAL)
Private Const VTBITS As Integer = (VTBIT_I2 Or VTBIT_I4 Or VTBIT_R8 Or VTBIT_DECIMAL)
Private Const TYPE_INDICATOR_INT16 As Char = "%"c
Private Function ShiftVTBits(ByVal vt As Integer) As Integer
Select Case vt
'Case VariantType.Empty
- 'Fall through VTBIT_EMPTY
'Case VariantType.Null
- 'Fall through VTBIT_NULL
Case VariantType.Short
Return VTBIT_I2
Case VariantType.Integer
Public Module FileSystem
- Private Const ERROR_ACCESS_DENIED As Integer = 5
Private Const ERROR_FILE_NOT_FOUND As Integer = 2
- Private Const ERROR_BAD_NETPATH As Integer = 53
- Private Const ERROR_INVALID_PARAMETER As Integer = 87
- Private Const ERROR_WRITE_PROTECT As Integer = 19
Private Const ERROR_FILE_EXISTS As Integer = 80
Private Const ERROR_ALREADY_EXISTS As Integer = 183
Private Const ERROR_INVALID_ACCESS As Integer = 12
Friend Const FIRST_LOCAL_CHANNEL As Integer = 1
Friend Const LAST_LOCAL_CHANNEL As Integer = 255
- Private Const A_NORMAL As Integer = &H0I
- Private Const A_RDONLY As Integer = &H1I
- Private Const A_HIDDEN As Integer = &H2I
- Private Const A_SYSTEM As Integer = &H4I
- Private Const A_VOLID As Integer = &H8I
- Private Const A_SUBDIR As Integer = &H10I
- Private Const A_ARCH As Integer = &H20I
- Private Const A_ALLBITS As Integer = (A_NORMAL Or A_RDONLY Or A_HIDDEN Or A_SYSTEM Or A_VOLID Or A_SUBDIR Or A_ARCH)
-
Friend Const sTimeFormat As String = "T"
Friend Const sDateFormat As String = "d"
Friend Const sDateTimeFormat As String = "F"
<DefineConstants>$(DefineConstants);REGISTRY_ASSEMBLY</DefineConstants>
<IsPartialFacadeAssembly Condition="'$(TargetsNetFx)' == 'true'">true</IsPartialFacadeAssembly>
<GeneratePlatformNotSupportedAssemblyMessage Condition="'$(OSGroup)' == 'AnyOS' AND '$(TargetGroup)' == 'netstandard'">SR.PlatformNotSupported_Registry</GeneratePlatformNotSupportedAssemblyMessage>
+ <NoWarn Condition="'$(TargetsUnix)' == 'true'">$(NoWarn);CA1823</NoWarn> <!-- Avoid unused fields warnings in Unix build -->
<!--
Temporarily necessary as this is only being built for UWP due to an unwanted dependency on it
https://github.com/dotnet/corefx/issues/15966
GeneratorSupport.GenericTypeDeclaration |
GeneratorSupport.DeclareIndexerProperties;
- private static readonly string[][] s_keywords = new string[][] {
- null, // 1 character
- new string[] { // 2 characters
- "as",
- "do",
- "if",
- "in",
- "is",
- },
- new string[] { // 3 characters
- "for",
- "int",
- "new",
- "out",
- "ref",
- "try",
- },
- new string[] { // 4 characters
- "base",
- "bool",
- "byte",
- "case",
- "char",
- "else",
- "enum",
- "goto",
- "lock",
- "long",
- "null",
- "this",
- "true",
- "uint",
- "void",
- },
- new string[] { // 5 characters
- "break",
- "catch",
- "class",
- "const",
- "event",
- "false",
- "fixed",
- "float",
- "sbyte",
- "short",
- "throw",
- "ulong",
- "using",
- "while",
- },
- new string[] { // 6 characters
- "double",
- "extern",
- "object",
- "params",
- "public",
- "return",
- "sealed",
- "sizeof",
- "static",
- "string",
- "struct",
- "switch",
- "typeof",
- "unsafe",
- "ushort",
- },
- new string[] { // 7 characters
- "checked",
- "decimal",
- "default",
- "finally",
- "foreach",
- "private",
- "virtual",
- },
- new string[] { // 8 characters
- "abstract",
- "continue",
- "delegate",
- "explicit",
- "implicit",
- "internal",
- "operator",
- "override",
- "readonly",
- "volatile",
- },
- new string[] { // 9 characters
- "__arglist",
- "__makeref",
- "__reftype",
- "interface",
- "namespace",
- "protected",
- "unchecked",
- },
- new string[] { // 10 characters
- "__refvalue",
- "stackalloc",
- },
- };
-
internal CSharpCodeGenerator() { }
internal CSharpCodeGenerator(IDictionary<string, string> providerOptions)
private int _growFactor; // 100 == 1.0, 130 == 1.3, 200 == 2.0. Do not rename (binary serialization)
private int _version; // Do not rename (binary serialization)
- private const int _MinimumGrow = 4;
- private const int _ShrinkThreshold = 32;
+ private const int MinimumGrow = 4;
// Creates a queue with room for capacity objects. The default initial
// capacity and grow factor are used.
if (_size == _array.Length)
{
int newcapacity = (int)((long)_array.Length * (long)_growFactor / 100);
- if (newcapacity < _array.Length + _MinimumGrow)
+ if (newcapacity < _array.Length + MinimumGrow)
{
- newcapacity = _array.Length + _MinimumGrow;
+ newcapacity = _array.Length + MinimumGrow;
}
SetCapacity(newcapacity);
}
private KeyList keyList; // Do not rename (binary serialization)
private ValueList valueList; // Do not rename (binary serialization)
- private const int _defaultCapacity = 16;
-
// Copy of Array.MaxArrayLength
internal const int MaxArrayLength = 0X7FEFFFFF;
// XPerY=n means that n Xs can be stored in 1 Y.
private const int BitsPerInt32 = 32;
- private const int BytesPerInt32 = 4;
private const int BitsPerByte = 8;
private const int BitShiftPerInt32 = 5;
[AllowNull] private T _current;
private int _index;
- const string LinkedListName = "LinkedList";
- const string CurrentValueName = "Current";
- const string VersionName = "Version";
- const string IndexName = "Index";
-
internal Enumerator(LinkedList<T> list)
{
_list = list;
private const string ItemsName = "Items"; // Do not rename (binary serialization)
private const string VersionName = "Version"; // Do not rename (binary serialization)
- // Needed for enumerator
- private const string TreeName = "Tree";
- private const string NodeValueName = "Item";
- private const string EnumStartName = "EnumStarted";
- private const string ReverseName = "Reverse";
- private const string EnumVersionName = "EnumVersion";
-
- // Needed for TreeSubset
- private const string MinName = "Min";
- private const string MaxName = "Max";
- private const string LowerBoundActiveName = "lBoundActive";
- private const string UpperBoundActiveName = "uBoundActive";
-
internal const int StackAllocThreshold = 100;
#endregion
[SuppressMessage("Microsoft.Performance", "CA1815:OverrideEqualsAndOperatorEqualsOnValueTypes", Justification = "not an expected scenario")]
public struct Enumerator : IEnumerator<T>, IEnumerator, ISerializable, IDeserializationCallback
{
- private static readonly Node s_dummyNode = new Node(default(T)!, NodeColor.Red);
-
private SortedSet<T> _tree;
private int _version;
[DebuggerDisplay("{Message}")]
public class CompositionException : Exception
{
- private const string ErrorsKey = "Errors";
private ReadOnlyCollection<CompositionError> _errors;
/// <summary>
{
private class LifetimeContext
{
- private static Type[] types = { typeof(ComposablePartDefinition) };
-
public Tuple<T, Action> GetExportLifetimeContextFromExport<T>(Export export)
{
T exportedValue;
private static readonly Type LazyOfTType = typeof(Lazy<>);
private static readonly Type LazyOfTMType = typeof(Lazy<,>);
private static readonly Type ExportFactoryOfTType = typeof(ExportFactory<>);
- private static readonly Type ExportFactoryOfTMType = typeof(ExportFactory<,>);
private readonly Type _type;
private readonly bool _isAssignableCollectionType;
internal class RuntimeLicenseContext : LicenseContext
{
private static TraceSwitch s_runtimeLicenseContextSwitch = new TraceSwitch("RuntimeLicenseContextTrace", "RuntimeLicenseContext tracing");
- private const int ReadBlock = 400;
internal Hashtable _savedLicenseKeys;
/// </summary>
public class ConventionBuilder : AttributedModelProvider
{
- private static readonly List<object> s_emptyList = new List<object>();
-
private readonly ReaderWriterLockSlim _lock = new ReaderWriterLockSlim(LockRecursionPolicy.NoRecursion);
private readonly List<PartConventionBuilder> _conventions = new List<PartConventionBuilder>();
{
private NameValueCollection _map;
private static Type s_stringType = typeof(string);
- private static Type[] _paramsArray = new Type[] { s_stringType };
private static string NullString = "None";
public AppSettingsReader()
public class ConfigurationErrorsException : ConfigurationException
{
// Constants
- private const string HttpPrefix = "http:";
private const string SerializationParamFilename = "firstFilename";
private const string SerializationParamLine = "firstLine";
private const string SerializationParamErrorCount = "count";
return errorInfo?.Filename;
}
}
-}
\ No newline at end of file
+}
{
public sealed class DpapiProtectedConfigurationProvider : ProtectedConfigurationProvider
{
- private const int CRYPTPROTECT_UI_FORBIDDEN = 0x1;
- private const int CRYPTPROTECT_LOCAL_MACHINE = 0x4;
private bool _useMachineProtection = true;
private string _keyEntropy;
typeof(SettingValueElement),
null,
ConfigurationPropertyOptions.IsRequired);
- private static readonly XmlDocument s_document = new XmlDocument();
private static readonly ConfigurationPropertyCollection s_properties = new ConfigurationPropertyCollection() { s_propName, s_propSerializeAs, s_propValue };
public SettingElement()
private readonly DataRowBuilder _rowBuilder;
private const string KEY_XMLSCHEMA = "XmlSchema";
private const string KEY_XMLDIFFGRAM = "XmlDiffGram";
- private const string KEY_NAME = "TableName";
internal readonly List<DataView> _delayedViews = new List<DataView>();
private readonly List<DataViewListener> _dataViewListeners = new List<DataViewListener>();
private readonly KeyRestrictionBehavior _behavior;
-#pragma warning disable 169
+#pragma warning disable CS0169
+#pragma warning disable CA1823
// this field is no longer used, hence the warning was disabled
// however, it can not be removed or it will break serialization with V1.1
private readonly string _encryptedActualConnectionString;
-#pragma warning restore 169
+#pragma warning restore CA1823
+#pragma warning restore CS0169
internal DBConnectionString(string value, string restrictions, KeyRestrictionBehavior behavior, Dictionary<string, string> synonyms, bool useOdbcRules)
: this(new DbConnectionOptions(value, synonyms, useOdbcRules), restrictions, behavior, synonyms, false)
private static readonly Regex ConnectionStringRegex = new Regex(ConnectionStringPattern, RegexOptions.ExplicitCapture | RegexOptions.Compiled);
private static readonly Regex ConnectionStringRegexOdbc = new Regex(ConnectionStringPatternOdbc, RegexOptions.ExplicitCapture | RegexOptions.Compiled);
+ private static readonly Regex ConnectionStringValidValueRegex = new Regex("^[^\u0000]*$", RegexOptions.Compiled); // value not allowed to contain embedded null
#endif
- private const string ConnectionStringValidKeyPattern = "^(?![;\\s])[^\\p{Cc}]+(?<!\\s)$"; // key not allowed to start with semi-colon or space or contain non-visible characters or end with space
- private const string ConnectionStringValidValuePattern = "^[^\u0000]*$"; // value not allowed to contain embedded null
- private const string ConnectionStringQuoteValuePattern = "^[^\"'=;\\s\\p{Cc}]*$"; // generally do not quote the value if it matches the pattern
- private const string ConnectionStringQuoteOdbcValuePattern = "^\\{([^\\}\u0000]|\\}\\})*\\}$"; // do not quote odbc value if it matches this pattern
+ private static readonly Regex ConnectionStringValidKeyRegex = new Regex("^(?![;\\s])[^\\p{Cc}]+(?<!\\s)$", RegexOptions.Compiled);// key not allowed to start with semi-colon or space or contain non-visible characters or end with space
+
internal const string DataDirectory = "|datadirectory|";
- private static readonly Regex ConnectionStringValidKeyRegex = new Regex(ConnectionStringValidKeyPattern, RegexOptions.Compiled);
- private static readonly Regex ConnectionStringValidValueRegex = new Regex(ConnectionStringValidValuePattern, RegexOptions.Compiled);
-
- private static readonly Regex ConnectionStringQuoteValueRegex = new Regex(ConnectionStringQuoteValuePattern, RegexOptions.Compiled);
- private static readonly Regex ConnectionStringQuoteOdbcValueRegex = new Regex(ConnectionStringQuoteOdbcValuePattern, RegexOptions.ExplicitCapture | RegexOptions.Compiled);
+ private static readonly Regex ConnectionStringQuoteValueRegex = new Regex("^[^\"'=;\\s\\p{Cc}]*$", RegexOptions.Compiled); // generally do not quote the value if it matches the pattern
+ private static readonly Regex ConnectionStringQuoteOdbcValueRegex = new Regex("^\\{([^\\}\u0000]|\\}\\})*\\}$", RegexOptions.ExplicitCapture | RegexOptions.Compiled); // do not quote odbc value if it matches this pattern
// connection string common keywords
private static class KEY
{
private const int E_NotImpersonationToken = unchecked((int)0x8007051D);
private const int Win32_CheckTokenMembership = 1;
- private const int Win32_GetTokenInformation_1 = 2;
- private const int Win32_GetTokenInformation_2 = 3;
- private const int Win32_ConvertSidToStringSidW = 4;
private const int Win32_CreateWellKnownSid = 5;
static public readonly DbConnectionPoolIdentity NoIdentity = new DbConnectionPoolIdentity(String.Empty, false, true);
- static private readonly byte[] NetworkSid = (ADP.IsWindowsNT ? CreateWellKnownSid(WellKnownSidType.NetworkSid) : null);
private readonly string _sidString;
private readonly bool _isRestricted;
private const string _minimumVersion = "MinimumVersion";
private const string _dataSourceProductVersionNormalized = "DataSourceProductVersionNormalized";
private const string _dataSourceProductVersion = "DataSourceProductVersion";
- private const string _restrictionDefault = "RestrictionDefault";
private const string _restrictionNumber = "RestrictionNumber";
private const string _numberOfRestrictions = "NumberOfRestrictions";
private const string _restrictionName = "RestrictionName";
internal sealed class SNINpHandle : SNIHandle
{
internal const string DefaultPipePath = @"sql\query"; // e.g. \\HOSTNAME\pipe\sql\query
- private const int MAX_PIPE_INSTANCES = 255;
private readonly string _targetServer;
private readonly object _callbackObject;
internal class DataSource
{
- private const char CommaSeparator = ',';
private const char BackSlashSeparator = '\\';
private const string DefaultHostName = "localhost";
private const string DefaultSqlServerInstanceName = "mssqlserver";
{
sealed internal class SqlConnectionFactory : DbConnectionFactory
{
-
- private const string _metaDataXml = "MetaDataXml";
-
private SqlConnectionFactory() : base() { }
public static readonly SqlConnectionFactory SingletonInstance = new SqlConnectionFactory();
private static Dictionary<string, Dictionary<IdentityUserNamePair, List<DatabaseServicePair>>> s_serverUserHash =
new Dictionary<string, Dictionary<IdentityUserNamePair, List<DatabaseServicePair>>>(StringComparer.OrdinalIgnoreCase);
private static SqlDependencyProcessDispatcher s_processDispatcher = null;
- // The following two strings are used for AppDomain.CreateInstance.
- private static readonly string s_assemblyName = (typeof(SqlDependencyProcessDispatcher)).Assembly.FullName;
- private static readonly string s_typeName = (typeof(SqlDependencyProcessDispatcher)).FullName;
// Constructors
}
}
}
-}
\ No newline at end of file
+}
{
internal sealed class SqlMetaDataFactory : DbMetaDataFactory
{
-
private const string _serverVersionNormalized90 = "09.00.0000";
- private const string _serverVersionNormalized90782 = "09.00.0782";
private const string _serverVersionNormalized10 = "10.00.0000";
-
public SqlMetaDataFactory(Stream XMLStream,
string serverVersion,
string serverVersionNormalized) :
{
internal sealed partial class TdsParser
{
+ private static readonly object s_tdsParserLock = new object();
private static volatile bool s_fSSPILoaded = false; // bool to indicate whether library has been loaded
internal void PostReadAsyncForMars()
// textptr sequence
private static readonly byte[] s_longDataHeader = { 0x10, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff };
- private static object s_tdsParserLock = new object();
-
-
// XML metadata substitute sequence
private static readonly byte[] s_xmlMetadataSubstituteSequence = { 0xe7, 0xff, 0xff, 0x00, 0x00, 0x00, 0x00, 0x00 };
{
internal sealed class TdsParserStateObjectFactory
{
-
- private const string UseLegacyNetworkingOnWindows = "System.Data.SqlClient.UseLegacyNetworkingOnWindows";
-
public static readonly TdsParserStateObjectFactory Singleton = new TdsParserStateObjectFactory();
-
// Temporary disabling App Context switching for managed SNI.
// If the appcontext switch is set then Use Managed SNI based on the value. Otherwise Managed SNI should always be used.
+ //private const string UseLegacyNetworkingOnWindows = "System.Data.SqlClient.UseLegacyNetworkingOnWindows";
//private static bool shouldUseLegacyNetorking;
//public static bool UseManagedSNI { get; } = AppContext.TryGetSwitch(UseLegacyNetworkingOnWindows, out shouldUseLegacyNetorking) ? !shouldUseLegacyNetorking : true;
private static TimeSync timeSync = new TimeSync();
// sync DateTime and Stopwatch ticks every 2 hours
- private static Timer syncTimeUpdater = InitalizeSyncTimer();
+#pragma warning disable CA1823 // suppress unused field warning, as it's used to keep the timer alive
+ private static readonly Timer syncTimeUpdater = InitalizeSyncTimer();
+#pragma warning restore CA1823
[System.Security.SecuritySafeCritical]
private static Timer InitalizeSyncTimer()
internal const string DllName = "EventLogMessages.dll";
private const string eventLogMutexName = "netfxeventlog.1.0";
private const int DefaultMaxSize = 512 * 1024;
- private const int DefaultRetention = 7 * SecondsPerDay;
- private const int SecondsPerDay = 60 * 60 * 24;
private EventLogInternal _underlyingEventLog;
}
private static readonly DateTime beginningOfTime = new DateTime(1970, 1, 1, 0, 0, 0);
- private const int OFFSETFIXUP = 4 + 4 + 4 + 4 + 4 + 4 + 2 + 2 + 2 + 2 + 4 + 4 + 4 + 4 + 4 + 4;
}
}
internal const string DllName = "EventLogMessages.dll";
private const string eventLogMutexName = "netfxeventlog.1.0";
private const int SecondsPerDay = 60 * 60 * 24;
- private const int DefaultMaxSize = 512 * 1024;
- private const int DefaultRetention = 7 * SecondsPerDay;
private const int Flag_notifying = 0x1; // keeps track of whether we're notifying our listeners - to prevent double notifications
private const int Flag_forwards = 0x2; // whether the cache contains entries in forwards order (true) or backwards (false)
{
internal const string PerfShimName = "netfxperf.dll";
private const string PerfShimFullNameSuffix = @"\netfxperf.dll";
- private const string PerfShimPathExp = @"%systemroot%\system32\netfxperf.dll";
internal const string OpenEntryPoint = "OpenPerformanceData";
internal const string CollectEntryPoint = "CollectPerformanceData";
internal const string CloseEntryPoint = "ClosePerformanceData";
using Microsoft.Win32.SafeHandles;
using System.Collections.Generic;
using System.ComponentModel;
-using System.Globalization;
using System.IO;
using System.Runtime.InteropServices;
using System.Security;
{
public partial class Process : IDisposable
{
+ private static readonly object s_createProcessLock = new object();
+
/// <summary>
/// Creates an array of <see cref="Process"/> components that are associated with process resources on a
/// remote computer. These process resources share the specified process name.
Interop.Kernel32.SECURITY_ATTRIBUTES unused_SecAttrs = new Interop.Kernel32.SECURITY_ATTRIBUTES();
SafeProcessHandle procSH = new SafeProcessHandle();
SafeThreadHandle threadSH = new SafeThreadHandle();
+
// handles used in parent process
SafeFileHandle parentInputPipeHandle = null;
SafeFileHandle childInputPipeHandle = null;
SafeFileHandle childOutputPipeHandle = null;
SafeFileHandle parentErrorPipeHandle = null;
SafeFileHandle childErrorPipeHandle = null;
+
lock (s_createProcessLock)
{
try
private StreamReader _standardError;
private bool _disposed;
- private static object s_createProcessLock = new object();
-
private bool _standardInputAccessed;
private StreamReadMode _outputStreamReadMode;
internal const int DS_REPSYNC_ALL_SOURCES = 0x00000010;
internal const int DS_REPSYNCALL_ID_SERVERS_BY_DN = 0x00000004;
internal const int DS_REPL_NOTSUPPORTED = 50;
- private const int DS_REPL_INFO_FLAG_IMPROVE_LINKED_ATTRS = 0x00000001;
private ReplicationConnectionCollection _inbound = null;
private ReplicationConnectionCollection _outbound = null;
// Private Variables
private readonly DirectoryContext _context = null;
private readonly DirectoryEntryManager _directoryEntryMgr = null;
- private readonly IntPtr _dsHandle = IntPtr.Zero;
- private readonly IntPtr _authIdentity = IntPtr.Zero;
private bool _disposed = false;
// Internal variables corresponding to public properties
{
public sealed partial class BufferedGraphicsContext : IDisposable
{
+ private Size _bufferSize = Size.Empty;
private Size _virtualSize;
private Point _targetLoc;
private IntPtr _compatDC;
public sealed partial class BufferedGraphicsContext : IDisposable
{
private Size _maximumBuffer;
- private Size _bufferSize = Size.Empty;
/// <summary>
/// Basic constructor.
{
// Format IDs
// private static ImageFormat undefined = new ImageFormat(new Guid("{b96b3ca9-0728-11d3-9d7b-0000f81ef32e}"));
- private static ImageFormat s_memoryBMP = new ImageFormat(new Guid("{b96b3caa-0728-11d3-9d7b-0000f81ef32e}"));
- private static ImageFormat s_bmp = new ImageFormat(new Guid("{b96b3cab-0728-11d3-9d7b-0000f81ef32e}"));
- private static ImageFormat s_emf = new ImageFormat(new Guid("{b96b3cac-0728-11d3-9d7b-0000f81ef32e}"));
- private static ImageFormat s_wmf = new ImageFormat(new Guid("{b96b3cad-0728-11d3-9d7b-0000f81ef32e}"));
- private static ImageFormat s_jpeg = new ImageFormat(new Guid("{b96b3cae-0728-11d3-9d7b-0000f81ef32e}"));
- private static ImageFormat s_png = new ImageFormat(new Guid("{b96b3caf-0728-11d3-9d7b-0000f81ef32e}"));
- private static ImageFormat s_gif = new ImageFormat(new Guid("{b96b3cb0-0728-11d3-9d7b-0000f81ef32e}"));
- private static ImageFormat s_tiff = new ImageFormat(new Guid("{b96b3cb1-0728-11d3-9d7b-0000f81ef32e}"));
- private static ImageFormat s_exif = new ImageFormat(new Guid("{b96b3cb2-0728-11d3-9d7b-0000f81ef32e}"));
- private static ImageFormat s_photoCD = new ImageFormat(new Guid("{b96b3cb3-0728-11d3-9d7b-0000f81ef32e}"));
- private static ImageFormat s_flashPIX = new ImageFormat(new Guid("{b96b3cb4-0728-11d3-9d7b-0000f81ef32e}"));
- private static ImageFormat s_icon = new ImageFormat(new Guid("{b96b3cb5-0728-11d3-9d7b-0000f81ef32e}"));
+ private static readonly ImageFormat s_memoryBMP = new ImageFormat(new Guid("{b96b3caa-0728-11d3-9d7b-0000f81ef32e}"));
+ private static readonly ImageFormat s_bmp = new ImageFormat(new Guid("{b96b3cab-0728-11d3-9d7b-0000f81ef32e}"));
+ private static readonly ImageFormat s_emf = new ImageFormat(new Guid("{b96b3cac-0728-11d3-9d7b-0000f81ef32e}"));
+ private static readonly ImageFormat s_wmf = new ImageFormat(new Guid("{b96b3cad-0728-11d3-9d7b-0000f81ef32e}"));
+ private static readonly ImageFormat s_jpeg = new ImageFormat(new Guid("{b96b3cae-0728-11d3-9d7b-0000f81ef32e}"));
+ private static readonly ImageFormat s_png = new ImageFormat(new Guid("{b96b3caf-0728-11d3-9d7b-0000f81ef32e}"));
+ private static readonly ImageFormat s_gif = new ImageFormat(new Guid("{b96b3cb0-0728-11d3-9d7b-0000f81ef32e}"));
+ private static readonly ImageFormat s_tiff = new ImageFormat(new Guid("{b96b3cb1-0728-11d3-9d7b-0000f81ef32e}"));
+ private static readonly ImageFormat s_exif = new ImageFormat(new Guid("{b96b3cb2-0728-11d3-9d7b-0000f81ef32e}"));
+ private static readonly ImageFormat s_icon = new ImageFormat(new Guid("{b96b3cb5-0728-11d3-9d7b-0000f81ef32e}"));
private Guid _guid;
/// </summary>
internal static class DpiHelper
{
- private const string EnableHighDpiConfigurationValueName = "EnableWindowsFormsHighDpiAutoResizing";
private const double LogicalDpi = 96.0;
private static bool s_isInitialized = false;
/// <summary>
[SuppressMessage("Microsoft.Design", "CA1001:TypesThatOwnDisposableFieldsShouldBeDisposable")]
public partial class ZipArchiveEntry
{
- private const ushort DefaultVersionToExtract = 10;
-
// The maximum index of our buffers, from the maximum index of a byte array
private const int MaxSingleBufferSize = 0x7FFFFFC7;
private RenamedEventHandler _onRenamedHandler = null;
private ErrorEventHandler _onErrorHandler = null;
- // To validate the input for "path"
- private static readonly char[] s_wildcards = new char[] { '?', '*' };
-
private const int c_notifyFiltersValidMask = (int)(NotifyFilters.Attributes |
NotifyFilters.CreationTime |
NotifyFilters.DirectoryName |
/// </summary>
public static partial class PackUriHelper
{
+ // We need to perform Escaping for the following - '%'; '@'; ',' and '?'
+ // !!Important!! - The order is important - The '%' sign should be escaped first.
+ // If any more characters need to be added to the array below they should be added at the end.
+ // All of these arrays must maintain the same ordering.
+ private static readonly char[] s_specialCharacterChars = { '%', '@', ',', '?' };
+
#region Public Methods
/// <summary>
#endregion Internal Methods
#region Private Methods
-
- private static readonly char[] HexUpperChars = {
- '0', '1', '2', '3', '4', '5', '6', '7',
- '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
- };
-
private static Exception GetExceptionIfPartUriInvalid(Uri partUri, out string partUriString)
{
partUriString = string.Empty;
//we use this dummy Uri to represent the root of the container.
private static readonly Uri s_packageRootUri = new Uri("/", UriKind.Relative);
- // We need to perform Escaping for the following - '%'; '@'; ',' and '?'
- // !!Important!! - The order is important - The '%' sign should be escaped first.
- // If any more characters need to be added to the array below they should be added at the end.
- // All of these arrays must maintain the same ordering.
- private static readonly char[] s_specialCharacterChars = { '%', '@', ',', '?' };
-
//Rels segment and extension
private const string RelationshipPartSegmentName = "_rels";
private const string RelationshipPartExtensionName = ".rels";
#region Private Members
private const int InitialPartListSize = 50;
- private const int InitialPieceNameListSize = 50;
private ZipArchive _zipArchive;
private Stream _containerStream; // stream we are opened in if Open(Stream) was called
private const int MinDataBits = 5;
private const string DefaultNewLine = "\n";
- private const string SERIAL_NAME = @"\Device\Serial";
-
// --------- members supporting exposed properties ------------*
private int _baudRate = DefaultBaudRate;
private int _dataBits = DefaultDataBits;
// the correct path and succeed in loading the DLL. Once the DllImport occurs, the DLL will
// already be in the cache.
//
- const string SerializationBlobName = "flatWbemClassObject";
static readonly string name = typeof(IWbemClassObjectFreeThreaded).FullName;
public static Guid IID_IWbemClassObject = new Guid("DC12A681-737F-11CF-884D-00AA004B2E24");
sealed class IWbemQualifierSetFreeThreaded : IDisposable
{
- const string SerializationBlobName = "flatWbemClassObject";
static readonly string name = typeof(IWbemQualifierSetFreeThreaded).FullName;
public static Guid IID_IWbemClassObject = new Guid("DC12A681-737F-11CF-884D-00AA004B2E24");
// prevent Fastprox.dll from unloading prematurely.
// Since this is fixed in WinXP, we only hold onto a WbemContext if we are NOT running XP or later.
-#pragma warning disable 0414 // Kept for possible reflection, comment above for history
- private static WbemContext lockOnFastProx = null; // RemovedDuringPort System.Management.Instrumentation.WMICapabilities.IsWindowsXPOrHigher()?null:new WbemContext();
-#pragma warning restore 0414
+#pragma warning disable CA1823
+#pragma warning disable CS0169 // Kept for possible reflection, comment above for history
+ private static WbemContext lockOnFastProx; // RemovedDuringPort System.Management.Instrumentation.WMICapabilities.IsWindowsXPOrHigher()?null:new WbemContext();
+#pragma warning restore CS0169
+#pragma warning restore CA1823
//
// The wbemObject is changed from a field to a property. This is to avoid major code churn and simplify the solution to
private SortedList PublicNamesUsed = new SortedList(StringComparer.OrdinalIgnoreCase);
private SortedList PrivateNamesUsed = new SortedList(StringComparer.OrdinalIgnoreCase);
- private ArrayList CommentsString = new ArrayList(5);
private bool bHasEmbeddedProperties = false;
-
- const int IDS_CommentShouldSerialize = 0;
- const int IDS_CommentIsPropNull = 1;
- const int IDS_CommentResetProperty = 2;
- const int IDS_CommentAttributeProperty = 3;
- const int IDS_CommentDateConversionFunction = 4;
- const int IDS_CommentGetInstances = 5;
- const int IDS_CommentClassBegin = 6;
- const int IDS_COMMENT_PRIV_AUTOCOMMIT = 7;
- const int IDS_CommentConstructors = 8;
- const int IDS_COMMENT_ORIG_NAMESPACE = 9;
- const int IDS_COMMENT_CLASSNAME = 10;
- const int IDS_CommentSystemObject = 11;
- const int IDS_CommentLateBoundObject = 12;
- const int IDS_CommentManagementScope = 13;
- const int IDS_CommentAutoCommitProperty = 14;
- const int IDS_CommentManagementPath = 15;
- const int IDS_COMMENT_PROP_TYPECONVERTER = 16;
- const int IDS_CommentSystemPropertiesClass = 17;
- const int IDS_CommentEnumeratorImplementation = 18;
- const int IDS_CommentLateBoundProperty = 19;
- const int IDS_COMMENTS_CREATEDCLASS = 20;
- const int IDS_CommentEmbeddedObject = 21;
- const int IDS_CommentCurrentObject = 22;
- const int IDS_CommentFlagForEmbedded = 23;
/// <summary>
}
return retFunctionName;
}
+
/*
- /// <summary>
- /// Function to initialize the comments to be put in the generated code
- /// Later can be moved to Resource once resource for System.management.dll is setup
- /// </summary>
- private void InitializeComments()
- {
- string strComment = "Functions ShouldSerialize<PropertyName> are functions used by VS property browser to check if";
-
- strComment = strComment + " a particular property has to be serialized. These functions are added for all ValueType";
- strComment = strComment + " properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions";
- strComment = strComment + " uses Is<PropertyName>Null function. These functions are also used in the TypeConverter implementation";
- strComment = strComment + " for the properties to check for NULL value of property so that a empty value can be shown";
- strComment = strComment + " in Property browser in case of Drag and Drop in Visual studio.";
+ const int IDS_CommentShouldSerialize = 0;
+ const int IDS_CommentIsPropNull = 1;
+ const int IDS_CommentResetProperty = 2;
+ const int IDS_CommentAttributeProperty = 3;
+ const int IDS_CommentDateConversionFunction = 4;
+ const int IDS_CommentGetInstances = 5;
+ const int IDS_CommentClassBegin = 6;
+ const int IDS_COMMENT_PRIV_AUTOCOMMIT = 7;
+ const int IDS_CommentConstructors = 8;
+ const int IDS_COMMENT_ORIG_NAMESPACE = 9;
+ const int IDS_COMMENT_CLASSNAME = 10;
+ const int IDS_CommentSystemObject = 11;
+ const int IDS_CommentLateBoundObject = 12;
+ const int IDS_CommentManagementScope = 13;
+ const int IDS_CommentAutoCommitProperty = 14;
+ const int IDS_CommentManagementPath = 15;
+ const int IDS_COMMENT_PROP_TYPECONVERTER = 16;
+ const int IDS_CommentSystemPropertiesClass = 17;
+ const int IDS_CommentEnumeratorImplementation = 18;
+ const int IDS_CommentLateBoundProperty = 19;
+ const int IDS_COMMENTS_CREATEDCLASS = 20;
+ const int IDS_CommentEmbeddedObject = 21;
+ const int IDS_CommentCurrentObject = 22;
+ const int IDS_CommentFlagForEmbedded = 23;
- CommentsString.Add(strComment); // IDS_CommentShouldSerialize
+ /// <summary>
+ /// Function to initialize the comments to be put in the generated code
+ /// Later can be moved to Resource once resource for System.management.dll is setup
+ /// </summary>
+ private void InitializeComments()
+ {
+ string strComment = "Functions ShouldSerialize<PropertyName> are functions used by VS property browser to check if";
+
+ strComment = strComment + " a particular property has to be serialized. These functions are added for all ValueType";
+ strComment = strComment + " properties ( properties of type Int32, BOOL etc.. which cannot be set to null). These functions";
+ strComment = strComment + " uses Is<PropertyName>Null function. These functions are also used in the TypeConverter implementation";
+ strComment = strComment + " for the properties to check for NULL value of property so that a empty value can be shown";
+ strComment = strComment + " in Property browser in case of Drag and Drop in Visual studio.";
- strComment = "Functions Is<PropertyName>Null() are functions . These functions are to be used to check if a property is NULL.";
- CommentsString.Add(strComment); // IDS_CommentIsPropNull
+ CommentsString.Add(strComment); // IDS_CommentShouldSerialize
- strComment = "Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used in VS designere in";
- strComment = strComment + " property browser to set a property to NULL.";
- CommentsString.Add(strComment); // IDS_CommentResetProperty
+ strComment = "Functions Is<PropertyName>Null() are functions . These functions are to be used to check if a property is NULL.";
+ CommentsString.Add(strComment); // IDS_CommentIsPropNull
- strComment = "Every property added to the class for WMI property has attributes set to define its behaviour in Visual Studio";
- strComment = strComment + " designer and as well as to define a TypeConverter to be used.";
- CommentsString.Add(strComment); // IDS_CommentAttributeProperty
+ strComment = "Functions Reset<PropertyName> are added for Nullable Read/Write properties. These functions are used in VS designere in";
+ strComment = strComment + " property browser to set a property to NULL.";
+ CommentsString.Add(strComment); // IDS_CommentResetProperty
- strComment = "DateTime Conversions are added for the class to convert DMTF date to System.DateTime and Vise-versa. Conversion from DMTF";
- strComment = strComment + " to System.DateTime conversion ignores the microseconds as System.DateTime doesn't have the microseconds part in it.";
- CommentsString.Add(strComment); // IDS_CommentDateConversionFunction
+ strComment = "Every property added to the class for WMI property has attributes set to define its behaviour in Visual Studio";
+ strComment = strComment + " designer and as well as to define a TypeConverter to be used.";
+ CommentsString.Add(strComment); // IDS_CommentAttributeProperty
- strComment = "Different flavours of GetInstances() help in enumerating instances of the WMI class.";
- CommentsString.Add(strComment); // IDS_CommentGetInstances
+ strComment = "DateTime Conversions are added for the class to convert DMTF date to System.DateTime and Vise-versa. Conversion from DMTF";
+ strComment = strComment + " to System.DateTime conversion ignores the microseconds as System.DateTime doesn't have the microseconds part in it.";
+ CommentsString.Add(strComment); // IDS_CommentDateConversionFunction
- strComment = "An Early Bound class generated for the WMI class ";
- CommentsString.Add(strComment); // IDS_CommentClassBegin
+ strComment = "Different flavours of GetInstances() help in enumerating instances of the WMI class.";
+ CommentsString.Add(strComment); // IDS_CommentGetInstances
- CommentsString.Add("Member variable to store the autocommit behaviour for the class"); // IDS_COMMENT_PRIV_AUTOCOMMIT
+ strComment = "An Early Bound class generated for the WMI class ";
+ CommentsString.Add(strComment); // IDS_CommentClassBegin
- CommentsString.Add("Below are different flavours of constructors to initialize the instance with a WMI object"); // IDS_CommentConstructors
+ CommentsString.Add("Member variable to store the autocommit behaviour for the class"); // IDS_COMMENT_PRIV_AUTOCOMMIT
- CommentsString.Add("Property returns the namespace of the WMI class"); // IDS_COMMENT_ORIG_NAMESPACE
+ CommentsString.Add("Below are different flavours of constructors to initialize the instance with a WMI object"); // IDS_CommentConstructors
- CommentsString.Add("Name of the WMI class"); // IDS_COMMENT_CLASSNAME;
+ CommentsString.Add("Property returns the namespace of the WMI class"); // IDS_COMMENT_ORIG_NAMESPACE
- CommentsString.Add("Property pointing to a embeded object to get System properties of the WMI object"); // IDS_CommentSystemObject
+ CommentsString.Add("Name of the WMI class"); // IDS_COMMENT_CLASSNAME;
- CommentsString.Add("Underlying lateBound WMI object"); // IDS_CommentLateBoundObject
+ CommentsString.Add("Property pointing to a embeded object to get System properties of the WMI object"); // IDS_CommentSystemObject
- CommentsString.Add(" ManagementScope of the object"); // IDS_CommentManagementScope
+ CommentsString.Add("Underlying lateBound WMI object"); // IDS_CommentLateBoundObject
- strComment = "Property to show the autocommit behaviour for the WMI object. If this is";
- strComment = strComment + "true then WMI object is saved to WMI then for change in every";
- strComment = strComment + "property (ie Put is called after modification of a property) ";
- CommentsString.Add(strComment); // IDS_CommentAutoCommitProperty
+ CommentsString.Add(" ManagementScope of the object"); // IDS_CommentManagementScope
- CommentsString.Add("The ManagementPath of the underlying WMI object"); // IDS_CommentManagementPath
+ strComment = "Property to show the autocommit behaviour for the WMI object. If this is";
+ strComment = strComment + "true then WMI object is saved to WMI then for change in every";
+ strComment = strComment + "property (ie Put is called after modification of a property) ";
+ CommentsString.Add(strComment); // IDS_CommentAutoCommitProperty
- CommentsString.Add("TypeConverter to handle null values for ValueType properties"); // IDS_COMMENT_PROP_TYPECONVERTER
+ CommentsString.Add("The ManagementPath of the underlying WMI object"); // IDS_CommentManagementPath
- CommentsString.Add(" Embedded class to represent WMI system Properties"); // IDS_CommentSystemPropertiesClass
+ CommentsString.Add("TypeConverter to handle null values for ValueType properties"); // IDS_COMMENT_PROP_TYPECONVERTER
- CommentsString.Add("Enumerator implementation for enumerating instances of the class"); // IDS_CommentEnumeratorImplementation
- CommentsString.Add("Property returning the underlying lateBound object"); // IDS_CommentLateBoundProperty
+ CommentsString.Add(" Embedded class to represent WMI system Properties"); // IDS_CommentSystemPropertiesClass
- CommentsString.Add("Private property to hold the name of WMI class which created this class"); // IDS_COMMENTS_CREATEDCLASS
- CommentsString.Add("Private variable to hold the embedded property representing the instance"); // IDS_CommentEmbeddedObject
- CommentsString.Add("The current WMI object used"); //IDS_CommentCurrentObject
- CommentsString.Add("Flag to indicate if an instance is an embedded object"); // IDS_CommentFlagForEmbedded
+ CommentsString.Add("Enumerator implementation for enumerating instances of the class"); // IDS_CommentEnumeratorImplementation
+ CommentsString.Add("Property returning the underlying lateBound object"); // IDS_CommentLateBoundProperty
- }
+ CommentsString.Add("Private property to hold the name of WMI class which created this class"); // IDS_COMMENTS_CREATEDCLASS
+ CommentsString.Add("Private variable to hold the embedded property representing the instance"); // IDS_CommentEmbeddedObject
+ CommentsString.Add("The current WMI object used"); //IDS_CommentCurrentObject
+ CommentsString.Add("Flag to indicate if an instance is an embedded object"); // IDS_CommentFlagForEmbedded
+ }
*/
+
/// <summary>
/// Adds comments at the begining of the class defination
/// </summary>
{
#region Constants
- private const char SpaceChar = ' ';
- private const int StatusCodeLength = 3;
-
private const string UriSchemeHttp = "http";
private const string UriSchemeHttps = "https";
private const string EncodingNameGzip = "gzip";
private const string NoTransferEncoding = HttpKnownHeaderNames.TransferEncoding + ":";
private const string NoContentType = HttpKnownHeaderNames.ContentType + ":";
private const string NoExpect = HttpKnownHeaderNames.Expect + ":";
- private const int CurlAge = 5;
- private const int MinCurlAge = 3;
#endregion
new KeyValuePair<string,CURLAUTH>("Basic", CURLAUTH.Basic),
};
- // Max timeout value used by WinHttp handler, so mapping to that here.
- private static readonly TimeSpan s_maxTimeout = TimeSpan.FromMilliseconds(int.MaxValue);
-
- private static readonly char[] s_newLineCharArray = new char[] { HttpRuleParser.CR, HttpRuleParser.LF };
private static readonly bool s_supportsAutomaticDecompression;
private static readonly bool s_supportsSSL;
private static readonly bool s_supportsHttp2Multiplexing;
private bool _useDefaultCredentials = HttpHandlerDefaults.DefaultUseDefaultCredentials;
private CookieContainer _cookieContainer = new CookieContainer();
private bool _useCookies = HttpHandlerDefaults.DefaultUseCookies;
- private TimeSpan _connectTimeout = Timeout.InfiniteTimeSpan;
private bool _automaticRedirection = HttpHandlerDefaults.DefaultAutomaticRedirection;
private int _maxAutomaticRedirections = HttpHandlerDefaults.DefaultMaxAutomaticRedirections;
private int _maxConnectionsPerServer = HttpHandlerDefaults.DefaultMaxConnectionsPerServer;
{
internal sealed partial class HttpEnvironmentProxy : IWebProxy
{
+ private const string EnvAllProxyLC = "all_proxy";
+ private const string EnvHttpProxyLC = "http_proxy";
+ private const string EnvHttpsProxyLC = "https_proxy";
+ private const string EnvNoProxyLC = "no_proxy";
+
public static bool TryCreate(out IWebProxy proxy)
{
// Get environment variables. Protocol specific take precedence over
internal sealed partial class HttpEnvironmentProxy : IWebProxy
{
private const string EnvAllProxyUC = "ALL_PROXY";
- private const string EnvAllProxyLC = "all_proxy";
- private const string EnvHttpProxyLC = "http_proxy";
private const string EnvHttpProxyUC = "HTTP_PROXY";
- private const string EnvHttpsProxyLC = "https_proxy";
private const string EnvHttpsProxyUC = "HTTPS_PROXY";
- private const string EnvNoProxyLC = "no_proxy";
private const string EnvNoProxyUC = "NO_PROXY";
private const string EnvCGI = "GATEWAY_INTERFACE"; // Running in a CGI environment.
{
private const string RequestMessageLookupKey = "System.Net.Http.HttpRequestMessage";
private const string SavedExceptionDispatchInfoLookupKey = "System.Runtime.ExceptionServices.ExceptionDispatchInfo";
- private const string ClientAuthenticationOID = "1.3.6.1.5.5.7.3.2";
private static Oid s_serverAuthOid = new Oid("1.3.6.1.5.5.7.3.1", "1.3.6.1.5.5.7.3.1");
private static readonly Lazy<bool> s_RTCookieUsageBehaviorSupported =
new Lazy<bool>(InitRTCookieUsageBehaviorSupported);
private bool _isDisposed = false;
internal const uint CertBoblSize = 1500;
private string _serviceName;
- private object _lock = new object();
private enum SslStatus : byte
{
return Header;
}
- private const string CRLF = "\r\n";
private static readonly byte[] s_CRLFArray = new byte[] { (byte)'\r', (byte)'\n' };
internal HttpResponseStreamAsyncResult(object asyncObject, object userState, AsyncCallback callback, byte[] buffer, int offset, int size, bool chunked, bool sentHeaders, ThreadPoolBoundHandle boundHandle) : base(asyncObject, userState, callback)
{
internal static partial class HttpWebSocket
{
- private static readonly Random s_keyGenerator = new Random();
-
internal static Task<HttpListenerWebSocketContext> AcceptWebSocketAsync(HttpListenerContext context,
string subProtocol,
int receiveBufferSize,
private readonly ISmtpAuthenticationModule[] _authenticationModules;
// accounts for the '=' or ' ' character after AUTH
- private const int SizeOfAuthString = 5;
private const int SizeOfAuthExtension = 4;
private static readonly char[] s_authExtensionSplitters = new char[] { ' ', '=' };
<OutputType>Library</OutputType>
<ProjectGuid>{3CA89D6C-F8D1-4813-9775-F8D249686E31}</ProjectGuid>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
+ <NoWarn Condition=" '$(TargetsFreeBSD)' == 'true'">$(NoWarn);CA1823</NoWarn>
<Configurations>netcoreapp-FreeBSD-Debug;netcoreapp-FreeBSD-Release;netcoreapp-Linux-Debug;netcoreapp-Linux-Release;netcoreapp-OSX-Debug;netcoreapp-OSX-Release;netcoreapp-Windows_NT-Debug;netcoreapp-Windows_NT-Release;uap-Windows_NT-Debug;uap-Windows_NT-Release</Configurations>
</PropertyGroup>
<ItemGroup>
{
public partial class Ping
{
+ private const int MaxUdpPacket = 0xFFFF + 256; // Marshal.SizeOf(typeof(Icmp6EchoReply)) * 2 + ip header info;
+
private static readonly SafeWaitHandle s_nullSafeWaitHandle = new SafeWaitHandle(IntPtr.Zero, true);
private static readonly object s_socketInitializationLock = new object();
private static bool s_socketInitialized;
private const int DefaultSendBufferSize = 32; // Same as ping.exe on Windows.
private const int DefaultTimeout = 5000; // 5 seconds: same as ping.exe on Windows.
private const int MaxBufferSize = 65500; // Artificial constraint due to win32 api limitations.
- private const int MaxUdpPacket = 0xFFFF + 256; // Marshal.SizeOf(typeof(Icmp6EchoReply)) * 2 + ip header info;
private readonly ManualResetEventSlim _lockObject = new ManualResetEventSlim(initialState: true); // doubles as the ability to wait on the current operation
private SendOrPostCallback _onPingCompletedDelegate;
private ResponseDescription _currentResponseDescription;
protected string _abortReason;
- private const int WaitingForPipeline = 1;
- private const int CompletedPipeline = 2;
-
internal CommandStream(TcpClient client)
: base(client)
{
}
private const string ContinueHeader = "100-continue";
private const string ChunkedHeader = "chunked";
- private const string GZipHeader = "gzip";
- private const string DeflateHeader = "deflate";
public HttpWebRequest()
{
// 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.Collections.Generic;
using System.ComponentModel;
-using System.Diagnostics;
-using System.Globalization;
using System.Net.Security;
using System.Security.Authentication.ExtendedProtection;
using System.Threading;
{
internal partial class NTAuthentication
{
- private static ContextCallback s_InitializeCallback = new ContextCallback(InitializeCallback);
-
internal string AssociatedName
{
get
/// </summary>
public class ExtendedProtectionPolicy : ISerializable
{
- private const string policyEnforcementName = "policyEnforcement";
- private const string protectionScenarioName = "protectionScenario";
- private const string customServiceNamesName = "customServiceNames";
- private const string customChannelBindingName = "customChannelBinding";
-
private ServiceNameCollection _customServiceNames;
private PolicyEnforcement _policyEnforcement;
private ProtectionScenario _protectionScenario;
private const int ConnectedId = AcceptedId + 1;
private const int ConnectedAsyncDnsId = ConnectedId + 1;
private const int NotLoggedFileId = ConnectedAsyncDnsId + 1;
- private const int DumpArrayId = NotLoggedFileId + 1;
[NonEvent]
public static void Accepted(Socket socket, object remoteEp, object localEp)
{
#region Constants
private const string HeaderNameCookie = "Cookie";
- private const string ClientAuthenticationOID = "1.3.6.1.5.5.7.3.2";
#endregion
private static readonly Lazy<bool> s_MessageWebSocketClientCertificateSupported =
internal const string RFC3986ReservedMarks = @";/?:@&=+$,#[]!'()*";
private const string RFC2396ReservedMarks = @";/?:@&=+$,";
private const string RFC3986UnreservedMarks = @"-_.~";
- private const string RFC2396UnreservedMarks = @"-_.~*'()!";
private const string AdditionalUnsafeToUnescape = @"%\#";// While not specified as reserved, these are still unsafe to unescape.
// When unescaping in safe mode, do not unescape the RFC 3986 reserved set:
private const byte s_maxPrecision = s_NUMERIC_MAX_PRECISION; // max SS precision
private const int s_cNumeMax = 4;
- private const long s_lInt32Base = ((long)1) << 32; // 2**32
internal const ulong x_llMax = long.MaxValue; // Max of Int64
- private const double s_DUINT_BASE = (double)s_lInt32Base; // 2**32
public BinXmlSqlDecimal(byte[] data, int offset, bool trim)
{
private const int MaxBytesToMove = 128;
private const int ApproxXmlDeclLength = 80;
private const int NodesInitialSize = 8;
- private const int InitialAttributesCount = 4;
- private const int InitialParsingStateStackSize = 2;
private const int InitialParsingStatesDepth = 2;
- private const int DtdChidrenInitialSize = 2;
private const int MaxByteSequenceLen = 6; // max bytes per character
private const int MaxAttrDuplWalkCount = 250;
private const int MinWhitespaceLookahedCount = 4096;
private const int BUFSIZE = 2048 * 3; // Should be greater than default FileStream size (4096), otherwise the FileStream will try to cache the data
private const int ASYNCBUFSIZE = 64 * 1024; // Set async buffer size to 64KB
private const int OVERFLOW = 32; // Allow overflow in order to reduce checks when writing out constant size markup
- private const int INIT_MARKS_COUNT = 64;
//
// Constructors
private string _xsiSchemaLocation;
private string _xsiNoNamespaceSchemaLocation;
- //XmlCharType instance
- private XmlCharType _xmlCharType = XmlCharType.Instance;
-
//Underlying reader's IXmlLineInfo
private IXmlLineInfo _lineInfo;
internal class AutoValidator : BaseValidator
{
- private const string x_schema = "x-schema";
-
public AutoValidator(XmlValidatingReaderImpl reader, XmlSchemaCollection schemaCollection, IValidationEventHandling eventHandling) : base(reader, schemaCollection, eventHandling)
{
schemaInfo = new SchemaInfo();
internal class Numeric10FacetsChecker : FacetsChecker
{
- private static readonly char[] s_signs = new char[] { '+', '-' };
private decimal _maxValue;
private decimal _minValue;
private XmlSchemaObjectTable _identityConstraints = new XmlSchemaObjectTable();
private Stack _complexTypeStack = new Stack();
private Hashtable _schemasToCompile = new Hashtable();
- private Hashtable _importedSchemas = new Hashtable();
private XmlSchema _schemaForSchema;
// 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.Reflection;
+using System.Reflection.Emit;
+using System.Collections;
+using System.IO;
+using System.Text;
+using System.Threading;
+using System.Security;
+using System.Globalization;
+using System.Collections.Generic;
+
namespace System.Xml.Serialization
{
- using System.Configuration;
- using System.Reflection;
- using System.Reflection.Emit;
- using System.Collections;
- using System.IO;
- using System;
- using System.Text;
- using System.Xml;
- using System.Threading;
- using System.Security;
- using System.Xml.Serialization.Configuration;
- using System.Diagnostics;
- using System.Globalization;
- using System.Runtime.Versioning;
- using System.Diagnostics.CodeAnalysis;
- using System.Collections.Generic;
- using System.Xml.Extensions;
- using System.Linq;
- using System.Xml.Serialization;
-
internal class TempAssembly
{
internal const string GeneratedAssemblyNamespace = "Microsoft.Xml.Serialization.GeneratedAssembly";
private IDictionary _writerMethods;
private IDictionary _readerMethods;
private TempMethodDictionary _methods;
- private Hashtable _assemblies = new Hashtable();
internal class TempMethod
{
internal class Compiler
{
- private bool _debugEnabled = DiagnosticsSwitches.KeepTempFiles.Enabled;
private StringWriter _writer = new StringWriter(CultureInfo.InvariantCulture);
// SxS: This method does not take any resource name and does not expose any resources to the caller.
private string _guidID;
private string _timeSpanID;
- private static bool s_checkDeserializeAdvances=false;
-
protected abstract void InitIDs();
// this method must be called before any generated deserialization methods are called
private Hashtable _createMethods = new Hashtable();
private int _nextCreateMethodNumber = 0;
private int _nextIdNumber = 0;
- private int _nextWhileLoopIndex = 0;
internal Hashtable Enums
{
private Dictionary<string, FieldBuilder> _idNameFields = new Dictionary<string, FieldBuilder>();
private Dictionary<string, EnumMapping> _enums;
private int _nextIdNumber = 0;
- private int _nextWhileLoopIndex = 0;
internal Dictionary<string, EnumMapping> Enums
{
internal static class DynamicAssemblies
{
- private static ArrayList s_assembliesInConfig = new ArrayList();
private static volatile Hashtable s_nameToAssemblyMap = new Hashtable();
private static volatile Hashtable s_assemblyToNameMap = new Hashtable();
private static Hashtable s_tableIsTypeDynamic = Hashtable.Synchronized(new Hashtable());
internal class ReflectionAwareILGen
{
private const string hexDigits = "0123456789ABCDEF";
- private const string arrayMemberKey = "0";
// reflectionVariables holds mapping between a reflection entity
// referenced in the generated code (such as TypeInfo,
// FieldInfo) and the variable which represent the entity (and
private Hashtable _methods;
private bool _useLRE, _emitSymbols;
- private static readonly Guid s_languageGuid = new Guid(0x462d4a3e, 0xb257, 0x4aee, 0x97, 0xcd, 0x59, 0x18, 0xc7, 0x53, 0x17, 0x58);
- private static readonly Guid s_vendorGuid = new Guid(0x994b45c4, 0xe6e9, 0x11d2, 0x90, 0x3f, 0x00, 0xc0, 0x4f, 0xa3, 0x02, 0xa1);
private const string RuntimeName = "{" + XmlReservedNs.NsXslDebug + "}" + "runtime";
private static ModuleBuilder CreateLREModule()
///
internal class QilValidationVisitor : QilScopedVisitor
{
- private SubstitutionList _subs = new SubstitutionList();
+#if DEBUG
private QilTypeChecker _typeCheck = new QilTypeChecker();
+#endif
//-----------------------------------------------
// Entry
}
}
}
-
- // Most of tables here were taken from MSXML sources and compared with the last
- // CSS3 proposal available at http://www.w3.org/TR/2002/WD-css3-lists-20021107/
-
- // MSXML-, CSS3+
- // CSS3 inserts two new characters U+3090, U+3091 before U+3092
- private const string hiraganaAiueo =
- "\u3042\u3044\u3046\u3048\u304a\u304b\u304d\u304f\u3051\u3053" +
- "\u3055\u3057\u3059\u305b\u305d\u305f\u3061\u3064\u3066\u3068" +
- "\u306a\u306b\u306c\u306d\u306e\u306f\u3072\u3075\u3078\u307b" +
- "\u307e\u307f\u3080\u3081\u3082\u3084\u3086\u3088\u3089\u308a" +
- "\u308b\u308c\u308d\u308f\u3092\u3093";
-
- // MSXML-, CSS3+
- private const string hiraganaIroha =
- "\u3044\u308d\u306f\u306b\u307b\u3078\u3068\u3061\u308a\u306c" +
- "\u308b\u3092\u308f\u304b\u3088\u305f\u308c\u305d\u3064\u306d" +
- "\u306a\u3089\u3080\u3046\u3090\u306e\u304a\u304f\u3084\u307e" +
- "\u3051\u3075\u3053\u3048\u3066\u3042\u3055\u304d\u3086\u3081" +
- "\u307f\u3057\u3091\u3072\u3082\u305b\u3059";
-
- // MSXML+, CSS3+
- // CSS3 inserts two new characters U+30F0, U+30F1 before U+30F2
- private const string katakanaAiueo =
- "\u30a2\u30a4\u30a6\u30a8\u30aa\u30ab\u30ad\u30af\u30b1\u30b3" +
- "\u30b5\u30b7\u30b9\u30bb\u30bd\u30bf\u30c1\u30c4\u30c6\u30c8" +
- "\u30ca\u30cb\u30cc\u30cd\u30ce\u30cf\u30d2\u30d5\u30d8\u30db" +
- "\u30de\u30df\u30e0\u30e1\u30e2\u30e4\u30e6\u30e8\u30e9\u30ea" +
- "\u30eb\u30ec\u30ed\u30ef\u30f2\u30f3";
-
- // MSXML+, CSS3+
- // CSS3 removes last U+30F3 character
- private const string katakanaIroha =
- "\u30a4\u30ed\u30cf\u30cb\u30db\u30d8\u30c8\u30c1\u30ea\u30cc" +
- "\u30eb\u30f2\u30ef\u30ab\u30e8\u30bf\u30ec\u30bd\u30c4\u30cd" +
- "\u30ca\u30e9\u30e0\u30a6\u30f0\u30ce\u30aa\u30af\u30e4\u30de" +
- "\u30b1\u30d5\u30b3\u30a8\u30c6\u30a2\u30b5\u30ad\u30e6\u30e1" +
- "\u30df\u30b7\u30f1\u30d2\u30e2\u30bb\u30b9\u30f3";
-
- // MSXML+, CSS3-
- private const string katakanaAiueoHw =
- "\uff71\uff72\uff73\uff74\uff75\uff76\uff77\uff78\uff79\uff7a" +
- "\uff7b\uff7c\uff7d\uff7e\uff7f\uff80\uff81\uff82\uff83\uff84" +
- "\uff85\uff86\uff87\uff88\uff89\uff8a\uff8b\uff8c\uff8d\uff8e" +
- "\uff8f\uff90\uff91\uff92\uff93\uff94\uff95\uff96\uff97\uff98" +
- "\uff99\uff9a\uff9b\uff9c\uff66\uff9d";
-
- // MSXML+, CSS3-
- private const string katakanaIrohaHw =
- "\uff72\uff9b\uff8a\uff86\uff8e\uff8d\uff84\uff81\uff98\uff87" +
- "\uff99\uff66\uff9c\uff76\uff96\uff80\uff9a\uff7f\uff82\uff88" +
- "\uff85\uff97\uff91\uff73\u30f0\uff89\uff75\uff78\uff94\uff8f" +
- "\uff79\uff8c\uff7a\uff74\uff83\uff71\uff7b\uff77\uff95\uff92" +
- "\uff90\uff7c\u30f1\uff8b\uff93\uff7e\uff7d\uff9d";
-
- // MSXML+, CSS3-
- // Unicode 4.0.0 spec: When used to represent numbers in decimal notation, zero
- // is represented by U+3007. Otherwise, zero is represented by U+96F6.
- private const string cjkIdeographic =
- "\u3007\u4e00\u4e8c\u4e09\u56db\u4e94\u516d\u4e03\u516b\u4e5d";
}
}
// 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;
-using System.IO;
-using System.Xml;
-using System.Xml.Schema;
using System.Diagnostics;
-using MS.Internal.Xml;
namespace System.Xml.Xsl.Runtime
{
private BitStack _stkStrip;
private bool _shouldStrip, _preserveAdjacent;
private string _val;
- private XmlCharType _xmlCharType = XmlCharType.Instance;
public static XmlReader CreateReader(XmlReader baseReader, WhitespaceRuleLookup wsRules)
{
{
public static readonly XmlQuerySequence<T> Empty = new XmlQuerySequence<T>();
- private static readonly Type s_XPathItemType = typeof(XPathItem);
-
private T[] _items;
private int _size;
private XmlQueryType _prime;
private XmlQueryCardinality _card;
- private XmlValueConverter _converter;
/// <summary>
/// Create sequence type from prime and cardinality.
{
internal class Scripts
{
- private const string ScriptClassesNamespace = "System.Xml.Xsl.CompiledQuery";
-
private Compiler _compiler;
private Dictionary<string, Type> _nsToType = new Dictionary<string, Type>();
private XmlExtensionFunctionTable _extFuncs = new XmlExtensionFunctionTable();
internal sealed class XslAstRewriter
{
- private static readonly QilName s_nullMode = AstFactory.QName(string.Empty);
-
private CompilerScopeManager<VarPar> _scope;
private Stack<Template> _newTemplates;
private Compiler _compiler;
// Script support
//
private Hashtable[] _typeDeclsByLang = new Hashtable[] { new Hashtable(), new Hashtable(), new Hashtable() };
- private ArrayList _scriptFiles = new ArrayList();
- // Namespaces we always import when compiling
- private static string[] s_defaultNamespaces = new string[] {
- "System",
- "System.Collections",
- "System.Text",
- "System.Text.RegularExpressions",
- "System.Xml",
- "System.Xml.Xsl",
- "System.Xml.XPath",
- };
internal void AddScript(string source, ScriptingLanguage lang, string ns, string fileName, int lineNumber)
{
// 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.Diagnostics;
+using System.Xml.XPath;
+
namespace System.Xml.Xsl.XsltOld
{
- using System;
- using System.Diagnostics;
- using System.Xml;
- using System.Xml.XPath;
-
internal sealed class CopyNamespacesAction : Action
{
private const int BeginEvent = 2;
- private const int TextEvent = 3;
private const int EndEvent = 4;
private const int Advance = 5;
// 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.Diagnostics;
+using System.Text;
+using System.Globalization;
+using System.Collections;
+using System.Collections.Generic;
+using System.Xml.XPath;
+using System.Xml.Xsl.Runtime;
+
namespace System.Xml.Xsl.XsltOld
{
- using System.Diagnostics;
- using System.Text;
- using System.Globalization;
- using System.Collections;
- using System.Collections.Generic;
- using System.Xml.XPath;
- using System.Xml.Xsl.Runtime;
-
internal class NumberAction : ContainerAction
{
- private const long msofnfcNil = 0x00000000; // no flags
- private const long msofnfcTraditional = 0x00000001; // use traditional numbering
- private const long msofnfcAlwaysFormat = 0x00000002; // if requested format is not supported, use Arabic (Western) style
-
- private const int cchMaxFormat = 63; // max size of formatted result
- private const int cchMaxFormatDecimal = 11; // max size of formatted decimal result (doesn't handle the case of a very large pwszSeparator or minlen)
-
internal class FormatInfo
{
public bool isSeparator; // False for alphanumeric strings of chars
internal class ProcessingInstructionAction : ContainerAction
{
- private const int NameEvaluated = 2;
private const int NameReady = 3;
private Avt _nameAvt;
private const string s_EncodingStart = " encoding=\"";
private const string s_Public = "PUBLIC ";
private const string s_System = "SYSTEM ";
- private const string s_Html = "html";
private const string s_QuoteSpace = "\" ";
private const string s_CDataSplit = "]]]]><![CDATA[>";
// Reader settings used when creating XmlReader from inputUri
private static readonly XmlReaderSettings s_readerSettings = new XmlReaderSettings();
+#if FEATURE_COMPILED_XSL
// Version for GeneratedCodeAttribute
private static readonly Version s_version = typeof(XslCompiledTransform).Assembly.GetName().Version;
+#endif
// Options of compilation
private bool _enableDebug = false;
private const byte ILFatFormatHeaderSize = 0x03;
private const int ILFatFormatHeaderSizeShift = 4;
private const byte SectEHTable = 0x01;
- private const byte SectOptILTable = 0x02;
private const byte SectFatFormat = 0x40;
- private const byte SectMoreSects = 0x40;
public static MethodBodyBlock Create(BlobReader reader)
{
return TypeDefTable.FindTypeContainingField(fieldRowId, FieldTable.NumberOfRows);
}
- private static readonly ObjectPool<StringBuilder> s_stringBuilderPool = new ObjectPool<StringBuilder>(() => new StringBuilder());
-
public string GetString(DocumentNameBlobHandle handle)
{
return BlobHeap.GetDocumentName(handle);
private readonly GetTypeCoreCache _owner;
private const int _initialCapacity = 5;
- private const double _growThreshold = 0.75;
}
private struct Entry
{
return _pointerDict.GetOrAdd(elementType, (e) => new RoPointerType(e));
}
- private static readonly Func<RoType, RoPointerType> s_pointerTypeFactory = (e) => new RoPointerType(e);
private readonly ConcurrentDictionary<RoType, RoPointerType> _pointerDict = new ConcurrentDictionary<RoType, RoPointerType>();
//
static internal readonly ExpiresEntryRef INVALID = new ExpiresEntryRef(0, 0);
private const uint ENTRY_MASK = 0x000000ffu;
- private const uint PAGE_MASK = 0xffffff00u;
private const int PAGE_SHIFT = 8;
private uint _ref;
static internal readonly UsageEntryRef INVALID = new UsageEntryRef(0, 0);
private const uint ENTRY_MASK = 0x000000ffu;
- private const uint PAGE_MASK = 0xffffff00u;
private const int PAGE_SHIFT = 8;
private uint _ref;
internal static readonly TimeSpan CORRELATED_REQUEST_TIMEOUT = new TimeSpan(0, 0, 1);
internal static readonly TimeSpan MIN_LIFETIME_FOR_USAGE = NEWADD_INTERVAL;
private const byte NUMBUCKETS = 1;
- private const int MAX_REMOVE = 1024;
private readonly MemoryCacheStore _cacheStore;
internal readonly UsageBucket[] _buckets;
internal static void Trace(string tagName, string message, Exception e = null)
{
#if DEBUG
+ if (!s_tracingEnabled)
+ {
+ return;
+ }
+
string exceptionMessage =
e is null ? null :
e is ExternalException ee ? "Exception " + e + Environment.NewLine + "_hr=0x" + ee.ErrorCode.ToString("x", CultureInfo.InvariantCulture) :
{
private static readonly object s_osLock = new object();
private static readonly object s_processLock = new object();
- private static readonly bool s_is64BitProcess = IntPtr.Size == 8;
private static string s_osPlatformName;
private static string s_osDescription;
private static Architecture? s_osArch;
[System.Runtime.CompilerServices.TypeForwardedFrom("System.Numerics, Version=4.0.0.0, PublicKeyToken=b77a5c561934e089")]
public readonly struct BigInteger : IFormattable, IComparable, IComparable<BigInteger>, IEquatable<BigInteger>
{
- private const int knMaskHighBit = int.MinValue;
private const uint kuMaskHighBit = unchecked((uint)int.MinValue);
private const int kcbitUint = 32;
private const int kcbitUlong = 64;
{
const string WinRTNotifyCollectionChangedEventArgsName = "Windows.UI.Xaml.Interop.NotifyCollectionChangedEventArgs";
- // IBindableVector Guid
- static Guid IID_IBindableVector = new Guid("393de7de-6fd0-4c0d-bb71-47244a113e93");
-
static INotifyCollectionChangedEventArgsFactory s_EventArgsFactory;
// Extracts properties from a managed NotifyCollectionChangedEventArgs and passes them to
/// </summary>
public class ClaimsIdentity : IIdentity
{
- private const string PreFix = "System.Security.ClaimsIdentity.";
- private const string AuthenticationTypeKey = PreFix + "authenticationType";
- private const string LabelKey = PreFix + "label";
- private const string NameClaimTypeKey = PreFix + "nameClaimType";
- private const string RoleClaimTypeKey = PreFix + "roleClaimType";
- private const string VersionKey = PreFix + "version";
-
private enum SerializationMask
{
None = 0,
}
private const int SizeOf_NCRYPT_KEY_BLOB_HEADER_SIZE = sizeof(int) + sizeof(int) + sizeof(int) + sizeof(int);
- private const int SizeOf_BCRYPT_KEY_DATA_BLOB_HEADER = sizeof(int) + sizeof(int) + sizeof(int);
private static readonly CngKeyBlobFormat s_cipherKeyBlobFormat = new CngKeyBlobFormat(Interop.NCrypt.NCRYPT_CIPHER_KEY_BLOB);
}
// Ported from windows c_iscii. If you find bugs here, there are likely similar
// bugs in the windows version
-using System;
using System.Diagnostics;
-using System.Globalization;
using System.Runtime.Serialization;
namespace System.Text
internal class ISCIIEncoding : EncodingNLS, ISerializable
{
// Constants
- private const int CodeDefault = 0; // 0x40 Default
- private const int CodeRoman = 1; // 0x41 Roman Transliteration (not supported)
private const int CodeDevanagari = 2; // 0x42 57002
- private const int CodeBengali = 3; // 0x43 57003
- private const int CodeTamil = 4; // 0x44 57004
- private const int CodeTelugu = 5; // 0x45 57005
- private const int CodeAssamese = 6; // 0x46 57006 Assamese (Bengali)
- private const int CodeOriya = 7; // 0x47 57007
- private const int CodeKannada = 8; // 0x48 57008
- private const int CodeMalayalam = 9; // 0x49 57009
- private const int CodeGujarati = 10; // 0x4a 57010
private const int CodePunjabi = 11; // 0x4b 57011 Punjabi (Gurmukhi)
// Ranges
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, // U+0070..U+007F
};
- private const string HexFormatString = "X4";
private static readonly StandardFormat s_hexStandardFormat = new StandardFormat('X', 4);
[MethodImpl(MethodImplOptions.AggressiveInlining)]
destination[written++] = 'u';
#if BUILDING_INBOX_LIBRARY
int intChar = value;
- intChar.TryFormat(destination.Slice(written), out int charsWritten, HexFormatString);
+ intChar.TryFormat(destination.Slice(written), out int charsWritten, "X4");
Debug.Assert(charsWritten == 4);
written += charsWritten;
#else
private const string NullCharString = "\0";
private const char NullChar = '\0';
private const char LastChar = '\uFFFF';
- private const char GroupChar = (char)0;
private const short SpaceConst = 100;
private const short NotSpaceConst = -100;
{
bool found = false;
+ const char GroupChar = (char)0;
int lastindex = set.IndexOf(GroupChar, index + 1);
string group = set.Substring(index, lastindex - index + 1);
// indices for unique code fragments
private const int Stackpop = 0; // pop one
private const int Stackpop2 = 1; // pop two
- private const int Stackpop3 = 2; // pop three
private const int Capback = 3; // uncapture
private const int Capback2 = 4; // uncapture 2
private const int Branchmarkback2 = 5; // back2 part of branchmark
// CDS Synchronization Event IDs (must be unique)
//
- private const int SPINLOCK_FASTPATHFAILED_ID = 1;
- private const int SPINWAIT_NEXTSPINWILLYIELD_ID = 2;
private const int BARRIER_PHASEFINISHED_ID = 3;
// Store the number of ticks. A tick is a mark of 1 timer interval. By counting ticks
// we can avoid expensive calls to get the current time for every transaction creation.
- private const long TicksPerMillisecond = 10000;
private long _ticks;
private long _lastTimerTime;