Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Minor fixes #67931

Merged
merged 4 commits into from
Apr 13, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ public class MatcherContext
private readonly List<FilePatternMatch> _files;

private readonly HashSet<string> _declaredLiteralFolderSegmentInString;
private readonly HashSet<LiteralPathSegment> _declaredLiteralFolderSegments = new HashSet<LiteralPathSegment>();
private readonly HashSet<LiteralPathSegment> _declaredLiteralFileSegments = new HashSet<LiteralPathSegment>();

private bool _declaredParentPathSegment;
Expand Down Expand Up @@ -126,7 +125,6 @@ private void Match(DirectoryInfoBase directory, string? parentRelativePath)
private void Declare()
{
_declaredLiteralFileSegments.Clear();
_declaredLiteralFolderSegments.Clear();
_declaredParentPathSegment = false;
_declaredWildcardPathSegment = false;

Expand All @@ -146,7 +144,6 @@ private void DeclareInclude(IPathSegment patternSegment, bool isLastSegment)
}
else
{
_declaredLiteralFolderSegments.Add(literalSegment);
_declaredLiteralFolderSegmentInString.Add(literalSegment.Value);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ public class PartBuilder
private static readonly List<Attribute> s_importingConstructorList = new List<Attribute>() { new ImportingConstructorAttribute() };
private static readonly Type s_exportAttributeType = typeof(ExportAttribute);
private readonly List<ExportBuilder> _typeExportBuilders;
private readonly List<ImportBuilder> _constructorImportBuilders;
private bool _setCreationPolicy;
private CreationPolicy _creationPolicy;

Expand All @@ -38,7 +37,6 @@ internal PartBuilder(Predicate<Type> selectType)
_setCreationPolicy = false;
_creationPolicy = CreationPolicy.Any;
_typeExportBuilders = new List<ExportBuilder>();
_constructorImportBuilders = new List<ImportBuilder>();
_propertyExports = new List<Tuple<Predicate<PropertyInfo>, Action<PropertyInfo, ExportBuilder>, Type>>();
_propertyImports = new List<Tuple<Predicate<PropertyInfo>, Action<PropertyInfo, ImportBuilder>, Type>>();
_interfaceExports = new List<Tuple<Predicate<Type>, Action<Type, ExportBuilder>>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ public class PartConventionBuilder
private static readonly List<Attribute> s_importingConstructorList = new List<Attribute>() { new ImportingConstructorAttribute() };
private static readonly Type s_exportAttributeType = typeof(ExportAttribute);
private readonly List<ExportConventionBuilder> _typeExportBuilders;
private readonly List<ImportConventionBuilder> _constructorImportBuilders;
private bool _isShared;
private string _sharingBoundary;

Expand All @@ -42,7 +41,6 @@ internal PartConventionBuilder(Predicate<Type> selectType)
{
SelectType = selectType;
_typeExportBuilders = new List<ExportConventionBuilder>();
_constructorImportBuilders = new List<ImportConventionBuilder>();
_propertyExports = new List<Tuple<Predicate<PropertyInfo>, Action<PropertyInfo, ExportConventionBuilder>, Type>>();
_propertyImports = new List<Tuple<Predicate<PropertyInfo>, Action<PropertyInfo, ImportConventionBuilder>>>();
_interfaceExports = new List<Tuple<Predicate<Type>, Action<Type, ExportConventionBuilder>>>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ public override Graphics OnStartPage(PrintDocument document, PrintPageEventArgs
int dpiY = Interop.Gdi32.GetDeviceCaps(new HandleRef(_dc, _dc.Hdc), Interop.Gdi32.DeviceCapability.LOGPIXELSY);
int hardMarginX_DU = Interop.Gdi32.GetDeviceCaps(new HandleRef(_dc, _dc.Hdc), Interop.Gdi32.DeviceCapability.PHYSICALOFFSETX);
int hardMarginY_DU = Interop.Gdi32.GetDeviceCaps(new HandleRef(_dc, _dc.Hdc), Interop.Gdi32.DeviceCapability.PHYSICALOFFSETY);
float hardMarginX = hardMarginX_DU * 100 / dpiX;
float hardMarginY = hardMarginY_DU * 100 / dpiY;
float hardMarginX = hardMarginX_DU * 100f / dpiX;
float hardMarginY = hardMarginY_DU * 100f / dpiY;

_graphics.TranslateTransform(-hardMarginX, -hardMarginY);
_graphics.TranslateTransform(document.DefaultPageSettings.Margins.Left, document.DefaultPageSettings.Margins.Top);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@ protected override void OnEventCommand(EventCommandEventArgs command)

// On disable, PollingCounters will stop polling for values so it should be fine to leave them around.
_cpuTimeCounter ??= new PollingCounter("cpu-usage", this, () => RuntimeEventSourceHelper.GetCpuUsage()) { DisplayName = "CPU Usage", DisplayUnits = "%" };
_workingSetCounter ??= new PollingCounter("working-set", this, () => (double)(Environment.WorkingSet / 1_000_000)) { DisplayName = "Working Set", DisplayUnits = "MB" };
_gcHeapSizeCounter ??= new PollingCounter("gc-heap-size", this, () => (double)(GC.GetTotalMemory(false) / 1_000_000)) { DisplayName = "GC Heap Size", DisplayUnits = "MB" };
_workingSetCounter ??= new PollingCounter("working-set", this, () => ((double)Environment.WorkingSet / 1_000_000)) { DisplayName = "Working Set", DisplayUnits = "MB" };
_gcHeapSizeCounter ??= new PollingCounter("gc-heap-size", this, () => ((double)GC.GetTotalMemory(false) / 1_000_000)) { DisplayName = "GC Heap Size", DisplayUnits = "MB" };
_gen0GCCounter ??= new IncrementingPollingCounter("gen-0-gc-count", this, () => GC.CollectionCount(0)) { DisplayName = "Gen 0 GC Count", DisplayRateTimeScale = new TimeSpan(0, 1, 0) };
_gen1GCCounter ??= new IncrementingPollingCounter("gen-1-gc-count", this, () => GC.CollectionCount(1)) { DisplayName = "Gen 1 GC Count", DisplayRateTimeScale = new TimeSpan(0, 1, 0) };
_gen2GCCounter ??= new IncrementingPollingCounter("gen-2-gc-count", this, () => GC.CollectionCount(2)) { DisplayName = "Gen 2 GC Count", DisplayRateTimeScale = new TimeSpan(0, 1, 0) };
Expand All @@ -91,7 +91,7 @@ protected override void OnEventCommand(EventCommandEventArgs command)
var gcInfo = GC.GetGCMemoryInfo();
return gcInfo.HeapSizeBytes != 0 ? gcInfo.FragmentedBytes * 100d / gcInfo.HeapSizeBytes : 0;
}) { DisplayName = "GC Fragmentation", DisplayUnits = "%" };
_committedCounter ??= new PollingCounter("gc-committed", this, () => (double)(GC.GetGCMemoryInfo().TotalCommittedBytes / 1_000_000)) { DisplayName = "GC Committed Bytes", DisplayUnits = "MB" };
_committedCounter ??= new PollingCounter("gc-committed", this, () => ((double)GC.GetGCMemoryInfo().TotalCommittedBytes / 1_000_000)) { DisplayName = "GC Committed Bytes", DisplayUnits = "MB" };
_exceptionCounter ??= new IncrementingPollingCounter("exception-count", this, () => Exception.GetExceptionCount()) { DisplayName = "Exception Count", DisplayRateTimeScale = new TimeSpan(0, 0, 1) };
_gcTimeCounter ??= new PollingCounter("time-in-gc", this, () => GC.GetLastGCPercentTimeInGC()) { DisplayName = "% Time in GC since last GC", DisplayUnits = "%" };
_gen0SizeCounter ??= new PollingCounter("gen-0-size", this, () => GC.GetGenerationSize(0)) { DisplayName = "Gen 0 Size", DisplayUnits = "B" };
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -654,7 +654,7 @@ private void ClearAttributesInfo()

private ValidatingReaderNodeData AddAttribute(int attIndex)
{
Debug.Assert(attIndex <= _attributeEvents.Length);
Debug.Assert(attIndex < _attributeEvents.Length);
ValidatingReaderNodeData attInfo = _attributeEvents[attIndex];
if (attInfo != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2305,7 +2305,7 @@ private void ClearAttributesInfo()

private AttributePSVIInfo AddAttributePSVI(int attIndex)
{
Debug.Assert(attIndex <= _attributePSVINodes.Length);
Debug.Assert(attIndex < _attributePSVINodes.Length);
AttributePSVIInfo attInfo = _attributePSVINodes[attIndex];
if (attInfo != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ public sealed class XmlSchemaInference
private readonly XmlNamespaceManager _namespaceManager;
//private Hashtable schemas; //contains collection of schemas before they get added to the XmlSchemaSet xsc
//private bool bRefine = false; //indicates if we are going to infer or refine schema when InferSchema is called
private readonly ArrayList _schemaList;
private InferenceOption _occurrence = InferenceOption.Restricted;
private InferenceOption _typeInference = InferenceOption.Restricted;

Expand Down Expand Up @@ -160,7 +159,6 @@ public XmlSchemaInference()
_nametable = new NameTable();
_namespaceManager = new XmlNamespaceManager(_nametable);
_namespaceManager.AddNamespace("xs", XmlSchema.Namespace);
_schemaList = new ArrayList();
}

public XmlSchemaSet InferSchema(XmlReader instanceDocument)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1633,7 +1633,6 @@ void Wrapper(object? collection, object? collectionItems)
}

var allMembersList = new List<Member>(mappings.Length);
var allMemberMappingList = new List<MemberMapping>(mappings.Length);

for (int i = 0; i < mappings.Length; i++)
{
Expand Down Expand Up @@ -1774,7 +1773,6 @@ void Wrapper(object elementNameObject)
}
}

allMemberMappingList.Add(mapping);
allMembersList.Add(member);

if (mapping == anyElement)
Expand Down