Skip to content

Commit

Permalink
Update packages to avoid build errors
Browse files Browse the repository at this point in the history
  • Loading branch information
sharwell committed Nov 9, 2021
1 parent a623193 commit 67850fe
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 2 deletions.
2 changes: 1 addition & 1 deletion StyleCop.Analyzers/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
<PackageReference Include="AsyncUsageAnalyzers" Version="1.0.0-alpha003" PrivateAssets="all" />
<PackageReference Include="DotNetAnalyzers.DocumentationAnalyzers" Version="1.0.0-beta.46" PrivateAssets="all" />
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.304" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.0" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.2" PrivateAssets="all" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeStyle" Version="3.8.0" PrivateAssets="all" />
</ItemGroup>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,36 @@

namespace StyleCop.Analyzers.Test.CSharp10.DocumentationRules
{
using Microsoft.CodeAnalysis.Testing;
using StyleCop.Analyzers.Test.CSharp9.DocumentationRules;
using static StyleCop.Analyzers.Test.Verifiers.StyleCopCodeFixVerifier<
StyleCop.Analyzers.DocumentationRules.SA1600ElementsMustBeDocumented,
StyleCop.Analyzers.DocumentationRules.SA1600CodeFixProvider>;

public class SA1600CSharp10UnitTests : SA1600CSharp9UnitTests
{
protected override DiagnosticResult[] GetExpectedResultTestRegressionMethodGlobalNamespace(string code)
{
if (code == "public void {|#0:TestMember|}() { }")
{
return new[]
{
// /0/Test0.cs(4,1): error CS0106: The modifier 'public' is not valid for this item
DiagnosticResult.CompilerError("CS0106").WithSpan(4, 1, 4, 7).WithArguments("public"),

// /0/Test0.cs(4,1): error CS8320: Feature 'top-level statements' is not available in C# 7.2. Please use language version 9.0 or greater.
DiagnosticResult.CompilerError("CS8320").WithSpan(4, 1, 4, 29).WithArguments("top-level statements", "9.0"),

// /0/Test0.cs(4,1): error CS8805: Program using top-level statements must be an executable.
DiagnosticResult.CompilerError("CS8805").WithSpan(4, 1, 4, 29),
};
}

return new[]
{
DiagnosticResult.CompilerError("CS0116").WithMessage("A namespace cannot directly contain members such as fields, methods or statements").WithLocation(0),
Diagnostic().WithLocation(0),
};
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ namespace StyleCop.Analyzers.Test.Verifiers
{
using System;
using System.Collections.Immutable;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using Microsoft.CodeAnalysis;
Expand All @@ -18,6 +19,8 @@ internal static class GenericAnalyzerTest

internal static readonly ReferenceAssemblies ReferenceAssembliesNet50;

internal static readonly ReferenceAssemblies ReferenceAssembliesNet60;

private static readonly Lazy<IExportProviderFactory> ExportProviderFactory;

static GenericAnalyzerTest()
Expand All @@ -28,6 +31,7 @@ static GenericAnalyzerTest()
1 => "1.2.1",
2 => "2.8.2",
3 => "3.6.0",
4 => "4.0.1",
_ => throw new InvalidOperationException("Unknown version."),
};

Expand All @@ -38,6 +42,16 @@ static GenericAnalyzerTest()
ReferenceAssembliesNet50 = ReferenceAssemblies.Net.Net50.AddPackages(ImmutableArray.Create(
new PackageIdentity("Microsoft.CodeAnalysis.CSharp", codeAnalysisTestVersion)));

ReferenceAssembliesNet60 =
new ReferenceAssemblies(
"net6.0",
new PackageIdentity(
"Microsoft.NETCore.App.Ref",
"6.0.0"),
Path.Combine("ref", "net6.0"))
.AddPackages(ImmutableArray.Create(
new PackageIdentity("Microsoft.CodeAnalysis.CSharp", codeAnalysisTestVersion)));

ExportProviderFactory = new Lazy<IExportProviderFactory>(
() =>
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="15.1.192" PrivateAssets="all" />
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="16.8.3038" PrivateAssets="all" />
</ItemGroup>

<ItemGroup>
Expand Down

0 comments on commit 67850fe

Please sign in to comment.