Skip to content

Commit 090a523

Browse files
General using cleanup in C# files (#10011)
* General using cleanup in C# files This removes unnecessary using statements and moves them outside of the namespaces when they were inside them. I cleaned up the headers a bit for several hundred files, but the cleanup there isn't exhaustive by any means. Changes are only to the tops of files. To make this work a bit more cleanly I've added GlobalUsings.cs files to some of the assemblies. * Replace HashHelper with simplified version. Other PR feedback. * Fix PresentationFramework.csproj * Add null check * Change HRESULT namespaces to defaults --------- Co-authored-by: Harshit Mishra <hmishra@microsoft.com>
1 parent fb2a781 commit 090a523

File tree

3,629 files changed

+3280
-28264
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

3,629 files changed

+3280
-28264
lines changed

src/Microsoft.DotNet.Wpf/src/Common/Graphics/Generated/wgx_commands.cs

-3
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,8 @@
1111

1212
// This code is generated from mcg\generators\CommandStructure.cs
1313

14-
using System;
15-
using System.Windows.Media.Composition;
1614
using System.Runtime.InteropServices;
1715
using System.Windows.Media.Effects;
18-
using System.Security;
1916

2017
using BOOL = System.UInt32;
2118

src/Microsoft.DotNet.Wpf/src/Common/Graphics/exports.cs

+3-20
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,15 @@
66
// Description:
77
// Managed exports from MIL core.
88

9-
using System;
10-
using System.Collections;
11-
using System.ComponentModel;
12-
using System.Threading;
13-
using System.Windows;
14-
using System.Windows.Media;
159
using System.Windows.Media.Imaging;
16-
using System.Windows.Media.Effects;
17-
using System.Windows.Media.Media3D;
1810
using System.Runtime.InteropServices;
19-
using System.Windows.Media.Animation;
2011
using MS.Internal;
21-
using MS.Internal.PresentationCore;
2212
using MS.Internal.Interop;
2313
using MS.Utility;
2414
using MS.Win32;
25-
using System.Diagnostics;
26-
using System.Collections.Generic;
27-
using System.Security;
28-
using Microsoft.Win32.SafeHandles;
29-
30-
using UnsafeNativeMethods=MS.Win32.PresentationCore.UnsafeNativeMethods;
31-
using SafeNativeMethods=MS.Win32.PresentationCore.SafeNativeMethods;
32-
using HRESULT=MS.Internal.HRESULT;
33-
using SR=MS.Internal.PresentationCore.SR;
34-
using DllImport=MS.Internal.PresentationCore.DllImport;
15+
16+
using UnsafeNativeMethods = MS.Win32.PresentationCore.UnsafeNativeMethods;
17+
using HRESULT = MS.Internal.HRESULT;
3518

3619
/*
3720
*

src/Microsoft.DotNet.Wpf/src/Common/Graphics/wgx_av_types.cs

-3
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using System;
6-
using System.Runtime.InteropServices;
7-
85
namespace System.Windows.Media
96
{
107
//

src/Microsoft.DotNet.Wpf/src/Common/Graphics/wgx_core_types.cs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
6-
using System;
75
using System.Runtime.InteropServices;
86

97
namespace System.Windows.Media.Composition

src/Microsoft.DotNet.Wpf/src/Common/Graphics/wgx_exports.cs

-6
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,11 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
6-
using System;
75
using System.Windows;
86
using System.Windows.Media;
9-
using System.Windows.Media.Composition;
107
using System.Windows.Media.Imaging;
118
using System.Runtime.InteropServices;
129

13-
using System.Security;
14-
using MS.Internal.PresentationCore;
15-
1610
namespace MS.Internal
1711
{
1812
#region MILRenderTargetBitmap

src/Microsoft.DotNet.Wpf/src/Common/Graphics/wgx_render.cs

-8
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
6-
using System;
7-
using System.IO;
8-
using System.Windows;
9-
using System.Windows.Media.Composition;
105
using System.Runtime.InteropServices;
11-
using System.Windows.Media;
12-
using System.Security;
13-
using SR=MS.Internal.PresentationCore.SR;
146

157
namespace MS.Internal
168
{

src/Microsoft.DotNet.Wpf/src/Common/src/MS/Internal/PixelUnit.cs

-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33

4-
using System;
5-
64
namespace MS.Internal
75
{
86
internal readonly struct PixelUnit

src/Microsoft.DotNet.Wpf/src/Common/src/System/IO/Compression/DeflateZLib/ZLibNative.cs

-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// See the LICENSE file in the project root for more information.
44

55
using System.Runtime.InteropServices;
6-
using System.Security;
76

87
namespace System.IO.Compression
98
{

src/Microsoft.DotNet.Wpf/src/Extensions/PresentationFramework-SystemDrawing/SystemDrawingExtension.cs

-3
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,12 @@
55
// Description: Helper methods for code that uses types from System.Drawing.
66

77
using System;
8-
using System.Security;
98
using System.Diagnostics.CodeAnalysis;
109
using System.Drawing;
1110
using System.Drawing.Imaging;
12-
using System.Drawing.Printing;
1311
using System.IO;
1412

1513
using System.Windows;
16-
using System.Windows.Media;
1714
using System.Windows.Media.Imaging;
1815

1916
namespace MS.Internal

src/Microsoft.DotNet.Wpf/src/Extensions/PresentationFramework-SystemXml/XmlNodeComparer.cs

-2
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,10 @@
66

77
using System;
88
using System.Collections;
9-
using System.Collections.Generic;
109
using System.ComponentModel;
1110
using System.Globalization;
1211

1312
using System.Xml;
14-
using MS.Internal.Data;
1513

1614
namespace MS.Internal.Data
1715
{

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Localization/LocalizationDirectivesToLocFile.cs

-2
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using System;
6-
75
namespace MS.Internal
86
{
97

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Localization/LocalizationParserHooks.cs

-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
using System;
65
using System.Collections;
76
using System.IO;
87
using System.Xml;

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/MarkupCompiler.cs

-4
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@
1919
using System.Reflection;
2020
using System.Globalization;
2121
using System.ComponentModel;
22-
using System.Security.Cryptography;
2322

2423
using System.CodeDom;
2524
using System.CodeDom.Compiler;
@@ -29,14 +28,11 @@
2928

3029
using System.Diagnostics;
3130
using System.Diagnostics.CodeAnalysis;
32-
33-
using System.Threading;
3431
using MS.Internal.Markup;
3532
using MS.Internal.Tasks;
3633
using MS.Utility; // for SR
3734
using Microsoft.Build.Utilities;
3835
using Microsoft.Build.Tasks.Windows;
39-
using System.Runtime.CompilerServices;
4036

4137
namespace MS.Internal
4238
{

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/ParserExtension.cs

-2
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,6 @@
1919
using System.Diagnostics;
2020
using System.Reflection;
2121
using System.CodeDom;
22-
using System.CodeDom.Compiler;
23-
using System.ComponentModel;
2422
using MS.Utility; // for SR
2523

2624
namespace MS.Internal

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/MarkupCompiler/PathInternal.cs

-19
Original file line numberDiff line numberDiff line change
@@ -16,29 +16,10 @@
1616
#pragma warning disable 1634, 1691
1717

1818
using System;
19-
using System.Xml;
2019
using System.IO;
2120
using System.Text;
22-
using System.Reflection;
23-
using System.Globalization;
24-
using System.ComponentModel;
25-
using System.Security.Cryptography;
26-
27-
using System.CodeDom;
28-
using System.CodeDom.Compiler;
29-
using System.Collections;
30-
using System.Collections.Generic;
31-
using System.ComponentModel.Design.Serialization;
3221

3322
using System.Diagnostics;
34-
using System.Diagnostics.CodeAnalysis;
35-
36-
using System.Threading;
37-
using MS.Internal.Markup;
38-
using MS.Internal.Tasks;
39-
using MS.Utility; // for SR
40-
using Microsoft.Build.Utilities;
41-
using Microsoft.Build.Tasks.Windows;
4223
using System.Runtime.CompilerServices;
4324

4425
namespace MS.Internal

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/CompilerLocalReference.cs

-4
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,10 @@
1313
using System;
1414
using System.IO;
1515
using System.Collections;
16-
using System.Collections.Generic;
1716
using System.Diagnostics;
1817
using System.Text;
1918

2019
using Microsoft.Build.Tasks.Windows;
21-
using Microsoft.Build.Framework;
22-
using Microsoft.Build.Utilities;
23-
using MS.Utility;
2420

2521
namespace MS.Internal.Tasks
2622
{

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/CompilerState.cs

-3
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,12 @@
1212

1313
using System;
1414
using System.IO;
15-
using System.Collections;
1615
using System.Diagnostics;
1716
using System.Text;
1817
using System.Globalization;
1918

2019
using Microsoft.Build.Tasks.Windows;
2120
using Microsoft.Build.Framework;
22-
using Microsoft.Build.Utilities;
23-
using MS.Utility;
2421

2522
namespace MS.Internal.Tasks
2623
{

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/CompilerWrapper.cs

-4
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@
1818
using System;
1919
using System.IO;
2020
using System.Collections;
21-
using System.Reflection;
22-
using System.Runtime.InteropServices;
23-
24-
using MS.Internal.Markup;
2521
using Microsoft.Build.Utilities;
2622
using Microsoft.Build.Framework;
2723
using MS.Internal.Tasks;

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/IPersistFileCheckSum.cs

-1
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717

1818
using System;
1919
using System.Runtime.InteropServices;
20-
using System.Security;
2120

2221

2322
namespace MS.Internal

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/IVsMSBuildTaskFileManager.cs

+1-2
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,8 @@
1818

1919
using System;
2020
using System.Runtime.InteropServices;
21-
using System.Security;
2221

23-
22+
2423
namespace MS.Internal
2524
{
2625
// <summary>

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/IncrementalCompileAnalyzer.cs

-4
Original file line numberDiff line numberDiff line change
@@ -12,16 +12,12 @@
1212

1313
using System;
1414
using System.IO;
15-
using System.Collections;
1615
using System.Collections.Generic;
17-
using System.Diagnostics;
1816
using System.Linq;
1917
using System.Reflection;
2018

2119
using Microsoft.Build.Tasks.Windows;
2220
using Microsoft.Build.Framework;
23-
using Microsoft.Build.Utilities;
24-
using MS.Utility;
2521

2622
namespace MS.Internal.Tasks
2723
{

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/Shared.cs

-4
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,6 @@
1010
//
1111
//------------------------------------------------------------------------------
1212

13-
using System;
14-
using System.IO;
15-
using System.Collections;
16-
1713
namespace MS.Internal.Tasks
1814
{
1915
#region SharedStrings class

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/TaskFileService.cs

-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
using System.IO;
2525
using Microsoft.Build.Utilities;
2626
using Microsoft.Build.Tasks.Windows;
27-
using System.Diagnostics;
2827
using System.Text;
2928
using System.Security.Cryptography;
3029

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/MS/Internal/Tasks/TaskHelper.cs

-7
Original file line numberDiff line numberDiff line change
@@ -12,21 +12,14 @@
1212

1313
using System;
1414
using System.IO;
15-
using System.Collections;
16-
using System.Text;
17-
using System.Runtime.InteropServices;
1815

1916
using System.Globalization;
2017
using System.Diagnostics;
2118
using System.Reflection;
22-
using System.Resources;
2319

2420
using Microsoft.Build.Framework;
2521
using Microsoft.Build.Utilities;
26-
27-
using Microsoft.Build.Tasks;
2822
using MS.Utility;
29-
using System.Collections.Generic;
3023

3124

3225
namespace MS.Internal.Tasks

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/FileClassifier.cs

-4
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,9 @@
1010
//---------------------------------------------------------------------------
1111

1212
using System;
13-
using System.IO;
1413
using System.Collections.Generic;
1514

1615
using System.Globalization;
17-
using System.Diagnostics;
18-
using System.Reflection;
19-
using System.Resources;
2016
using System.Runtime.InteropServices;
2117

2218

src/Microsoft.DotNet.Wpf/src/PresentationBuildTasks/Microsoft/Build/Tasks/Windows/GenerateTemporaryTargetAssembly.cs

-5
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,13 @@
2121
using System.Collections;
2222
using System.Collections.Generic;
2323
using System.Linq;
24-
25-
using System.Globalization;
2624
using System.Diagnostics;
27-
using System.Reflection;
28-
using System.Resources;
2925
using System.Xml;
3026

3127
using Microsoft.Build.Framework;
3228
using Microsoft.Build.Utilities;
3329

3430
using MS.Utility;
35-
using MS.Internal.Tasks;
3631

3732
// Since we disable PreSharp warnings in this file, PreSharp warning is unknown to C# compiler.
3833
// We first need to disable warnings about unknown message numbers and unknown pragmas.

0 commit comments

Comments
 (0)