From 78d7e1fb3d6aa21eae39eebc3d098399c01d8cb0 Mon Sep 17 00:00:00 2001 From: Harshit <62823486+harshit7962@users.noreply.github.com> Date: Thu, 2 Jan 2025 11:55:25 +0530 Subject: [PATCH] [StyleCleanUp] Addressing SA warnings Part 4 (#10126) Resolve the following SA Ids: 1129, 1121, 1028, 1027, 1014, 1005, 1001 --- src/Microsoft.DotNet.Wpf/src/.editorconfig | 21 --- .../Shared/MS/Internal/SafeSecurityHelper.cs | 4 +- .../Internal/Xaml/Context/XamlContextStack.cs | 12 +- .../Xaml/Parser/SpecialBracketCharacters.cs | 6 +- .../src/Shared/MS/Utility/FrugalList.cs | 6 +- .../System/Windows/Markup/ReflectionHelper.cs | 8 +- .../Windows/Markup/TypeConverterHelper.cs | 2 +- .../Windows/Markup/XmlCompatibilityReader.cs | 12 +- .../Windows/Markup/XmlWrappingReader.cs | 2 +- .../src/System.Xaml/GlobalSuppressions.cs | 2 +- .../Windows/Markup/NameReferenceConverter.cs | 2 +- .../System/Windows/Markup/Reference.cs | 2 +- .../System/Windows/Markup/StaticExtension.cs | 2 +- .../Markup/XmlLangPropertyAttribute.cs | 2 +- .../System/Xaml/Context/NameFixupGraph.cs | 2 +- .../System/Xaml/Context/NameFixupToken.cs | 2 +- .../Xaml/Context/ObjectWriterContext.cs | 4 +- .../System/Xaml/Context/SavedContext.cs | 2 +- .../System/Xaml/Context/XamlContext.cs | 2 +- .../System/Xaml/Context/XamlParserContext.cs | 24 ++-- .../Xaml/InfosetObjects/XamlObjectWriter.cs | 22 ++-- .../XamlObjectWriterSettings.cs | 2 +- .../Xaml/InfosetObjects/XamlReaderSettings.cs | 2 +- .../Xaml/InfosetObjects/XamlXmlReader.cs | 16 +-- .../Xaml/MS/Impl/AssemblyNamespacePair.cs | 4 +- .../System/Xaml/MS/Impl/XmlNsInfo.cs | 8 +- .../System/Xaml/NameScopeDictionary.cs | 2 +- .../System/Xaml/NameValidationHelper.cs | 2 +- .../Xaml/Parser/GenericTypeNameParser.cs | 6 +- .../Xaml/Parser/GenericTypeNameScanner.cs | 4 +- .../System/Xaml/Parser/MePullParser.cs | 22 ++-- .../System/Xaml/Parser/NodeStreamSorter.cs | 6 +- .../System/Xaml/Parser/XamlAttribute.cs | 12 +- .../System/Xaml/Parser/XamlPropertyName.cs | 6 +- .../System/Xaml/Parser/XamlPullParser.cs | 4 +- .../System/Xaml/Parser/XamlQualifiedName.cs | 4 +- .../System/Xaml/Parser/XamlScanner.cs | 2 +- .../System/Xaml/Parser/XamlText.cs | 26 ++-- .../Xaml/RefOnly/LooseTypeExtensions.cs | 2 +- .../System/Xaml/Runtime/ClrObjectRuntime.cs | 8 +- .../Xaml/Runtime/DynamicMethodRuntime.cs | 4 +- .../Xaml/Schema/BuiltInValueConverter.cs | 26 ++-- .../System/Xaml/Schema/MemberReflector.cs | 2 +- .../System/Xaml/Schema/Reflector.cs | 2 +- .../System/Xaml/Schema/TypeReflector.cs | 10 +- .../System/Xaml/Schema/XamlTypeInvoker.cs | 2 +- .../System/Xaml/XamlBackgroundReader.cs | 2 +- .../System.Xaml/System/Xaml/XamlException.cs | 6 +- .../System.Xaml/System/Xaml/XamlLanguage.cs | 12 +- .../System/Xaml/XamlMarkupExtensionWriter.cs | 2 +- .../src/System.Xaml/System/Xaml/XamlMember.cs | 4 +- .../System/Xaml/XamlObjectReader.cs | 124 +++++++++--------- .../src/System.Xaml/System/Xaml/XamlReader.cs | 2 +- .../System.Xaml/System/Xaml/XamlRuntime.cs | 2 +- .../System/Xaml/XamlSchemaContext.cs | 16 +-- .../System.Xaml/System/Xaml/XamlServices.cs | 2 +- .../src/System.Xaml/System/Xaml/XamlType.cs | 4 +- .../System.Xaml/System/Xaml/XamlXmlWriter.cs | 8 +- 58 files changed, 244 insertions(+), 265 deletions(-) diff --git a/src/Microsoft.DotNet.Wpf/src/.editorconfig b/src/Microsoft.DotNet.Wpf/src/.editorconfig index 8c160359f6d..95018f411b1 100644 --- a/src/Microsoft.DotNet.Wpf/src/.editorconfig +++ b/src/Microsoft.DotNet.Wpf/src/.editorconfig @@ -290,27 +290,6 @@ dotnet_diagnostic.IDE0300.severity = suggestion # IDE1006: Naming Styles dotnet_diagnostic.IDE1006.severity = suggestion -# SA1001: Commas should not be preceded by whitespace -dotnet_diagnostic.SA1001.severity = suggestion - -# SA1005: Single line comment should begin with a space -dotnet_diagnostic.SA1005.severity = suggestion - -# SA1014: Opening generic brackets should not be preceded by a space -dotnet_diagnostic.SA1014.severity = suggestion - -# SA1027: Tabs and spaces should be used correctly -dotnet_diagnostic.SA1027.severity = suggestion - -# SA1028: Code should not contain trailing whitespace -dotnet_diagnostic.SA1028.severity = suggestion - -# SA1121: Use built-in type alias -dotnet_diagnostic.SA1121.severity = suggestion - -# SA1129: Do not use default value type constructor -dotnet_diagnostic.SA1129.severity = suggestion - # SA1400: Member should declare an access modifier dotnet_diagnostic.SA1400.severity = suggestion diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/SafeSecurityHelper.cs b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/SafeSecurityHelper.cs index 1a69fca9f00..ee7dc3e4b6f 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/SafeSecurityHelper.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/SafeSecurityHelper.cs @@ -166,12 +166,12 @@ static AssemblyName GetAssemblyName(Assembly assembly) _assemblies = new Dictionary(); } else - { + { if (_assemblies.TryGetValue(key, out result)) { return result; } - } + } // // We use AssemblyName ctor here because GetName demands FileIOPermission diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/Xaml/Context/XamlContextStack.cs b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/Xaml/Context/XamlContextStack.cs index dcb46541039..904a7e7b04e 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/Xaml/Context/XamlContextStack.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/Xaml/Context/XamlContextStack.cs @@ -9,7 +9,7 @@ namespace MS.Internal.Xaml.Context { - //This stack has the following features: + // This stack has the following features: // 1) it recycles frames // 2) it is , and avoids activator.createinstance with the creationDelegate class XamlContextStack where T : XamlFrame @@ -59,7 +59,7 @@ public XamlContextStack(XamlContextStack source, bool copy) } } - //allocate a new frame as the new currentFrame; + // allocate a new frame as the new currentFrame; private void Grow() { T lastFrame = _currentFrame; @@ -94,7 +94,7 @@ public T GetFrame(int depth) return iteratorFrame; } - //Consumers of this stack call PushScope, and we'll either allocate a new frame + // Consumers of this stack call PushScope, and we'll either allocate a new frame // or we'll grab one from our recycled linked list. public void PushScope() { @@ -102,7 +102,7 @@ public void PushScope() { Grow(); } - else //use recycled frame + else // use recycled frame { T lastFrame = _currentFrame; _currentFrame = _recycledFrame; @@ -114,7 +114,7 @@ public void PushScope() Debug.Assert(CurrentFrame.Depth == Depth); } - //Consumers of this stack call PopScope, and we'll move the currentFrame from the main + // Consumers of this stack call PopScope, and we'll move the currentFrame from the main // linked list to the recylced linked list and call .Reset public void PopScope() { @@ -133,7 +133,7 @@ public int Depth set { _depth = value; } } - //In case the stack needs to survive and you don't want to keep the recylced frames around. + // In case the stack needs to survive and you don't want to keep the recylced frames around. public void Trim() { _recycledFrame = null; diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/Xaml/Parser/SpecialBracketCharacters.cs b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/Xaml/Parser/SpecialBracketCharacters.cs index 606a610c16a..3a62239dc12 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/Xaml/Parser/SpecialBracketCharacters.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Internal/Xaml/Parser/SpecialBracketCharacters.cs @@ -4,7 +4,7 @@ #nullable disable -// Description: Data model for the Bracket characters specified on a Markup Extension property. +// Description: Data model for the Bracket characters specified on a Markup Extension property. using System; using System.Collections.Generic; @@ -31,7 +31,7 @@ internal SpecialBracketCharacters() BeginInit(); } - internal SpecialBracketCharacters(IReadOnlyDictionary attributeList) + internal SpecialBracketCharacters(IReadOnlyDictionary attributeList) { BeginInit(); if (attributeList is not null && attributeList.Count > 0) @@ -53,7 +53,7 @@ internal void AddBracketCharacters(char openingBracket, char closingBracket) } } - private void Tokenize(IReadOnlyDictionary attributeList) + private void Tokenize(IReadOnlyDictionary attributeList) { if (_initializing) { diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Utility/FrugalList.cs b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Utility/FrugalList.cs index 2c7e98fcc37..7eb1b7b4369 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/MS/Utility/FrugalList.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/MS/Utility/FrugalList.cs @@ -11,8 +11,8 @@ using MS.Internal.WindowsBase; #endif -//using MS.Internal.PresentationCore; -//using SR=MS.Internal.WindowsBase.SR; +// using MS.Internal.PresentationCore; +// using SR=MS.Internal.WindowsBase.SR; // These classes implement a frugal storage model for lists of type . // Performance measurements show that Avalon has many lists that contain @@ -2289,7 +2289,7 @@ public void CopyTo(T[] array, int index) public FrugalStructList Clone() { - FrugalStructList myClone = new FrugalStructList(); + FrugalStructList myClone = default(FrugalStructList); if (_listStore is not null) { diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/ReflectionHelper.cs b/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/ReflectionHelper.cs index d3e6aff4cc1..93ff97928a8 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/ReflectionHelper.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/ReflectionHelper.cs @@ -4,7 +4,7 @@ #nullable disable -// Description: Specifies that the whitespace surrounding an element should be trimmed. +// Description: Specifies that the whitespace surrounding an element should be trimmed. using System; using System.IO; @@ -333,7 +333,7 @@ private static string GetCustomAttributeData(CustomAttributeData cad, if (constructorArguments.Count == 1 && !noArgs) { CustomAttributeTypedArgument tca = constructorArguments[0]; - attrValue = tca.Value as String; + attrValue = tca.Value as string; #if PBTCOMPILER if (attrValue == null && allowTypeAlso && tca.ArgumentType == GetMscorlibType(typeof(Type))) #else @@ -433,12 +433,12 @@ private static Assembly LoadAssemblyHelper(string assemblyGivenName, string asse // Check if the current AppDomain has this assembly loaded for some other reason. // If so, then just use that assembly and don't attempt to load another copy of it. // Only do this if no path is provided. - if (String.IsNullOrEmpty(assemblyPath)) + if (string.IsNullOrEmpty(assemblyPath)) retassem = SafeSecurityHelper.GetLoadedAssembly(assemblyName); if (retassem is null) { - if (!String.IsNullOrEmpty(assemblyPath)) + if (!string.IsNullOrEmpty(assemblyPath)) { // assemblyPath is set, Load the assembly from this specified place. // the path must be full file path which contains directory, file name and extension. diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/TypeConverterHelper.cs b/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/TypeConverterHelper.cs index 8eee0f35d56..936df76619b 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/TypeConverterHelper.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/TypeConverterHelper.cs @@ -2,7 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. // See the LICENSE file in the project root for more information. -// Description: Specifies that the whitespace surrounding an element should be trimmed. +// Description: Specifies that the whitespace surrounding an element should be trimmed. using System; using System.Reflection; diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/XmlCompatibilityReader.cs b/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/XmlCompatibilityReader.cs index 8deb98f6fa9..f79ef3e6315 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/XmlCompatibilityReader.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/XmlCompatibilityReader.cs @@ -162,7 +162,7 @@ public override bool Read() ScanForEndCompatibility(previousElementDepth); } - bool more = Reader.Read(); //passed as ref arg to ReadStartElement and ReadEndElement + bool more = Reader.Read(); // passed as ref arg to ReadStartElement and ReadEndElement bool result = false; while (more) @@ -327,7 +327,7 @@ private bool ReadEndElement(ref bool more) } _depthOffset--; - PopScope(); //we know we can pop, so no need to scan + PopScope(); // we know we can pop, so no need to scan more = Reader.Read(); } else @@ -821,7 +821,7 @@ private string MapNewNamespace(string namespaceName) { AddKnownNamespace(namespaceName); - if (String.IsNullOrEmpty(mappedNamespace) || namespaceName == mappedNamespace) + if (string.IsNullOrEmpty(mappedNamespace) || namespaceName == mappedNamespace) { _namespaceMap[namespaceName] = namespaceName; } @@ -958,7 +958,7 @@ private IEnumerable ParseContentToNamespaceElementPair(str foreach (string pair in content.Trim().Split(' ')) { // check each non-null, non-empty space-delineated namespace/element pair - if (!String.IsNullOrEmpty(pair)) + if (!string.IsNullOrEmpty(pair)) { int colonIndex = pair.IndexOf(':'); int length = pair.Length; @@ -1006,7 +1006,7 @@ private IEnumerable PrefixesToNamespaces(string prefixes) foreach (string prefix in prefixes.Trim().Split(' ')) { // check each non-null, non-empty space-delineated prefix - if (!String.IsNullOrEmpty(prefix)) + if (!string.IsNullOrEmpty(prefix)) { string namespaceUri = LookupNamespace(prefix); @@ -1220,7 +1220,7 @@ private void HandleChoice(int elementDepth, ref bool more) Error(SR.XCRRequiresAttribNotFound); } - if (String.IsNullOrEmpty(requiresValue)) + if (string.IsNullOrEmpty(requiresValue)) { // Requires attribute may not be empty Error(SR.XCRInvalidRequiresAttribute); diff --git a/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/XmlWrappingReader.cs b/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/XmlWrappingReader.cs index 9d154b7ea91..81667cc10fa 100644 --- a/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/XmlWrappingReader.cs +++ b/src/Microsoft.DotNet.Wpf/src/Shared/System/Windows/Markup/XmlWrappingReader.cs @@ -136,7 +136,7 @@ string IXmlNamespaceResolver.LookupPrefix( string namespaceName ) return (_readerAsResolver is null) ? null : _readerAsResolver.LookupPrefix( namespaceName ); } - IDictionary IXmlNamespaceResolver.GetNamespacesInScope ( XmlNamespaceScope scope ) + IDictionary IXmlNamespaceResolver.GetNamespacesInScope ( XmlNamespaceScope scope ) { return (_readerAsResolver is null) ? null : _readerAsResolver.GetNamespacesInScope( scope ); } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/GlobalSuppressions.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/GlobalSuppressions.cs index 0628b1be9af..556df996d78 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/GlobalSuppressions.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/GlobalSuppressions.cs @@ -28,7 +28,7 @@ // New since v4 RTM: -//this is used by subclasses, bad FxCop detection +// this is used by subclasses, bad FxCop detection [assembly: SuppressMessage("Microsoft.Performance", "CA1812:AvoidUninstantiatedInternalClasses", Scope = "type", Target = "System.Xaml.MS.Impl.FrugalObjectList`1+Compacter", Justification = "Non-Breaking")] #endregion diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/NameReferenceConverter.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/NameReferenceConverter.cs index e54540af43d..3440e6949c3 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/NameReferenceConverter.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/NameReferenceConverter.cs @@ -33,7 +33,7 @@ public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo c } string name = value as string; - if (String.IsNullOrEmpty(name)) + if (string.IsNullOrEmpty(name)) { throw new InvalidOperationException(SR.MustHaveName); } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/Reference.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/Reference.cs index 025c638cdd2..e69cfe43cbe 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/Reference.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/Reference.cs @@ -32,7 +32,7 @@ public override object ProvideValue(IServiceProvider serviceProvider) throw new InvalidOperationException(SR.MissingNameResolver); } - if (String.IsNullOrEmpty(Name)) + if (string.IsNullOrEmpty(Name)) { throw new InvalidOperationException(SR.MustHaveName); } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/StaticExtension.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/StaticExtension.cs index ccfd9487a11..ac809630501 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/StaticExtension.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/StaticExtension.cs @@ -138,7 +138,7 @@ private bool GetFieldOrPropertyValue(Type type, string name, out object value) PropertyInfo prop = currentType.GetProperty(name, BindingFlags.Public | BindingFlags.Static); if (prop is not null) { - value = prop.GetValue(null,null); + value = prop.GetValue(null, null); return true; } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/XmlLangPropertyAttribute.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/XmlLangPropertyAttribute.cs index ee5b028bd73..b798175fc24 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/XmlLangPropertyAttribute.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Windows/Markup/XmlLangPropertyAttribute.cs @@ -10,7 +10,7 @@ namespace System.Windows.Markup /// An attribute that specifies which property the xml:lang value should /// be directed to. /// Example: - // [XmlLangProperty("Language")] + // [XmlLangProperty("Language")] // public class ExampleFrameworkElement // // Means that when the parser sees: diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/NameFixupGraph.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/NameFixupGraph.cs index a22242f176f..3413098b74e 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/NameFixupGraph.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/NameFixupGraph.cs @@ -35,7 +35,7 @@ internal class NameFixupGraph // and remove those dependencies. But we still want to be able to inform MEs/TCs that // the named objects they're getting aren't actually fully initialized. So we save this list // of incompletely initialized objects at the point we start completing references. - HashSet _uninitializedObjectsAtParseEnd; + HashSet _uninitializedObjectsAtParseEnd; public NameFixupGraph() { diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/NameFixupToken.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/NameFixupToken.cs index 8f7f0c9c9d5..04f234936f1 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/NameFixupToken.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/NameFixupToken.cs @@ -158,7 +158,7 @@ public List NameScopeDictionaryList get { return _nameScopeDictionaryList; } } - public List NeededNames + public List NeededNames { get { return _names; } } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/ObjectWriterContext.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/ObjectWriterContext.cs index 4b9d592f4ce..0c851e12c0c 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/ObjectWriterContext.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/ObjectWriterContext.cs @@ -215,7 +215,7 @@ internal XamlObjectWriterSettings ServiceProvider_GetSettings() // ----- abstracts overriden from XamlContext. - public override void AddNamespacePrefix(String prefix, string xamlNS) + public override void AddNamespacePrefix(string prefix, string xamlNS) { _stack.CurrentFrame.AddNamespace(prefix, xamlNS); } @@ -768,7 +768,7 @@ public object RootInstance { get { - //evaluate if _rootInstance should just always look at _rootFrame.Instance instead of caching an instance + // evaluate if _rootInstance should just always look at _rootFrame.Instance instead of caching an instance if (_rootInstance is null) { ObjectWriterFrame rootFrame = GetTopFrame(); diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/SavedContext.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/SavedContext.cs index b8a20347de3..15b359cc283 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/SavedContext.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/SavedContext.cs @@ -18,7 +18,7 @@ internal class XamlSavedContext public XamlSavedContext(SavedContextType savedContextType, ObjectWriterContext owContext, XamlContextStack stack) { - //We should harvest all information necessary from the xamlContext so that we can answer all ServiceProvider based questions. + // We should harvest all information necessary from the xamlContext so that we can answer all ServiceProvider based questions. _savedContextType = savedContextType; _context = owContext.SchemaContext; _stack = stack; diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlContext.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlContext.cs index 12cf2f91522..6fd0d12ed66 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlContext.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlContext.cs @@ -149,7 +149,7 @@ public string GetAttributeNamespace(XamlPropertyName propName, string tagNamespa // If prefix is "" then // Normal Properties resolve to the ownerType namespace // Attachable properties resolve to the actual "" namespace - if (String.IsNullOrEmpty(propName.Prefix) && !propName.IsDotted) + if (string.IsNullOrEmpty(propName.Prefix) && !propName.IsDotted) { ns = tagNamespace; } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlParserContext.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlParserContext.cs index 37c0c1e12be..41363e20fdd 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlParserContext.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Context/XamlParserContext.cs @@ -29,12 +29,12 @@ public XamlParserContext(XamlSchemaContext schemaContext, Assembly localAssembly // ----- abstracts overriden from XamlContext. - public override void AddNamespacePrefix(String prefix, string xamlNS) + public override void AddNamespacePrefix(string prefix, string xamlNS) { _prescopeNamespaces.Add(prefix, xamlNS); } - public string FindNamespaceByPrefixInParseStack(String prefix) + public string FindNamespaceByPrefixInParseStack(string prefix) { string xamlNs; @@ -60,7 +60,7 @@ public string FindNamespaceByPrefixInParseStack(String prefix) return null; } - public override string FindNamespaceByPrefix(String prefix) + public override string FindNamespaceByPrefix(string prefix) { // For proper operation of some corner senarios the XmlNamespaceResolver // must be set. But if it isn't we fall back to a look in our own stack. @@ -185,10 +185,10 @@ internal void InitLongestConstructor(XamlType xamlType) } // FxCop says this is never called - //public int Depth - //{ + // public int Depth + // { // get { return _stack.Depth; } - //} + // } public XamlType CurrentType { @@ -229,10 +229,10 @@ public bool CurrentInContainerDirective } // FxCop says this is not called - //public XamlType ParentType - //{ + // public XamlType ParentType + // { // get { return _stack.PreviousFrame.XamlType; } - //} + // } public XamlMember CurrentMember { @@ -241,10 +241,10 @@ public XamlMember CurrentMember } // FxCop says this is not called - //public XamlProperty MemberProperty - //{ + // public XamlProperty MemberProperty + // { // get { return _stack.PreviousFrame.Member; } - //} + // } public int CurrentArgCount { diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriter.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriter.cs index c45091476d7..aeafe4514aa 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriter.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriter.cs @@ -69,8 +69,8 @@ internal XamlObjectWriter(XamlSavedContext savedContext, XamlObjectWriterSetting void Initialize(XamlSchemaContext schemaContext, XamlSavedContext savedContext, XamlObjectWriterSettings settings) { _inDispose = false; - //ObjectWriter must be passed in a non-null SchemaContext. We check that here, since the CreateContext method - //will create one if a null SchemaContext was passed in. + // ObjectWriter must be passed in a non-null SchemaContext. We check that here, since the CreateContext method + // will create one if a null SchemaContext was passed in. ArgumentNullException.ThrowIfNull(schemaContext); if (savedContext is not null && schemaContext != savedContext.SchemaContext) { @@ -285,7 +285,7 @@ public override void WriteGetObject() // Real processing begins here. // - //The first node (T, SO, or EP) after an EndObject should null out _lastInstance. + // The first node (T, SO, or EP) after an EndObject should null out _lastInstance. _lastInstance = null; // A Frame is pushed by either a AddNamespace or a WriteGet/StartObject @@ -352,7 +352,7 @@ public override void WriteStartObject(XamlType xamlType) // Real processing begins here. // - //The first node (T, SO, or EP) after an EndObject should null out _lastInstance. + // The first node (T, SO, or EP) after an EndObject should null out _lastInstance. _lastInstance = null; // A Frame is pushed by either a AddNamespace or a WriteGet/StartObject @@ -723,7 +723,7 @@ public override void WriteEndMember() // _nextNodeMustBeEndMember = false; - //The first node (T, SO, or EP) after an EndObject should null out _lastInstance. + // The first node (T, SO, or EP) after an EndObject should null out _lastInstance. _lastInstance = null; if (property == XamlLanguage.Arguments) @@ -851,7 +851,7 @@ public override void WriteValue(object value) throw _context.WithLineInfo(new XamlObjectWriterException(err)); } - //The first node (T, SO, or EP) after an EndObject should null out _lastInstance. + // The first node (T, SO, or EP) after an EndObject should null out _lastInstance. _lastInstance = null; _context.PushScope(); @@ -1013,8 +1013,8 @@ public XAML3.INameScope RootNameScope } } - //Result should return the _lastInstance when called after an EO. Otherwise, it should return null. - //Currently we null out _lastInstance in the nodes that can come after EO (T, SO, EP). Can an NS come, + // Result should return the _lastInstance when called after an EO. Otherwise, it should return null. + // Currently we null out _lastInstance in the nodes that can come after EO (T, SO, EP). Can an NS come, // what should we do? public virtual object Result { @@ -2014,7 +2014,7 @@ private void Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx) if (value is NameFixupToken && parentProperty != XamlLanguage.Items) { NameFixupToken token = value as NameFixupToken; - string names = String.Join(',', token.NeededNames.ToArray()); + string names = string.Join(',', token.NeededNames.ToArray()); string msg = SR.Format(SR.ForwardRefDirectives, names); throw ctx.WithLineInfo(new XamlObjectWriterException(msg)); } @@ -2054,7 +2054,7 @@ private void Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx) // Only the key directive may be assigned a reference. if (parentProperty != XamlLanguage.Key) { - string names = String.Join(',', token.NeededNames.ToArray()); + string names = string.Join(',', token.NeededNames.ToArray()); string msg = SR.Format(SR.ForwardRefDirectives, names); throw ctx.WithLineInfo(new XamlObjectWriterException(msg)); } @@ -2108,7 +2108,7 @@ private void Logic_DoAssignmentToParentProperty(ObjectWriterContext ctx) if (parentProperty != XamlLanguage.Key) { NameFixupToken token = (NameFixupToken)value; - string names = String.Join(',', token.NeededNames.ToArray()); + string names = string.Join(',', token.NeededNames.ToArray()); string msg = SR.Format(SR.ForwardRefDirectives, names); throw ctx.WithLineInfo(new XamlObjectWriterException(msg)); } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriterSettings.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriterSettings.cs index 258afdf9dad..535fc66a18d 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriterSettings.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlObjectWriterSettings.cs @@ -42,7 +42,7 @@ public XamlObjectWriterSettings(XamlObjectWriterSettings settings) public EventHandler AfterEndInitHandler { get; set; } public EventHandler XamlSetValueHandler { get; set; } - public Object RootObjectInstance { get; set; } + public object RootObjectInstance { get; set; } public bool IgnoreCanConvert { get; set; } public INameScope ExternalNameScope { get; set; } public bool SkipDuplicatePropertyCheck { get; set; } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlReaderSettings.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlReaderSettings.cs index 88bda501b8a..8f661aec53b 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlReaderSettings.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlReaderSettings.cs @@ -37,7 +37,7 @@ public XamlReaderSettings(XamlReaderSettings settings) : this() private void InitializeProvideLineInfo() { - //By default, _provideLineInfo is true if the currently executing process is running in debug mode + // By default, _provideLineInfo is true if the currently executing process is running in debug mode if (Debugger.IsAttached) { ProvideLineInfo = true; diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlXmlReader.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlXmlReader.cs index a21eed85a60..cf349e8fd21 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlXmlReader.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/InfosetObjects/XamlXmlReader.cs @@ -163,7 +163,7 @@ private void Initialize(XmlReader givenXmlReader, XamlSchemaContext schemaContex XmlReader myXmlReader; _mergedSettings = (settings is null) ? new XamlXmlReaderSettings() : new XamlXmlReaderSettings(settings); - //Wrap the xmlreader with a XmlCompatReader instance to apply MarkupCompat rules. + // Wrap the xmlreader with a XmlCompatReader instance to apply MarkupCompat rules. if (!_mergedSettings.SkipXmlCompatibilityProcessing) { XmlCompatibilityReader mcReader = @@ -174,14 +174,14 @@ private void Initialize(XmlReader givenXmlReader, XamlSchemaContext schemaContex myXmlReader = mcReader; } else - { //Don't wrap the xmlreader with XmlCompatReader. + { // Don't wrap the xmlreader with XmlCompatReader. // Useful for uses where users want to keep mc: content in the XamlNode stream. // Or have already processed the markup compat and want that extra perf. myXmlReader = givenXmlReader; } // Pick up the XmlReader settings to override the "settings" defaults. - if (!String.IsNullOrEmpty(myXmlReader.BaseURI)) + if (!string.IsNullOrEmpty(myXmlReader.BaseURI)) { _mergedSettings.BaseUri = new Uri(myXmlReader.BaseURI); } @@ -191,7 +191,7 @@ private void Initialize(XmlReader givenXmlReader, XamlSchemaContext schemaContex _mergedSettings.XmlSpacePreserve = true; } - if (!String.IsNullOrEmpty(myXmlReader.XmlLang)) + if (!string.IsNullOrEmpty(myXmlReader.XmlLang)) { _mergedSettings.XmlLang = myXmlReader.XmlLang; } @@ -348,7 +348,7 @@ internal bool IsXmlNamespaceSupported(string xmlNamespace, out string newXmlName { string clrNs, assemblyName; if (ClrNamespaceUriParser.TryParseUri(xmlNamespace, out clrNs, out assemblyName) && - String.IsNullOrEmpty(assemblyName)) + string.IsNullOrEmpty(assemblyName)) { assemblyName = _mergedSettings.LocalAssembly.FullName; newXmlNamespace = ClrNamespaceUriParser.GetUri(clrNs, assemblyName); @@ -364,13 +364,13 @@ internal bool IsXmlNamespaceSupported(string xmlNamespace, out string newXmlName // we need to treat all namespaces inside of XmlDataIslands as Supported. // we need to tree Freeze as known, if it is around... don't hardcode. - //else if (xmlNamespace == XamlReaderHelper.PresentationOptionsNamespaceURI) - //{ + // else if (xmlNamespace == XamlReaderHelper.PresentationOptionsNamespaceURI) + // { // // PresentationOptions is expected to be marked as 'ignorable' in most Xaml // // so that other Xaml parsers don't have to interpret it, but this parser // // does handle it to support it's Freeze attribute. // return true; - //} + // } return result; } } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/AssemblyNamespacePair.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/AssemblyNamespacePair.cs index 474c63fd1fa..9fc0c0b70af 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/AssemblyNamespacePair.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/AssemblyNamespacePair.cs @@ -12,9 +12,9 @@ namespace System.Xaml.MS.Impl internal class AssemblyNamespacePair { WeakReference _assembly; - String _clrNamespace; + string _clrNamespace; - public AssemblyNamespacePair(Assembly asm, String clrNamespace) + public AssemblyNamespacePair(Assembly asm, string clrNamespace) { _assembly = new WeakReference(asm); _clrNamespace = clrNamespace; diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/XmlNsInfo.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/XmlNsInfo.cs index 95e18fecdc0..be558a9ee72 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/XmlNsInfo.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/MS/Impl/XmlNsInfo.cs @@ -192,7 +192,7 @@ IList LoadNsDefs() void LoadNsDefHelper(IList result, string xmlns, string clrns, Assembly assembly) { - if (String.IsNullOrEmpty(xmlns) || clrns is null) + if (string.IsNullOrEmpty(xmlns) || clrns is null) { throw new XamlSchemaException(SR.Format(SR.BadXmlnsDefinition, assembly.FullName)); } @@ -339,7 +339,7 @@ Dictionary LoadOldToNewNs() void LoadOldToNewNsHelper(Dictionary result, string oldns, string newns, Assembly assembly) { - if (String.IsNullOrEmpty(newns) || String.IsNullOrEmpty(oldns)) + if (string.IsNullOrEmpty(newns) || string.IsNullOrEmpty(oldns)) { throw new XamlSchemaException(SR.Format(SR.BadXmlnsCompat, assembly.FullName)); } @@ -391,7 +391,7 @@ Dictionary LoadPrefixes() void LoadPrefixesHelper(Dictionary result, string xmlns, string prefix, Assembly assembly) { - if (String.IsNullOrEmpty(prefix) || String.IsNullOrEmpty(xmlns)) + if (string.IsNullOrEmpty(prefix) || string.IsNullOrEmpty(xmlns)) { throw new XamlSchemaException(SR.Format(SR.BadXmlnsPrefix, assembly.FullName)); } @@ -455,7 +455,7 @@ public NamespaceComparer(XmlNsInfo nsInfo, Assembly assembly) _nsInfo = nsInfo; // Calculate the subsume count upfront, since this also serves as our cycle detection - _subsumeCount = new Dictionary(nsInfo.OldToNewNs.Count); + _subsumeCount = new Dictionary(nsInfo.OldToNewNs.Count); HashSet visited = new HashSet(); diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/NameScopeDictionary.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/NameScopeDictionary.cs index 01329efacbe..73243f2b4e1 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/NameScopeDictionary.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/NameScopeDictionary.cs @@ -164,7 +164,7 @@ public KeyValuePair Current if (_underlyingNameScope is not null) { string name = _names[index]; - return new KeyValuePair(name, _underlyingNameScope.FindName(name)); + return new KeyValuePair(name, _underlyingNameScope.FindName(name)); } else { diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/NameValidationHelper.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/NameValidationHelper.cs index a760793ee71..a0b2fa365bc 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/NameValidationHelper.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/NameValidationHelper.cs @@ -32,7 +32,7 @@ internal static bool IsValidIdentifierName(string name) UnicodeCategory uc; for (int i = 0; i < name.Length; i++) { - uc = Char.GetUnicodeCategory(name[i]); + uc = char.GetUnicodeCategory(name[i]); bool idStart = (uc == UnicodeCategory.UppercaseLetter || // (Lu) uc == UnicodeCategory.LowercaseLetter || // (Ll) uc == UnicodeCategory.TitlecaseLetter || // (Lt) diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/GenericTypeNameParser.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/GenericTypeNameParser.cs index a30d7a49fa9..d9fa7bb8bf4 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/GenericTypeNameParser.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/GenericTypeNameParser.cs @@ -56,7 +56,7 @@ public static XamlTypeName ParseIfTrivalName(string text, Func p } string ns = prefixResolver(prefix); - if (String.IsNullOrEmpty(ns)) + if (string.IsNullOrEmpty(ns)) { error = SR.Format(SR.PrefixNotFound, prefix); return null; @@ -89,7 +89,7 @@ public XamlTypeName ParseName(string text, out string error) } XamlTypeName typeName = null; - if (String.IsNullOrEmpty(error)) + if (string.IsNullOrEmpty(error)) { typeName = CollectNameFromStack(); } @@ -119,7 +119,7 @@ public IList ParseList(string text, out string error) } IList typeNameList = null; - if (String.IsNullOrEmpty(error)) + if (string.IsNullOrEmpty(error)) { typeNameList = CollectNameListFromStack(); } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/GenericTypeNameScanner.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/GenericTypeNameScanner.cs index 0f76c5d8ef3..83c67646a21 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/GenericTypeNameScanner.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/GenericTypeNameScanner.cs @@ -145,7 +145,7 @@ internal static int ParseSubscriptSegment(string subscript, ref int pos) pos++; } while (pos < subscript.Length); - //unterminated string + // unterminated string return 0; } @@ -337,7 +337,7 @@ internal class Sample_StringParserBase { protected const char NullChar = '\0'; - protected String _inputText; + protected string _inputText; protected int _idx; public Sample_StringParserBase(string text) diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/MePullParser.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/MePullParser.cs index f77cf2424d6..6b3a2acd2d3 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/MePullParser.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/MePullParser.cs @@ -65,7 +65,7 @@ public IEnumerable Parse(string text, int lineNumber, int linePosition private void SetBrokenRuleString(string ruleString) { - if (String.IsNullOrEmpty(_brokenRule)) + if (string.IsNullOrEmpty(_brokenRule)) { _brokenRule = SR.Format(SR.UnexpectedToken, _tokenizer.Token, ruleString, _originalText); @@ -215,10 +215,10 @@ private IEnumerable P_PositionalArgs(Found f) { Found f2 = new Found(); - // PositionalArgs ::= @ (Value (',' PositionalArgs)?) | NamedArg + // PositionalArgs ::= @ (Value (',' PositionalArgs)?) | NamedArg switch (_tokenizer.Token) { - // PositionalArgs ::= ( @ Value (',' PositionalArgs)?) | NamedArg + // PositionalArgs ::= ( @ Value (',' PositionalArgs)?) | NamedArg case MeTokenType.String: case MeTokenType.QuotedMarkupExtension: case MeTokenType.Open: @@ -240,15 +240,15 @@ private IEnumerable P_PositionalArgs(Found f) f.found = f2.found; - // PositionalArgs ::= (Value @ (',' PositionalArgs)?) | NamedArg + // PositionalArgs ::= (Value @ (',' PositionalArgs)?) | NamedArg if (_tokenizer.Token == MeTokenType.Comma) { Found f3 = new Found(); - // PositionalArgs ::= (Value ( @ ',' PositionalArgs)?) | NamedArg + // PositionalArgs ::= (Value ( @ ',' PositionalArgs)?) | NamedArg NextToken(); - // PositionalArgs ::= (Value (',' @ PositionalArgs)?) | NamedArg + // PositionalArgs ::= (Value (',' @ PositionalArgs)?) | NamedArg foreach (XamlNode node in P_PositionalArgs(f3)) { yield return node; @@ -265,7 +265,7 @@ private IEnumerable P_PositionalArgs(Found f) break; - // PositionalArgs ::= (Value (',' PositionalArgs)?) | @ NamedArg + // PositionalArgs ::= (Value (',' PositionalArgs)?) | @ NamedArg case MeTokenType.PropertyName: if (_context.CurrentArgCount > 0) { @@ -337,17 +337,17 @@ private IEnumerable P_Value(Found f) { Found f2 = new Found(); - // Value ::= @(STRING | QUOTEDMARKUPEXTENSION | MarkupExtension) + // Value ::= @(STRING | QUOTEDMARKUPEXTENSION | MarkupExtension) switch (_tokenizer.Token) { - // Value ::= (@STRING | QUOTEDMARKUPEXTENSION | MarkupExtension) + // Value ::= (@STRING | QUOTEDMARKUPEXTENSION | MarkupExtension) case MeTokenType.String: yield return Logic_Text(); f.found = true; NextToken(); break; - // Value ::= (STRING | @QUOTEDMARKUPEXTENSION | MarkupExtension) + // Value ::= (STRING | @QUOTEDMARKUPEXTENSION | MarkupExtension) case MeTokenType.QuotedMarkupExtension: MePullParser nestedParser = new MePullParser(_context); foreach (XamlNode node in nestedParser.Parse(_tokenizer.TokenText, LineNumber, LinePosition)) @@ -359,7 +359,7 @@ private IEnumerable P_Value(Found f) NextToken(); break; - // Value ::= (STRING | QUOTEDMARKUPEXTENSION | @MarkupExtension) + // Value ::= (STRING | QUOTEDMARKUPEXTENSION | @MarkupExtension) case MeTokenType.Open: foreach (XamlNode node in P_MarkupExtension(f2)) { diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/NodeStreamSorter.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/NodeStreamSorter.cs index c9e88f76886..98ec1e8372e 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/NodeStreamSorter.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/NodeStreamSorter.cs @@ -233,7 +233,7 @@ private void EnqueueInitialXmlState() EnqueueOneXmlDirectiveProperty(XamlLanguage.Space, KnownStrings.Preserve); } - if (!String.IsNullOrEmpty(_settings.XmlLang)) + if (!string.IsNullOrEmpty(_settings.XmlLang)) { EnqueueOneXmlDirectiveProperty(XamlLanguage.Lang, _settings.XmlLang); } @@ -276,7 +276,7 @@ private void ReadAheadAndSortCtorProperties() // If we saw TypeArguments, Arguments, or FactoryMethod properties. // then dig in and correct the stream. // - //if (HaveSeenOutOfOrderCtorDirective) + // if (HaveSeenOutOfOrderCtorDirective) if(_moveList is not null) { SortContentsOfReadAheadBuffer(); @@ -494,7 +494,7 @@ private void BuildSortingBuffer() // Build an array with the info we need _sortingInfoArray = new ReorderInfo[_originalNodesInOrder.Length]; int depth = 0; - ReorderInfo rInfo = new ReorderInfo(); + ReorderInfo rInfo = default(ReorderInfo); for (int i = 0; i < _originalNodesInOrder.Length; i++) { diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlAttribute.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlAttribute.cs index 151ee956ea8..7eec95b87de 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlAttribute.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlAttribute.cs @@ -94,10 +94,10 @@ public void Initialize(XamlParserContext context, XamlType tagType, string owner } // FxCop says this is not called - //public bool IsXamlNsDefinition - //{ + // public bool IsXamlNsDefinition + // { // get { return (!String.IsNullOrEmpty(_xmlnsDefinitionUri)); } - //} + // } // These properties are only defined if this Xml-Attribute is a XmlNs definition. public string XmlNsPrefixDefined @@ -110,7 +110,7 @@ public string XmlNsUriDefined get { return _xmlnsDefinitionUri; } } - // ========================== internal ================================ + // ========================== internal ================================ internal bool CheckIsXmlNamespaceDefinition(out string definingPrefix, out string uri) { @@ -128,7 +128,7 @@ internal bool CheckIsXmlNamespaceDefinition(out string definingPrefix, out strin } // case where: xmlns="ValueUri" - if (String.IsNullOrEmpty(Name.Prefix) && KS.Eq(Name.Name, KnownStrings.XmlNsPrefix)) + if (string.IsNullOrEmpty(Name.Prefix) && KS.Eq(Name.Name, KnownStrings.XmlNsPrefix)) { uri = Value; definingPrefix = string.Empty; @@ -138,7 +138,7 @@ internal bool CheckIsXmlNamespaceDefinition(out string definingPrefix, out strin return false; } - // ========================== private ================================ + // ========================== private ================================ private XamlMember GetXamlAttributeProperty(XamlParserContext context, XamlPropertyName propName, XamlType tagType, string tagNamespace, bool tagIsRoot) diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlPropertyName.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlPropertyName.cs index 6413317c19e..228a1749788 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlPropertyName.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlPropertyName.cs @@ -24,7 +24,7 @@ private XamlPropertyName(XamlName owner, string prefix, string name) public static XamlPropertyName Parse(string longName) { - if(String.IsNullOrEmpty(longName)) + if(string.IsNullOrEmpty(longName)) { return null; } @@ -45,7 +45,7 @@ public static XamlPropertyName Parse(string longName) { owner = dottedName.Substring(start, dotIdx); - if (String.IsNullOrEmpty(owner)) + if (string.IsNullOrEmpty(owner)) { return null; } @@ -56,7 +56,7 @@ public static XamlPropertyName Parse(string longName) string name = (start == 0) ? dottedName : dottedName.Substring(start); XamlQualifiedName ownerName = null; - if (!String.IsNullOrEmpty(owner)) + if (!string.IsNullOrEmpty(owner)) { ownerName = new XamlQualifiedName(prefix, owner); } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlPullParser.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlPullParser.cs index 41a5d5e0121..0bfb9ef2943 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlPullParser.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlPullParser.cs @@ -26,7 +26,7 @@ public XamlPullParser(XamlParserContext context, XamlScanner scanner, XamlXmlRea // ===================================================== - // Document ::= PREFIXDEFINITION* Element + // Document ::= PREFIXDEFINITION* Element // Element ::= EmptyElement | (StartElement ElementBody) // EmptyElement ::= EMPTYELEMENT DIRECTIVE* ATTRIBUTE* // StartElement ::= ELEMENT DIRECTIVE* @@ -970,7 +970,7 @@ private XamlNode Logic_StartItemsProperty(XamlType collectionType) _context.CurrentInContainerDirective = true; var startProperty = new XamlNode(XamlNodeType.StartMember, XamlLanguage.Items); - //SetLineInfo(startProperty); // No line number info for implicit properties. + // SetLineInfo(startProperty); // No line number info for implicit properties. return startProperty; } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlQualifiedName.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlQualifiedName.cs index 8ccd79d56d2..b6b45caef62 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlQualifiedName.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlQualifiedName.cs @@ -81,7 +81,7 @@ public static bool Parse(string longName, out string prefix, out string name) { prefix = longName.Substring(start, colonIdx); - if (String.IsNullOrEmpty(prefix) || !IsNameValid(prefix)) + if (string.IsNullOrEmpty(prefix) || !IsNameValid(prefix)) { return false; } @@ -94,7 +94,7 @@ public static bool Parse(string longName, out string prefix, out string name) // we allow Internal type name (ie. Foo+Bar) on "trival" ie. "non-generic" type names. // This is back compat with 3.0. // Don't want to allow it in any of the new type name syntax. (including trival typeArgs) - if (String.IsNullOrEmpty(name) || !IsNameValid_WithPlus(name)) + if (string.IsNullOrEmpty(name) || !IsNameValid_WithPlus(name)) { return false; } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlScanner.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlScanner.cs index db595df6734..fa1758f717f 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlScanner.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlScanner.cs @@ -40,7 +40,7 @@ class XamlScanner internal XamlScanner(XamlParserContext context, XmlReader xmlReader, XamlXmlReaderSettings settings) { _xmlReader = xmlReader; - _xmlLineInfo = settings.ProvideLineInfo ? (xmlReader as IXmlLineInfo) : null; //consider removing the "settings" check + _xmlLineInfo = settings.ProvideLineInfo ? (xmlReader as IXmlLineInfo) : null; // consider removing the "settings" check _parserContext = context; diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlText.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlText.cs index 1bf83ba8229..251cce8599d 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlText.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Parser/XamlText.cs @@ -12,13 +12,13 @@ namespace MS.Internal.Xaml.Parser [DebuggerDisplay("{Text}")] internal class XamlText { - private const Char SPACE = ' '; - private const Char NEWLINE = '\n'; - private const Char RETURN = '\r'; - private const Char TAB = '\t'; - private const Char OPENCURLIE = '{'; - private const Char CLOSECURLIE = '}'; - private const String ME_ESCAPE = "{}"; + private const char SPACE = ' '; + private const char NEWLINE = '\n'; + private const char RETURN = '\r'; + private const char TAB = '\t'; + private const char OPENCURLIE = '{'; + private const char CLOSECURLIE = '}'; + private const string ME_ESCAPE = "{}"; private const string RETURN_STRING = "\r"; private StringBuilder _sb; @@ -53,7 +53,7 @@ public string AttributeText { get { - String text = Text; + string text = Text; if (text.StartsWith(ME_ESCAPE, false, TypeConverterHelper.InvariantEnglishUS)) { return text.Remove(0, ME_ESCAPE.Length); @@ -191,7 +191,7 @@ static bool IsWhitespace(string text) return true; } - static bool IsWhitespaceChar(Char ch) + static bool IsWhitespaceChar(char ch) { return (ch == SPACE || ch == TAB || ch == NEWLINE || ch == RETURN); } @@ -307,11 +307,11 @@ static int ComputeUnicodeScalarValue(int takeOneIdx, int takeTwoIdx, string text int unicodeScalarValue=0; bool isSurrogate = false; - Char highChar = text[takeTwoIdx]; - if (Char.IsHighSurrogate(highChar)) + char highChar = text[takeTwoIdx]; + if (char.IsHighSurrogate(highChar)) { - Char lowChar = text[takeTwoIdx + 1]; - if (Char.IsLowSurrogate(lowChar)) + char lowChar = text[takeTwoIdx + 1]; + if (char.IsLowSurrogate(lowChar)) { isSurrogate = true; unicodeScalarValue = (((highChar & 0x03FF) << 10) | (lowChar & 0x3FF)) + 0x1000; diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/RefOnly/LooseTypeExtensions.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/RefOnly/LooseTypeExtensions.cs index fdb4d219a59..100326f7d86 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/RefOnly/LooseTypeExtensions.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/RefOnly/LooseTypeExtensions.cs @@ -133,7 +133,7 @@ static bool IsLooseSubClassOf(Type t1, Type t2) if (AssemblyQualifiedNameEquals(t1, t2)) { - return false; //strictly testing for sub-class + return false; // strictly testing for sub-class } for(Type baseType = t1.BaseType; baseType is not null; baseType = baseType.BaseType) diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/ClrObjectRuntime.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/ClrObjectRuntime.cs index 164db6c1005..061426ac968 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/ClrObjectRuntime.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/ClrObjectRuntime.cs @@ -144,7 +144,7 @@ protected MethodBase BindToMethod(BindingFlags bindingFlags, MethodBase[] candid bindingFlags, candidates, ref args, null, null, null, out _); } - //CreateFromValue is expected to convert the provided value via any applicable converter (on property or type) or provide the original value if there is no converter + // CreateFromValue is expected to convert the provided value via any applicable converter (on property or type) or provide the original value if there is no converter public override object CreateFromValue( ServiceProviderContext serviceContext, XamlValueConverter ts, object value, @@ -667,7 +667,7 @@ private object CreateObjectWithTypeConverter(ServiceProviderContext serviceConte object obj; if (typeConverter is not null) { - //We sometimes ignoreCanConvert for WPFv3 Compatibility (but only if a string is coming in) + // We sometimes ignoreCanConvert for WPFv3 Compatibility (but only if a string is coming in) if (_ignoreCanConvert && value.GetType() == typeof(string)) { obj = typeConverter.ConvertFrom(serviceContext, TypeConverterHelper.InvariantEnglishUS, value); @@ -680,14 +680,14 @@ private object CreateObjectWithTypeConverter(ServiceProviderContext serviceConte } else { - //let the value passthrough (to be set as the property value later). + // let the value passthrough (to be set as the property value later). obj = value; } } } else { - //let the value passthrough (to be set as the property value later). + // let the value passthrough (to be set as the property value later). obj = value; } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/DynamicMethodRuntime.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/DynamicMethodRuntime.cs index a961345c19b..48d75bc686a 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/DynamicMethodRuntime.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Runtime/DynamicMethodRuntime.cs @@ -156,7 +156,7 @@ public override TConverterBase GetConverterInstance(XamlValueCon return (TConverterBase)result; } - //CreateFromValue is expected to convert the provided value via any applicable converter (on property or type) or provide the original value if there is no converter + // CreateFromValue is expected to convert the provided value via any applicable converter (on property or type) or provide the original value if there is no converter public override object CreateFromValue( ServiceProviderContext serviceContext, XamlValueConverter ts, object value, @@ -567,7 +567,7 @@ private static void Emit_ConstInt(ILGenerator ilGenerator, int value) private void Emit_LateBoundInvoke(ILGenerator ilGenerator, Type targetType, string methodName, BindingFlags bindingFlags, short targetArgNum, params short[] paramArgNums) { - //Emits: typeof(targetType).InvokeMember( + // Emits: typeof(targetType).InvokeMember( // methodName, bindingFlags, null, ldarg_targetArgNum, // new object[] { ldarg_paramArgNums }); diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/BuiltInValueConverter.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/BuiltInValueConverter.cs index 7c13c29017f..8e90d6e8124 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/BuiltInValueConverter.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/BuiltInValueConverter.cs @@ -80,67 +80,67 @@ internal static XamlValueConverter GetTypeConverter(Type targetTy return Object; } - if (typeof(Int32) == targetType) + if (typeof(int) == targetType) { return Int32; } - if (typeof(Int16) == targetType) + if (typeof(short) == targetType) { return s_Int16 ??= new BuiltInValueConverter(typeof(Int16Converter), () => new Int16Converter()); } - if (typeof(Int64) == targetType) + if (typeof(long) == targetType) { return s_Int64 ??= new BuiltInValueConverter(typeof(Int64Converter), () => new Int64Converter()); } - if (typeof(UInt32) == targetType) + if (typeof(uint) == targetType) { return s_UInt32 ??= new BuiltInValueConverter(typeof(UInt32Converter), () => new UInt32Converter()); } - if (typeof(UInt16) == targetType) + if (typeof(ushort) == targetType) { return s_UInt16 ??= new BuiltInValueConverter(typeof(UInt16Converter), () => new UInt16Converter()); } - if (typeof(UInt64) == targetType) + if (typeof(ulong) == targetType) { return s_UInt64 ??= new BuiltInValueConverter(typeof(UInt64Converter), () => new UInt64Converter()); } - if (typeof(Boolean) == targetType) + if (typeof(bool) == targetType) { return s_Boolean ??= new BuiltInValueConverter(typeof(BooleanConverter), () => new BooleanConverter()); } - if (typeof(Double) == targetType) + if (typeof(double) == targetType) { return s_Double ??= new BuiltInValueConverter(typeof(DoubleConverter), () => new DoubleConverter()); } - if (typeof(Single) == targetType) + if (typeof(float) == targetType) { return s_Single ??= new BuiltInValueConverter(typeof(SingleConverter), () => new SingleConverter()); } - if (typeof(Byte) == targetType) + if (typeof(byte) == targetType) { return s_Byte ??= new BuiltInValueConverter(typeof(ByteConverter), () => new ByteConverter()); } - if (typeof(SByte) == targetType) + if (typeof(sbyte) == targetType) { return s_SByte ??= new BuiltInValueConverter(typeof(SByteConverter), () => new SByteConverter()); } - if (typeof(Char) == targetType) + if (typeof(char) == targetType) { return s_Char ??= new BuiltInValueConverter(typeof(CharConverter), () => new CharConverter()); } - if (typeof(Decimal) == targetType) + if (typeof(decimal) == targetType) { return s_Decimal ??= new BuiltInValueConverter(typeof(DecimalConverter), () => new DecimalConverter()); } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/MemberReflector.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/MemberReflector.cs index c973e6bb97c..e18c07dde5f 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/MemberReflector.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/MemberReflector.cs @@ -115,7 +115,7 @@ internal bool ConstructorArgumentIsSet get { return _constructorArgument.IsSet; } } - internal IReadOnlyDictionary MarkupExtensionBracketCharactersArgument { get; set; } + internal IReadOnlyDictionary MarkupExtensionBracketCharactersArgument { get; set; } internal bool MarkupExtensionBracketCharactersArgumentIsSet { get; set; } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/Reflector.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/Reflector.cs index e0bc5cd3143..82ec57a9f67 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/Reflector.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/Reflector.cs @@ -137,7 +137,7 @@ public string GetAttributeString(Type attributeType, out bool checkedInherited) } } - public IReadOnlyDictionary GetBracketCharacterAttributes(Type attributeType) + public IReadOnlyDictionary GetBracketCharacterAttributes(Type attributeType) { if (CustomAttributeProvider is not null) { diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/TypeReflector.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/TypeReflector.cs index 306c2a6203a..48d180f9719 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/TypeReflector.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/TypeReflector.cs @@ -737,9 +737,9 @@ internal MethodInfo LookupAttachableEvent(string name) private void LookupAllStaticAccessors(out Dictionary> getters, out Dictionary> setters, out Dictionary> adders) { - getters = new Dictionary>(); - setters = new Dictionary>(); - adders = new Dictionary>(); + getters = new Dictionary>(); + setters = new Dictionary>(); + adders = new Dictionary>(); MethodInfo[] allMethods = UnderlyingType.GetMethods(AttachableProperties_BF); @@ -753,7 +753,7 @@ private void LookupAllStaticAccessors(out Dictionary> g } } - private void LookupAllStaticAccessorsHelper(MethodInfo[] allMethods, Dictionary> getters, + private void LookupAllStaticAccessorsHelper(MethodInfo[] allMethods, Dictionary> getters, Dictionary> setters, Dictionary> adders, bool isUnderlyingTypePublic) { foreach (MethodInfo method in allMethods) @@ -1133,7 +1133,7 @@ private enum TypeVisibility Public } - internal class ThreadSafeDictionary : Dictionary where V : class + internal class ThreadSafeDictionary : Dictionary where V : class { bool _isComplete; diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/XamlTypeInvoker.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/XamlTypeInvoker.cs index b83797db699..61089548954 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/XamlTypeInvoker.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/Schema/XamlTypeInvoker.cs @@ -260,7 +260,7 @@ private static class DefaultCtorXamlActivator { private static ThreeValuedBool s_securityFailureWithCtorDelegate; private static ConstructorInfo s_actionCtor = - typeof(Action).GetConstructor(new Type[] { typeof(Object), typeof(IntPtr) }); + typeof(Action).GetConstructor(new Type[] { typeof(object), typeof(IntPtr) }); public static object CreateInstance(XamlTypeInvoker type) { diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlBackgroundReader.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlBackgroundReader.cs index bbaea0517de..34d542c6bcc 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlBackgroundReader.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlBackgroundReader.cs @@ -74,7 +74,7 @@ private void Initialize(XamlReader wrappedReader, int bufferSize) _internalReader = new ReaderDelegate(_wrappedReader.SchemaContext, xamlNodeNextDelegate, _wrappedReaderHasLineInfo); - //Standin so it won't start null + // Standin so it won't start null _currentNode = new XamlNode(XamlNode.InternalNodeType.StartOfStream); } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlException.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlException.cs index ed37a805338..ca85e41de68 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlException.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlException.cs @@ -113,10 +113,10 @@ protected XamlParseException(SerializationInfo info, StreamingContext context) : base(info, context) { } // FxCop and [Serializable] required this. - //public override void GetObjectData(SerializationInfo info, StreamingContext context) - //{ + // public override void GetObjectData(SerializationInfo info, StreamingContext context) + // { // base.GetObjectData(info, context); - //} + // } } [Serializable] // FxCop advised this be Serializable. diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlLanguage.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlLanguage.cs index 6e31c423638..d57bcdd0481 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlLanguage.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlLanguage.cs @@ -101,17 +101,17 @@ public static class XamlLanguage new Lazy(() => GetXamlType(typeof(PositionalParameterDescriptor)), true); private static Lazy s_char = - new Lazy(() => GetXamlType(typeof(Char)), true); + new Lazy(() => GetXamlType(typeof(char)), true); private static Lazy s_single = - new Lazy(() => GetXamlType(typeof(Single)), true); + new Lazy(() => GetXamlType(typeof(float)), true); private static Lazy s_byte = - new Lazy(() => GetXamlType(typeof(Byte)), true); + new Lazy(() => GetXamlType(typeof(byte)), true); private static Lazy s_int16 = - new Lazy(() => GetXamlType(typeof(Int16)), true); + new Lazy(() => GetXamlType(typeof(short)), true); private static Lazy s_int64 = - new Lazy(() => GetXamlType(typeof(Int64)), true); + new Lazy(() => GetXamlType(typeof(long)), true); private static Lazy s_decimal = - new Lazy(() => GetXamlType(typeof(Decimal)), true); + new Lazy(() => GetXamlType(typeof(decimal)), true); private static Lazy s_uri = new Lazy(() => GetXamlType(typeof(Uri)), true); private static Lazy s_timespan = diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlMarkupExtensionWriter.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlMarkupExtensionWriter.cs index f35e91b18e4..f7ce28b32d8 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlMarkupExtensionWriter.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlMarkupExtensionWriter.cs @@ -212,7 +212,7 @@ public XamlType XamlType abstract class WriterState { - //according to the BNF, CharactersToEscape ::= ['",={}\] + // according to the BNF, CharactersToEscape ::= ['",={}\] static char[] specialChars = new char[] { '\'', '"', ',', '=', '{', '}', '\\', ' ' }; public virtual void WriteStartObject(XamlMarkupExtensionWriter writer, XamlType type) diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlMember.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlMember.cs index 89365268911..5f6a1a38d9b 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlMember.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlMember.cs @@ -389,7 +389,7 @@ public DesignerSerializationVisibility SerializationVisibility /// a property of a MarkupExtension as a ReadOnlyDictionary. Opening bracket is the /// key, while the value is the closing bracket. /// - public IReadOnlyDictionary MarkupExtensionBracketCharacters + public IReadOnlyDictionary MarkupExtensionBracketCharacters { get { @@ -740,7 +740,7 @@ protected virtual XamlValueConverter LookupValueSerializer() /// a property of a MarkupExtension as a ReadOnlyDictionary. Opening bracket is the /// key, while the value is the closing bracket. /// - protected virtual IReadOnlyDictionary LookupMarkupExtensionBracketCharacters() + protected virtual IReadOnlyDictionary LookupMarkupExtensionBracketCharacters() { if (AreAttributesAvailable) { diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlObjectReader.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlObjectReader.cs index 5a6e24f816c..6509691e513 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlObjectReader.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlObjectReader.cs @@ -288,14 +288,14 @@ public bool IsAttributable { get { - //Constructor arguments property + // Constructor arguments property if (XamlNode.Member == XamlLanguage.PositionalParameters) { foreach (var child in children) { if (child is ObjectMarkupInfo objectInfo && !objectInfo.IsAttributableMarkupExtension) { - Debug.Assert(false); //should never reach here + Debug.Assert(false); // should never reach here return false; } } @@ -303,10 +303,10 @@ public bool IsAttributable return true; } - //Non-empty Collections are not attributable + // Non-empty Collections are not attributable if (Children.Count > 1) { return false; } - //Empty collections and atoms are attributable + // Empty collections and atoms are attributable if (Children.Count == 0 || Children[0] is ValueMarkupInfo) { return true; } ObjectMarkupInfo r = Children[0] as ObjectMarkupInfo; @@ -398,45 +398,45 @@ public static MemberMarkupInfo ForDictionaryItems( object sourceOrValue, XamlMember property, XamlType propertyType, SerializerContext context) { object propertyValue; - //Type sourceType; + // Type sourceType; if (property is not null) { propertyValue = context.Runtime.GetValue(sourceOrValue, property); if (propertyValue is null) { return null; } - //sourceType = sourceOrValue.GetType(); + // sourceType = sourceOrValue.GetType(); } else { propertyValue = sourceOrValue; - //sourceType = null; + // sourceType = null; } XamlType keyType = propertyType.KeyType; - //var isXamlTemplate = XamlClrProperties.IsXamlTemplate(itemType); - //var converter = context.GetConverter(itemType); + // var isXamlTemplate = XamlClrProperties.IsXamlTemplate(itemType); + // var converter = context.GetConverter(itemType); MemberMarkupInfo itemsInfo = new MemberMarkupInfo { XamlNode = new XamlNode(XamlNodeType.StartMember, XamlLanguage.Items) }; foreach (var entry in context.Runtime.GetDictionaryItems(propertyValue, propertyType)) { ObjectMarkupInfo objInfo; - //if (isXamlTemplate) - //{ + // if (isXamlTemplate) + // { // value = ConvertToXamlReader(entry.Value, converter, context); - // // We have to remove any key that is already on this xaml (which we presume came from + // // We have to remove any key that is already on this xaml (which we presume came from // // a dictionary) in order to be sure that it will serialize correctly. // var keyIndex = value.Properties.FindIndex(psi => psi.TypeName == XamlServices.DirectiveTypeName2006 && psi.MemberName == XamlServices.KeyPropertyName); // if (keyIndex != -1) // { // value.Properties.RemoveAt(keyIndex); // } - //} - //else - //{ + // } + // else + // { objInfo = ObjectMarkupInfo.ForObject(entry.Value, context); - //} + // } ObjectOrValueMarkupInfo keyValue; @@ -545,7 +545,7 @@ static MemberMarkupInfo ForSequence(object source, XamlMember property, Serializ new ObjectMarkupInfo { XamlNode = new XamlNode(XamlNodeType.GetObject), - //Scope = context.ReferenceTable, + // Scope = context.ReferenceTable, Properties = { itemsInfo @@ -601,9 +601,9 @@ static MemberMarkupInfo ForXmlSerializable(object source, XamlMember property, S }; using (XmlWriter writer = XmlWriter.Create(sb, writerSettings)) { - //writer.WriteStartElement(property.Type.Name, property.Type.PreferredXamlNamespace); + // writer.WriteStartElement(property.Type.Name, property.Type.PreferredXamlNamespace); serializer.WriteXml(writer); - //writer.WriteEndElement(); + // writer.WriteEndElement(); } if (sb.Length > 0) @@ -682,9 +682,9 @@ static void RemoveObjectNodesForCollectionOrDictionary(MemberMarkupInfo memberIn var itemsMemberInfo = objectInfo.Properties[0] as MemberMarkupInfo; if(itemsMemberInfo is not null && itemsMemberInfo.Children.Count > 0) { - //Check if the first element of the collection/dictionary is a ME and replace the SO with GO only if it is not an ME. - //This is to handle cases where the first element is, say, null. If we remove the SO, then there is no way to - //know if the collection is null or the first element is null. + // Check if the first element of the collection/dictionary is a ME and replace the SO with GO only if it is not an ME. + // This is to handle cases where the first element is, say, null. If we remove the SO, then there is no way to + // know if the collection is null or the first element is null. var itemInfo = itemsMemberInfo.Children[0] as ObjectMarkupInfo; if(itemInfo is null || itemInfo.XamlNode.XamlType is null || !itemInfo.XamlNode.XamlType.IsMarkupExtension) { @@ -725,7 +725,7 @@ public static MemberMarkupInfo ForSequenceItems(object sourceOrValue, XamlMember } } - //var isXamlTemplate = xamlType.ItemType.TemplateConverter != null; + // var isXamlTemplate = xamlType.ItemType.TemplateConverter != null; var itemsInfo = new MemberMarkupInfo { XamlNode = new XamlNode(XamlNodeType.StartMember, XamlLanguage.Items) }; @@ -735,15 +735,15 @@ public static MemberMarkupInfo ForSequenceItems(object sourceOrValue, XamlMember { var itemValue = itemsList[i]; - //XamlType actualItemType = context.GetXamlType(itemValue.GetType()); - //if (actualItemType.TemplateConverter != null) - //{ + // XamlType actualItemType = context.GetXamlType(itemValue.GetType()); + // if (actualItemType.TemplateConverter != null) + // { // itemsInfo.Children.Add(ConvertToXamlReader(itemValue, xamlType.ItemType.TemplateConverter, context)); - //} - //else - //{ + // } + // else + // { ObjectMarkupInfo itemInfo = ObjectMarkupInfo.ForObject(itemValue, context); - //} + // } ObjectOrValueMarkupInfo unwrappedItemInfo = null; @@ -863,11 +863,11 @@ static ObjectOrValueMarkupInfo GetPropertyValueInfoInternal( } else { - //if (propertyValue is XamlReader) - //{ + // if (propertyValue is XamlReader) + // { // valueInfo = new XamlTemplateMarkupInfo((XamlReader)propertyValue, context); - //} - //else + // } + // else if (context.TryValueSerializeToString(propertyValueSerializer, propertyConverter, context, ref propertyValue)) { ThrowIfPropertiesAreAttached(context.Instance, xamlProperty, context); @@ -1000,8 +1000,8 @@ class ObjectMarkupInfo : ObjectOrValueMarkupInfo public List Properties { get { return properties; } } public string Name { get; set; } - //public object Scope { get; set; } - //public bool? ShouldWriteAsReference { get; set; } + // public object Scope { get; set; } + // public bool? ShouldWriteAsReference { get; set; } public object Object { get; set; } public override List Decompose() @@ -1147,7 +1147,7 @@ public virtual bool IsAttributableMarkupExtension return false; } - //check if every property is attributable + // check if every property is attributable foreach (var property in Properties) { if (!((MemberMarkupInfo)property).IsAttributable) @@ -1354,7 +1354,7 @@ bool TryAddPositionalParameters(XamlType xamlType, MemberInfo member, ICollectio context.Instance = argument; if (converter is not null && valueSerializer is not null && context.CanRoundtripUsingValueSerializer(valueSerializer, converter, argument)) { - //ValueSerializer is always preferred over TypeConverters + // ValueSerializer is always preferred over TypeConverters string stringValue = context.ConvertToString(valueSerializer, argument); context.Instance = null; positionalParametersProperty.Children.Add(new ValueMarkupInfo { XamlNode = new XamlNode(XamlNodeType.Value, stringValue) }); @@ -1784,7 +1784,7 @@ public void AddNameProperty(SerializerContext context) public override void EnsureNoDuplicateNames(Stack> namesInCurrentScope) { - if (!String.IsNullOrEmpty(Name) && + if (!string.IsNullOrEmpty(Name) && !namesInCurrentScope.Peek().Add(Name)) { throw new XamlObjectReaderException(SR.Format(SR.ObjectReaderXamlNamedElementAlreadyRegistered, Name)); @@ -1829,12 +1829,12 @@ static ObjectMarkupInfo ForArray(Array value, SerializerContext context) { XamlNode = new XamlNode(XamlNodeType.StartObject, XamlLanguage.Array), Object = value, - //Scope = context.ReferenceTable, + // Scope = context.ReferenceTable, Properties = { new MemberMarkupInfo() { - XamlNode = new XamlNode(XamlNodeType.StartMember, XamlLanguage.Array.GetMember("Type")), //x:ArrayExtension.Type + XamlNode = new XamlNode(XamlNodeType.StartMember, XamlLanguage.Array.GetMember("Type")), // x:ArrayExtension.Type Children = { new ValueMarkupInfo() @@ -1851,7 +1851,7 @@ static ObjectMarkupInfo ForArray(Array value, SerializerContext context) var iListInfo = new ObjectMarkupInfo { XamlNode = new XamlNode(XamlNodeType.GetObject), - //Scope = context.ReferenceTable, + // Scope = context.ReferenceTable, Properties = { items @@ -1929,12 +1929,12 @@ public static ObjectMarkupInfo ForObject(object value, SerializerContext context context.IsRoot = isRoot; - //var valueType = context.GetXamlType(value.GetType()); + // var valueType = context.GetXamlType(value.GetType()); - //if (XamlClrProperties.GetXmlSerializable(valueType)) - //{ + // if (XamlClrProperties.GetXmlSerializable(valueType)) + // { // throw new XamlObjectReaderException(SR.XamlSerializerCannotHaveXDataAtRoot(valueType.Name)); - //} + // } var valueAsArray = value as Array; if (valueAsArray is not null) @@ -1968,7 +1968,7 @@ public static ObjectMarkupInfo ForObject(object value, SerializerContext context context.ReserveDefaultPrefixForRootObject(value); } - //ValueSerializer is always preferred over TypeConverters + // ValueSerializer is always preferred over TypeConverters string stringValue = context.ConvertToString(valueSerializer, value); context.Instance = null; objectInfo = ForTypeConverted((string)stringValue, value, context); @@ -2078,7 +2078,7 @@ static ObjectMarkupInfo ForTypeConverted(string value, object originalValue, Ser { XamlNode = new XamlNode(XamlNodeType.StartObject, xamlType), Object = originalValue - //Scope = context.ReferenceTable + // Scope = context.ReferenceTable }; // we want to treat all null values returned by TCs as String.Empty @@ -2153,14 +2153,14 @@ static string ValidateNamePropertyAndFindName(MemberMarkupInfo propertyInfo) throw new XamlObjectReaderException(SR.Format(SR.ObjectReaderXamlNamePropertyMustBeString, property.Name, property.DeclaringType)); } - //public override void Write(XamlWriter writer) - //{ + // public override void Write(XamlWriter writer) + // { // ShouldWriteAsReference = ShouldWriteAsReference ?? false; // Write(writer, false); - //} + // } - //internal void Write(XamlWriter writer, bool forceAsRecord) - //{ + // internal void Write(XamlWriter writer, bool forceAsRecord) + // { // // See comment in ReferenceMarkupInfo.Write() // // // if (!forceAsRecord) @@ -2173,7 +2173,7 @@ static string ValidateNamePropertyAndFindName(MemberMarkupInfo propertyInfo) // } // } - // if (!forceAsRecord && IsAttributableMarkupExtension) + // if (!forceAsRecord && IsAttributableMarkupExtension) // { // Properties.Sort(PropertySorterForCurlySyntax.Instance); // writer.WriteStartRecordAsMarkupExtension(TypeName); @@ -2184,13 +2184,13 @@ static string ValidateNamePropertyAndFindName(MemberMarkupInfo propertyInfo) // writer.WriteStartRecord(TypeName); // } - // foreach (var property in Properties) + // foreach (var property in Properties) // { // property.Write(writer); // } - // writer.WriteEndRecord(); - //} + // writer.WriteEndRecord(); + // } class PropertySorterForXmlSyntax : IComparer { @@ -2370,7 +2370,7 @@ public override List Decompose() return base.Decompose(); } - // public override bool IsAttributableMarkupExtension + // public override bool IsAttributableMarkupExtension // { // get // { @@ -2389,7 +2389,7 @@ public override List Decompose() // } // } - // return true; + // return true; // } // set // { @@ -2397,7 +2397,7 @@ public override List Decompose() // } // } - // public override void Write(XamlWriter writer) + // public override void Write(XamlWriter writer) // { // // There is a bit of a dance that is performed between ReferenceSerializationInfos // // and RecordSerializationInfos in that it may be the case that a RecordSerializationInfo @@ -2419,7 +2419,7 @@ public override List Decompose() // } // } - // writer.WriteStartRecordAsMarkupExtension(TypeName); + // writer.WriteStartRecordAsMarkupExtension(TypeName); // writer.WriteStartMember("Name"); // writer.WriteAtom(Target.Name); // writer.WriteEndMember(); @@ -2688,7 +2688,7 @@ public bool CanRoundTripString(TypeConverter converter) public bool CanRoundtripUsingValueSerializer(ValueSerializer valueSerializer, TypeConverter typeConverter, object value) { - //ValueSerializer must know how to convert to string and the TypeConverter must know how to convert from string + // ValueSerializer must know how to convert to string and the TypeConverter must know how to convert from string return (valueSerializer is not null && typeConverter is not null && Runtime.CanConvertToString(ValueSerializerContext, valueSerializer, value) && diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlReader.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlReader.cs index 0ece4ec9d7b..469714a720b 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlReader.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlReader.cs @@ -48,7 +48,7 @@ public virtual void Skip() #region IDisposable // See Framework Design Guidelines, pp. 248-260. - + void IDisposable.Dispose() { Dispose(true); diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlRuntime.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlRuntime.cs index 86ef6a287dd..146d9e96858 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlRuntime.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlRuntime.cs @@ -25,7 +25,7 @@ internal abstract class XamlRuntime public abstract object CreateWithFactoryMethod(XamlType xamlType, string methodName, object[] args); - //CreateFromValue is expected to convert the provided value via any applicable converter (on property or type) or provide the original value if there is no converter + // CreateFromValue is expected to convert the provided value via any applicable converter (on property or type) or provide the original value if there is no converter public abstract object CreateFromValue(ServiceProviderContext serviceContext, XamlValueConverter ts, object value, XamlMember property); diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlSchemaContext.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlSchemaContext.cs index 022918ca7c6..d815159c135 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlSchemaContext.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlSchemaContext.cs @@ -61,7 +61,7 @@ public XamlSchemaContext(IEnumerable referenceAssemblies, XamlSchemaCo _settings = (settings is not null) ? new XamlSchemaContextSettings(settings) : new XamlSchemaContextSettings(); - _syncExaminingAssemblies = new Object(); + _syncExaminingAssemblies = new object(); InitializeAssemblyLoadHook(); } @@ -182,7 +182,7 @@ string GetPrefixForClrNs(string clrNs, string assemblyName) { if (!string.IsNullOrEmpty(segment)) { - sb.Append(Char.ToLower(segment[0], TypeConverterHelper.InvariantEnglishUS)); + sb.Append(char.ToLower(segment[0], TypeConverterHelper.InvariantEnglishUS)); } } @@ -485,7 +485,7 @@ private string GetCompatibleNamespace(string oldNs) private ConcurrentDictionary _masterTypeList; private ConcurrentDictionary, object> _masterValueConverterList; private ConcurrentDictionary, XamlMember> _masterMemberList; - private ConcurrentDictionary > _masterBracketCharacterCache; + private ConcurrentDictionary > _masterBracketCharacterCache; // Security note: all of these ConcurrentDictionaries use Reference Equality to prevent spoofing of // RuntimeTypes/Members by other custom derived descendants of System.Type/MemberInfo. @@ -591,7 +591,7 @@ private Dictionary BuildBracketCharacterCacheF { string constructorArgumentName = member.ConstructorArgument; string propertyName = member.Name; - IReadOnlyDictionary markupExtensionBracketCharactersList = member.MarkupExtensionBracketCharacters; + IReadOnlyDictionary markupExtensionBracketCharactersList = member.MarkupExtensionBracketCharacters; SpecialBracketCharacters splBracketCharacters = markupExtensionBracketCharactersList is not null && markupExtensionBracketCharactersList.Count > 0 ? new SpecialBracketCharacters(markupExtensionBracketCharactersList) : null; @@ -704,7 +704,7 @@ public IList ReferenceAssemblies #region Namespace Mapping and Assembly Attribute (XmlNsInfo) caches // Lazy init, access these fields through the properties. - private ConcurrentDictionary _namespaceByUriList; + private ConcurrentDictionary _namespaceByUriList; private ConcurrentDictionary _xmlnsInfo; private ConcurrentDictionary _xmlnsInfoForDynamicAssemblies; private ConcurrentDictionary _xmlnsInfoForUnreferencedAssemblies; @@ -745,7 +745,7 @@ private ConcurrentDictionary XmlnsInfoForDynamicAssemblie // This dictionary is also thread-safe for single reads and writes, but if you're // iterating them, lock on _syncExaminingAssemblies to ensure consistent results - private ConcurrentDictionary NamespaceByUriList + private ConcurrentDictionary NamespaceByUriList { get { @@ -1057,7 +1057,7 @@ private ReadOnlyCollection GetXmlNsMappings(Assembly assembly, string cl private void InitializeAssemblyLoadHook() { - _syncAccessingUnexaminedAssemblies = new Object(); + _syncAccessingUnexaminedAssemblies = new object(); if (ReferenceAssemblies is null) { _assemblyLoadHandler = new AssemblyLoadHandler(this); @@ -1255,7 +1255,7 @@ internal static V TryUpdate(ConcurrentDictionary dictionary, K key, protected internal virtual Assembly OnAssemblyResolve(string assemblyName) { - if (String.IsNullOrEmpty(assemblyName)) + if (string.IsNullOrEmpty(assemblyName)) { return null; } diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlServices.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlServices.cs index c6ebe0c28ed..600d5d9deaa 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlServices.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlServices.cs @@ -137,7 +137,7 @@ public static string Save(object instance) return sw.ToString(); } - public static void Save(String fileName, object instance) + public static void Save(string fileName, object instance) { ArgumentNullException.ThrowIfNull(fileName); // diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlType.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlType.cs index 55be31500a5..5068ec3c9a0 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlType.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlType.cs @@ -806,7 +806,7 @@ protected virtual XamlMember LookupContentProperty() { return null; } - + return GetPropertyOrUnknown(contentPropertyName, skipReadOnlyCheck: false); } @@ -1687,7 +1687,7 @@ private Dictionary> LookupAllPositionalParameters() // Constructors. If the type is TypeExtension then we hard code the right answer. if (UnderlyingType == XamlLanguage.Type.UnderlyingType) { - Dictionary> result = new Dictionary>(); + Dictionary> result = new Dictionary>(); XamlType typeOfType = SchemaContext.GetXamlType(typeof(Type)); XamlType[] typeVector = new XamlType[] { typeOfType }; result.Add(1, GetReadOnly(typeVector)); diff --git a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlXmlWriter.cs b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlXmlWriter.cs index c47b8a88b47..9709881946d 100644 --- a/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlXmlWriter.cs +++ b/src/Microsoft.DotNet.Wpf/src/System.Xaml/System/Xaml/XamlXmlWriter.cs @@ -679,8 +679,8 @@ internal static string GetTypeName(XamlType type) class Frame { - Dictionary namespaceMap = new Dictionary(); //namespace to prefix map - Dictionary prefixMap = new Dictionary(); //prefix to namespace map + Dictionary namespaceMap = new Dictionary(); // namespace to prefix map + Dictionary prefixMap = new Dictionary(); // prefix to namespace map public XamlType Type { @@ -1277,7 +1277,7 @@ public override void WriteValue(XamlXmlWriter writer, string value) if (HasSignificantWhitespace(value)) { XamlType containingXamlType = GetContainingXamlType(writer); - //Treat unknown types as WhitespaceSignificantCollections + // Treat unknown types as WhitespaceSignificantCollections if (containingXamlType is not null && !containingXamlType.IsWhitespaceSignificantCollection) { WriteXmlSpaceOrThrow(writer, value); @@ -1622,7 +1622,7 @@ public override void WriteValue(XamlXmlWriter writer, string value) public override void WriteObject(XamlXmlWriter writer, XamlType type, bool isObjectFromMember) { - // We should remove the !type.IsGeneric check once + // We should remove the !type.IsGeneric check once // XamlReader is fixed to handle Generic MEs. if (type is not null && type.IsMarkupExtension && !type.IsGeneric) {