Skip to content

Commit 4d9825e

Browse files
Apply breaking test-code fixes due to updated NuGet Versions.
1 parent cb8ca8f commit 4d9825e

File tree

8 files changed

+189
-23
lines changed

8 files changed

+189
-23
lines changed

eng/Versions.props

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@
7474
</PropertyGroup>
7575
<!-- Test related -->
7676
<PropertyGroup>
77-
<MicrosoftVisualStudioThreadingVersion>17.0.15-alpha</MicrosoftVisualStudioThreadingVersion>
77+
<MicrosoftVisualStudioThreadingVersion>17.12.19</MicrosoftVisualStudioThreadingVersion>
7878
<!-- This is needed for Verify.Xunit to pull correct version of System.Speech -->
7979
<MicrosoftWindowsCompatibilityVersion>7.0.0</MicrosoftWindowsCompatibilityVersion>
8080
<MoqPackageVersion>4.10.0</MoqPackageVersion>
@@ -95,7 +95,7 @@
9595
<CSharpIsNullAnalyzersVersion>0.1.495</CSharpIsNullAnalyzersVersion>
9696
<DotNetAnalyzersDocumentationAnalyzersVersion>1.0.0-beta.59</DotNetAnalyzersDocumentationAnalyzersVersion>
9797
<MicrosoftCodeAnalysisAnalyzersVersion>3.11.0-beta1.24219.2</MicrosoftCodeAnalysisAnalyzersVersion>
98-
<MicrosoftCodeAnalysisCommonPackageVersion>4.10.0-3.final</MicrosoftCodeAnalysisCommonPackageVersion>
98+
<MicrosoftCodeAnalysisCommonPackageVersion>4.12.0</MicrosoftCodeAnalysisCommonPackageVersion>
9999
<MicrosoftCodeAnalysisCSharpPackageVersion>$(MicrosoftCodeAnalysisCommonPackageVersion)</MicrosoftCodeAnalysisCSharpPackageVersion>
100100
<MicrosoftCodeAnalysisVisualBasicPackageVersion>$(MicrosoftCodeAnalysisCommonPackageVersion)</MicrosoftCodeAnalysisVisualBasicPackageVersion>
101101
<MicrosoftCodeAnalysisCSharpWorkspacesVersion>$(MicrosoftCodeAnalysisCommonPackageVersion)</MicrosoftCodeAnalysisCSharpWorkspacesVersion>
@@ -104,7 +104,7 @@
104104
<MicrosoftCodeAnalysisPublicApiAnalyzersVersion>$(MicrosoftCodeAnalysisAnalyzersVersion)</MicrosoftCodeAnalysisPublicApiAnalyzersVersion>
105105
<MicrosoftCodeAnalysisNetAnalyzersVersion>8.0.0-preview.23327.3</MicrosoftCodeAnalysisNetAnalyzersVersion>
106106
<StyleCopAnalyzersVersion>1.2.0-beta.556</StyleCopAnalyzersVersion>
107-
<NugetPackagingVersion>6.3.4</NugetPackagingVersion>
107+
<NugetPackagingVersion>6.11.0</NugetPackagingVersion>
108108
</PropertyGroup>
109109
<!-- Additional unchanging dependencies -->
110110
<PropertyGroup>

src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/BinaryFormatWriterTests.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -104,15 +104,15 @@ public void BinaryFormatWriter_TryWriteObject_UnsupportedObjects_RoundTrip(objec
104104
}
105105

106106
public static IEnumerable<object[]?> TryWriteObject_SupportedObjects_TestData =>
107-
HashtableTests.Hashtables_TestData.Concat(
107+
((IEnumerable<object[]>)HashtableTests.Hashtables_TestData).Concat(
108108
ListTests.PrimitiveLists_TestData).Concat(
109109
ListTests.ArrayLists_TestData).Concat(
110110
PrimitiveTypeTests.Primitive_Data).Concat(
111111
SystemDrawing_TestData).Concat(
112112
Array_TestData).Skip(9);
113113

114114
public static IEnumerable<object[]?> TryWriteObject_UnsupportedObjects_TestData =>
115-
HashtableTests.Hashtables_UnsupportedTestData.Concat(
115+
((IEnumerable<object[]?>)HashtableTests.Hashtables_UnsupportedTestData).Concat(
116116
ListTests.Lists_UnsupportedTestData).Concat(
117117
ListTests.ArrayLists_UnsupportedTestData).Concat(
118118
Array_UnsupportedTestData);
@@ -138,7 +138,8 @@ public void BinaryFormatWriter_TryWriteObject_UnsupportedObjects_RoundTrip(objec
138138
new DateTime[] { DateTime.MaxValue }
139139
};
140140

141-
public static IEnumerable<object[]> Array_TestData => StringArray_Parse_Data.Concat(PrimitiveArray_Parse_Data);
141+
public static IEnumerable<object[]> Array_TestData =>
142+
((IEnumerable<object[]>)StringArray_Parse_Data).Concat(PrimitiveArray_Parse_Data);
142143

143144
public static TheoryData<Array> Array_UnsupportedTestData => new()
144145
{

src/System.Private.Windows.Core/tests/BinaryFormatTests/FormatTests/FormattedObject/HashTableTests.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,11 +233,11 @@ public void RoundTripHashtables(Hashtable hashtable)
233233
},
234234
new Hashtable()
235235
{
236-
{ "Foo", new Point() }
236+
{ "Foo", default(Point) }
237237
},
238238
new Hashtable()
239239
{
240-
{ "Foo", new PointF() }
240+
{ "Foo", default(PointF) }
241241
},
242242
new Hashtable()
243243
{
@@ -280,4 +280,4 @@ private sealed class FormatterConverterStub : IFormatterConverter
280280
}
281281
}
282282

283-
#pragma warning restore CS0618 // Type or member is obsolete
283+
#pragma warning restore CS0618

src/System.Windows.Forms.Analyzers/generic/tests/UnitTests/Microsoft/WinForms/TestFileLoader.cs

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -48,25 +48,27 @@ static IEnumerable<TestFileEntry> EnumerateEntriesInternal(
4848
{
4949
FileSystemEnumerable<TestFileEntry> enumeration = new FileSystemEnumerable<TestFileEntry>(
5050
directory: basePath,
51-
transform: (ref entry) =>
52-
{
53-
TestFileType fileType = Path.GetFileName(entry.ToFullPath()) switch
54-
{
55-
var filename when filename.Contains(AnalyzerTestCode) => TestFileType.AnalyzerTestCode,
56-
var filename when filename.Contains(FixedTestCode) => TestFileType.FixedTestCode,
57-
var filename when filename.Contains(CodeFixTestCode) => TestFileType.CodeFixTestCode,
58-
var filename when filename.Contains(GlobalUsing) => TestFileType.GlobalUsing,
59-
_ => TestFileType.AdditionalCodeFile
60-
};
61-
62-
return new TestFileEntry(entry.ToFullPath(), fileType);
63-
},
51+
transform: TestFileTransform,
6452
options: enumOptions);
6553

6654
foreach (var fileEntry in enumeration)
6755
{
6856
yield return fileEntry;
6957
}
58+
59+
static TestFileEntry TestFileTransform(ref FileSystemEntry entry)
60+
{
61+
TestFileType fileType = Path.GetFileName(entry.ToFullPath()) switch
62+
{
63+
var filename when filename.Contains(AnalyzerTestCode) => TestFileType.AnalyzerTestCode,
64+
var filename when filename.Contains(FixedTestCode) => TestFileType.FixedTestCode,
65+
var filename when filename.Contains(CodeFixTestCode) => TestFileType.CodeFixTestCode,
66+
var filename when filename.Contains(GlobalUsing) => TestFileType.GlobalUsing,
67+
_ => TestFileType.AdditionalCodeFile
68+
};
69+
70+
return new TestFileEntry(entry.ToFullPath(), fileType);
71+
}
7072
}
7173
}
7274

src/System.Windows.Forms/tests/IntegrationTests/UIIntegrationTests/GlobalSuppressions.cs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,9 @@
33
// Project-level suppressions either have no target or are given
44
// a specific target and scoped to a namespace, type, member, etc.
55

6+
using System.Diagnostics.CodeAnalysis;
7+
68
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "VSTHRD200:Use \"Async\" suffix for async methods")]
9+
[assembly: SuppressMessage("Usage", "VSTHRD100:Avoid async void methods", Justification = "On purpose in test.", Scope = "member", Target = "~M:System.Windows.Forms.UITests.DragDropTests.DragDrop_RTF_FromExplorer_ToRichTextBox_ReturnsExpected_Async~System.Threading.Tasks.Task")]
10+
[assembly: SuppressMessage("Usage", "VSTHRD003:Avoid awaiting foreign Tasks", Justification = "On purpose in test.", Scope = "member", Target = "~M:System.Windows.Forms.UITests.ControlTestBase.RunFormAsync``1(System.Func{System.ValueTuple{System.Windows.Forms.Form,``0}},System.Func{System.Windows.Forms.Form,``0,System.Threading.Tasks.Task})~System.Threading.Tasks.Task")]
11+
[assembly: SuppressMessage("Usage", "VSTHRD003:Avoid awaiting foreign Tasks", Justification = "On purpose in test.", Scope = "member", Target = "~M:System.Windows.Forms.UITests.ControlTestBase.RunFormWithoutControlAsync``1(System.Func{``0},System.Func{``0,System.Threading.Tasks.Task})~System.Threading.Tasks.Task")]

src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/Program.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,4 +27,3 @@
2727
}
2828

2929
Environment.Exit(0);
30-

src/System.Windows.Forms/tests/IntegrationTests/WinformsControlsTest/WinformsControlsTest.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
1313
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
1414
<GenerateResourceWarnOnBinaryFormatterUse>false</GenerateResourceWarnOnBinaryFormatterUse>
15+
<IsTestUtilityProject>true</IsTestUtilityProject>
1516
</PropertyGroup>
1617

1718
<!--ApplicationConfiguration specific settings.-->
@@ -124,6 +125,14 @@
124125
<ResolveWinFormsAnalyzersFromSdkRefPack>false</ResolveWinFormsAnalyzersFromSdkRefPack>
125126
</PropertyGroup>
126127

128+
<ItemGroup>
129+
<ProjectReference Include="..\..\..\..\System.Windows.Forms.Analyzers\cs\src\Analyzers\System.Windows.Forms.Analyzers.CSharp.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
130+
<ProjectReference Include="..\..\..\..\System.Windows.Forms.Analyzers\cs\src\CodeFixes\System.Windows.Forms.Analyzers.CodeFixes.CSharp.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
131+
<ProjectReference Include="..\..\..\..\System.Windows.Forms.Analyzers\generic\src\System.Windows.Forms.Analyzers.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
132+
<ProjectReference Include="..\..\..\..\System.Windows.Forms.Analyzers\vb\src\Analyzers\System.Windows.Forms.Analyzers.VisualBasic.vbproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
133+
<ProjectReference Include="..\..\..\..\System.Windows.Forms.Analyzers\vb\src\CodeFixes\System.Windows.Forms.Analyzers.CodeFixes.VisualBasic.vbproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
134+
</ItemGroup>
135+
127136
<ItemGroup>
128137
<Reference Include="AxInterop.WMPLib">
129138
<HintPath>$(ArtifactsBinDir)\AxHosts\$(Configuration)\net472\AxInterop.WMPLib.dll</HintPath>
Lines changed: 150 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,150 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<AssemblyName>WinFormsControlsTest</AssemblyName>
5+
<RootNamespace>WinFormsControlsTest</RootNamespace>
6+
<ApplicationIcon />
7+
<OutputType>WinExe</OutputType>
8+
<StartupObject />
9+
<ApplicationManifest>app.manifest</ApplicationManifest>
10+
<EnableXlfLocalization>false</EnableXlfLocalization>
11+
<UpdateXlfOnBuild>false</UpdateXlfOnBuild>
12+
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
13+
<EnableUnsafeBinaryFormatterSerialization>true</EnableUnsafeBinaryFormatterSerialization>
14+
<GenerateResourceWarnOnBinaryFormatterUse>false</GenerateResourceWarnOnBinaryFormatterUse>
15+
</PropertyGroup>
16+
17+
<!--ApplicationConfiguration specific settings.-->
18+
<!--https://github.com/dotnet/designs/blob/main/accepted/2021/winforms/streamline-application-bootstrap.md-->
19+
<PropertyGroup>
20+
<ApplicationDefaultFont>Calibri, 11pt, style=regular</ApplicationDefaultFont>
21+
<ApplicationHighDpiMode>SystemAware</ApplicationHighDpiMode>
22+
<ApplicationVisualStyles>true</ApplicationVisualStyles>
23+
<ApplicationUseCompatibleTextRendering>false</ApplicationUseCompatibleTextRendering>
24+
</PropertyGroup>
25+
26+
<PropertyGroup>
27+
<NoWarn>$(NoWarn);WFDEV001</NoWarn>
28+
</PropertyGroup>
29+
30+
<ItemGroup>
31+
<ProjectReference Include="..\..\..\..\BuildAssist\BuildAssist.msbuildproj" />
32+
<ProjectReference Include="..\..\..\..\System.Design\src\System.Design.Facade.csproj" />
33+
<ProjectReference Include="..\..\..\..\System.Drawing.Design\src\System.Drawing.Design.Facade.csproj" />
34+
<ProjectReference Include="..\..\..\..\System.Windows.Forms.Design\src\System.Windows.Forms.Design.csproj" />
35+
<ProjectReference Include="..\..\..\..\System.Drawing.Common\src\System.Drawing.Common.csproj" />
36+
<ProjectReference Include="..\..\..\src\System.Windows.Forms.csproj" />
37+
<ProjectReference Include="..\System.Windows.Forms.IntegrationTests.Common\System.Windows.Forms.IntegrationTests.Common.csproj" />
38+
</ItemGroup>
39+
40+
<ItemGroup>
41+
<EmbeddedResource Include="Data\DragDrop\DragAccept.bmp">
42+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
43+
</EmbeddedResource>
44+
<EmbeddedResource Include="Data\DragDrop\DragAccept.rtf">
45+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
46+
</EmbeddedResource>
47+
<EmbeddedResource Include="Data\DragDrop\NyanCat1.bmp">
48+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
49+
</EmbeddedResource>
50+
<EmbeddedResource Include="Data\DragDrop\NyanCat2.bmp">
51+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
52+
</EmbeddedResource>
53+
<EmbeddedResource Include="Data\DragDrop\NyanCat3.bmp">
54+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
55+
</EmbeddedResource>
56+
<EmbeddedResource Include="Data\DragDrop\NyanCat4.bmp">
57+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
58+
</EmbeddedResource>
59+
<EmbeddedResource Include="Data\DragDrop\NyanCat5.bmp">
60+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
61+
</EmbeddedResource>
62+
<EmbeddedResource Include="Data\DragDrop\NyanCatAscii.txt">
63+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
64+
</EmbeddedResource>
65+
<EmbeddedResource Include="Data\DragDrop\NyanCatAscii_301.bmp">
66+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
67+
</EmbeddedResource>
68+
<EmbeddedResource Include="Data\DragDrop\ToolStripAsciiCat.bmp">
69+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
70+
</EmbeddedResource>
71+
<EmbeddedResource Include="Data\DragDrop\ToolStripDragAccept.bmp">
72+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
73+
</EmbeddedResource>
74+
<EmbeddedResource Include="Data\DragDrop\ToolStripNyanCat.bmp">
75+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
76+
</EmbeddedResource>
77+
<EmbeddedResource Include="Images\SmallA.bmp">
78+
<LogicalName>WinFormsControlsTest.SmallA.bmp</LogicalName>
79+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
80+
</EmbeddedResource>
81+
<EmbeddedResource Include="Images\SmallABlue.bmp">
82+
<LogicalName>WinFormsControlsTest.SmallABlue.bmp</LogicalName>
83+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
84+
</EmbeddedResource>
85+
<EmbeddedResource Include="Images\LargeA.bmp">
86+
<LogicalName>WinFormsControlsTest.LargeA.bmp</LogicalName>
87+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
88+
</EmbeddedResource>
89+
<EmbeddedResource Include="Images\LargeABlue.bmp">
90+
<LogicalName>WinFormsControlsTest.LargeABlue.bmp</LogicalName>
91+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
92+
</EmbeddedResource>
93+
</ItemGroup>
94+
95+
<ItemGroup>
96+
<PackageReference Include="System.Data.SqlClient" Version="5.0.0-alpha.1.19618.1" />
97+
<PackageReference Include="System.Management" Version="4.5.0-preview1-25914-04" />
98+
<PackageReference Include="System.Windows.Forms.DataVisualization" Version="1.0.0-prerelease.20110.1" />
99+
</ItemGroup>
100+
101+
<ItemGroup>
102+
<None Update="Data\example.rtf">
103+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
104+
</None>
105+
106+
<!--
107+
Library of Congress, Motion Picture, Broadcasting and Recorded Sound Division.
108+
Blechynden, Frederick, Camera, Inc Thomas A. Edison, and Paper Print Collection. Tourists going round
109+
Yellowstone Park. produceds by White, James H. Uction United States: Edison Manufacturing Co, 1899. Video.
110+
https://www.loc.gov/item/00694320/.
111+
-->
112+
<None Update="Resources\media.mpg">
113+
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
114+
</None>
115+
</ItemGroup>
116+
117+
<!--
118+
119+
Reference local analyzers for test purposes
120+
121+
-->
122+
<PropertyGroup>
123+
<!-- Don't try to resolve analyzers from <repo root>\.dotnet\packs\Microsoft.WindowsDesktop.App.Ref\<version>\ref\net6.0 -->
124+
<ResolveWinFormsAnalyzersFromSdkRefPack>false</ResolveWinFormsAnalyzersFromSdkRefPack>
125+
</PropertyGroup>
126+
127+
<ItemGroup>
128+
<ProjectReference Include="..\..\..\..\System.Windows.Forms.Analyzers\cs\src\Analyzers\System.Windows.Forms.Analyzers.CSharp.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
129+
<ProjectReference Include="..\..\..\..\System.Windows.Forms.Analyzers\cs\src\CodeFixes\System.Windows.Forms.Analyzers.CodeFixes.CSharp.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
130+
<ProjectReference Include="..\..\..\..\System.Windows.Forms.Analyzers\generic\src\System.Windows.Forms.Analyzers.csproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
131+
<ProjectReference Include="..\..\..\..\System.Windows.Forms.Analyzers\vb\src\Analyzers\System.Windows.Forms.Analyzers.VisualBasic.vbproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
132+
<ProjectReference Include="..\..\..\..\System.Windows.Forms.Analyzers\vb\src\CodeFixes\System.Windows.Forms.Analyzers.CodeFixes.VisualBasic.vbproj" ReferenceOutputAssembly="false" OutputItemType="Analyzer" />
133+
</ItemGroup>
134+
135+
<ItemGroup>
136+
<Reference Include="AxInterop.WMPLib">
137+
<HintPath>$(ArtifactsBinDir)\AxHosts\$(Configuration)\net472\AxInterop.WMPLib.dll</HintPath>
138+
</Reference>
139+
<Reference Include="Interop.WMPLib">
140+
<HintPath>$(ArtifactsBinDir)\AxHosts\$(Configuration)\net472\Interop.WMPLib.dll</HintPath>
141+
</Reference>
142+
</ItemGroup>
143+
144+
<ItemGroup>
145+
<Compile Update="MediaPlayer.cs" />
146+
</ItemGroup>
147+
148+
<Import Project="..\..\..\..\..\pkg\Microsoft.Private.Winforms\sdk\dotnet-wpf\System.Windows.Forms.Analyzers.props" />
149+
150+
</Project>

0 commit comments

Comments
 (0)