Skip to content

Commit

Permalink
Updated solution to the stable Roslyn release and fixed introduced wa…
Browse files Browse the repository at this point in the history
…rnings.
  • Loading branch information
Vannevelj committed Aug 5, 2015
1 parent ff17533 commit 2e80a19
Show file tree
Hide file tree
Showing 22 changed files with 83 additions and 85 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,48 +35,44 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CodeAnalysis, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<HintPath>..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Desktop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Desktop.dll</HintPath>
<HintPath>..\..\packages\Microsoft.CodeAnalysis.CSharp.1.0.0\lib\net45\Microsoft.CodeAnalysis.CSharp.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
<HintPath>..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.CodeAnalysis.CSharp.Workspaces.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.CSharp.Workspaces.Desktop.dll</HintPath>
<Reference Include="Microsoft.CodeAnalysis.VisualBasic, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.CodeAnalysis.VisualBasic.1.0.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Desktop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.CodeAnalysis.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Desktop.dll</HintPath>
<Reference Include="Microsoft.CodeAnalysis.VisualBasic.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.CodeAnalysis.VisualBasic.Workspaces.1.0.0\lib\net45\Microsoft.CodeAnalysis.VisualBasic.Workspaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<HintPath>..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="Microsoft.CodeAnalysis.Workspaces.Desktop, Version=1.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
<HintPath>..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0-rc2\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<HintPath>..\..\packages\Microsoft.CodeAnalysis.Workspaces.Common.1.0.0\lib\net45\Microsoft.CodeAnalysis.Workspaces.Desktop.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="nunit.framework, Version=3.0.5610.33194, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.3.0.0-beta-2\lib\net45\nunit.framework.dll</HintPath>
<Reference Include="nunit.framework, Version=2.6.4.14350, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
<HintPath>..\..\packages\NUnit.2.6.4\lib\nunit.framework.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="RoslynTester, Version=1.0.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\..\packages\RoslynTester.1.3.0-rc2\lib\RoslynTester.dll</HintPath>
<HintPath>..\..\packages\RoslynTester.1.4.0\lib\RoslynTester.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System" />
<Reference Include="System.Collections.Immutable, Version=1.1.33.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Collections.Immutable.1.1.33-beta\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
<Reference Include="System.Collections.Immutable, Version=1.1.36.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Collections.Immutable.1.1.36\lib\portable-net45+win8+wp8+wpa81\System.Collections.Immutable.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Composition.AttributedModel, Version=1.0.30.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
Expand All @@ -100,8 +96,8 @@
<Private>True</Private>
</Reference>
<Reference Include="System.Core" />
<Reference Include="System.Reflection.Metadata, Version=1.0.18.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Reflection.Metadata.1.0.18-beta\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
<Reference Include="System.Reflection.Metadata, Version=1.0.21.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\packages\System.Reflection.Metadata.1.0.21\lib\portable-net45+win8\System.Reflection.Metadata.dll</HintPath>
<Private>True</Private>
</Reference>
<Reference Include="System.Xml.Linq" />
Expand Down Expand Up @@ -134,7 +130,9 @@
<Compile Include="Tests\Utilities\NamingConventionsTests.cs" />
</ItemGroup>
<ItemGroup>
<None Include="app.config" />
<None Include="app.config">
<SubType>Designer</SubType>
</None>
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
Expand All @@ -147,8 +145,8 @@
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\..\packages\Microsoft.CodeAnalysis.Analyzers.1.0.0-rc2\tools\analyzers\C#\Microsoft.CodeAnalysis.Analyzers.dll" />
<Analyzer Include="..\..\packages\Microsoft.CodeAnalysis.Analyzers.1.0.0-rc2\tools\analyzers\C#\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" />
<Analyzer Include="..\..\packages\Microsoft.CodeAnalysis.Analyzers.1.0.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.Analyzers.dll" />
<Analyzer Include="..\..\packages\Microsoft.CodeAnalysis.Analyzers.1.0.0\analyzers\dotnet\cs\Microsoft.CodeAnalysis.CSharp.Analyzers.dll" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Expand Down
8 changes: 8 additions & 0 deletions VSDiagnostics/VSDiagnostics/VSDiagnostics.Test/app.config
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@
<assemblyIdentity name="System.Composition.Hosting" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.30.0" newVersion="1.0.30.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Collections.Immutable" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.1.36.0" newVersion="1.1.36.0" />
</dependentAssembly>
<dependentAssembly>
<assemblyIdentity name="System.Reflection.Metadata" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
<bindingRedirect oldVersion="0.0.0.0-1.0.18.0" newVersion="1.0.18.0" />
</dependentAssembly>
</assemblyBinding>
</runtime>
<startup>
Expand Down
26 changes: 13 additions & 13 deletions VSDiagnostics/VSDiagnostics/VSDiagnostics.Test/packages.config
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>

<packages>
<package id="Microsoft.CodeAnalysis.Analyzers" version="1.0.0-rc2" targetFramework="net45" userInstalled="true" />
<package id="Microsoft.CodeAnalysis.Common" version="1.0.0-rc2" targetFramework="net45" userInstalled="true" />
<package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0-rc2" targetFramework="net45" userInstalled="true" />
<package id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="1.0.0-rc2" targetFramework="net45"
userInstalled="true" />
<package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0-rc2" targetFramework="net45"
userInstalled="true" />
<package id="Microsoft.Composition" version="1.0.30" targetFramework="net45" userInstalled="true" />
<package id="NUnit" version="3.0.0-beta-2" targetFramework="net45" userInstalled="true" />
<package id="RoslynTester" version="1.3.0-rc2" targetFramework="net45" userInstalled="true" />
<package id="System.Collections.Immutable" version="1.1.33-beta" targetFramework="net45" userInstalled="true" />
<package id="System.Reflection.Metadata" version="1.0.18-beta" targetFramework="net45" userInstalled="true" />
<package id="Microsoft.CodeAnalysis" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.Analyzers" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.Common" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.CSharp" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.CSharp.Workspaces" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.VisualBasic" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.VisualBasic.Workspaces" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.CodeAnalysis.Workspaces.Common" version="1.0.0" targetFramework="net45" />
<package id="Microsoft.Composition" version="1.0.30" targetFramework="net45" />
<package id="NUnit" version="2.6.4" targetFramework="net45" />
<package id="RoslynTester" version="1.4.0" targetFramework="net45" />
<package id="System.Collections.Immutable" version="1.1.36" targetFramework="net45" />
<package id="System.Reflection.Metadata" version="1.0.21" targetFramework="net45" />
</packages>
4 changes: 2 additions & 2 deletions VSDiagnostics/VSDiagnostics/VSDiagnostics/Diagnostic.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<package>
<metadata>
<id>VSDiagnostics</id>
<version>1.7.0-rc2</version>
<version>1.8.0</version>
<title>VSDiagnostics</title>
<authors>Jeroen Vannevel</authors>
<owners>Jeroen Vannevel</owners>
<licenseUrl>https://github.com/Vannevelj/VSDiagnostics/blob/master/LICENSE</licenseUrl>
<projectUrl>https://github.com/Vannevelj/VSDiagnostics</projectUrl>
<requireLicenseAcceptance>false</requireLicenseAcceptance>
<description>A collection of code-quality analyzers based on the new Roslyn platform. This project aims to ensure code-quality as you type it in your editor rather than having to do this as a separate build-step.</description>
<releaseNotes>For the latest releasenotes, see the Github release: https://github.com/Vannevelj/VSDiagnostics/releases/tag/v1.7.0-rc2 </releaseNotes>
<releaseNotes>For the latest releasenotes, see the Github release: https://github.com/Vannevelj/VSDiagnostics/releases/tag/v1.8.0 </releaseNotes>
<copyright>Jeroen Vannevel</copyright>
<tags>Visual Studio, Roslyn, Diagnostics, Analyzers</tags>
<frameworkAssemblies>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var diagnosticSpan = diagnostic.Location.SourceSpan;
var methodDeclaration = root.FindToken(diagnosticSpan.Start).Parent.AncestorsAndSelf().OfType<MethodDeclarationSyntax>().First();

context.RegisterCodeFix(CodeAction.Create("Add suffix", x => AddSuffixAsync(context.Document, methodDeclaration, context.CancellationToken)), diagnostic);
context.RegisterCodeFix(CodeAction.Create("Add suffix", x => AddSuffixAsync(context.Document, methodDeclaration, context.CancellationToken), nameof(AsyncMethodWithoutAsyncSuffixAnalyzer)), diagnostic);
}

private async Task<Solution> AddSuffixAsync(Document document, MethodDeclarationSyntax methodDeclaration, CancellationToken cancellationToken)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var diagnosticSpan = diagnostic.Location.SourceSpan;
var objectCreationExpression = root.FindToken(diagnosticSpan.Start).Parent.AncestorsAndSelf().OfType<ObjectCreationExpressionSyntax>().First();

context.RegisterCodeFix(CodeAction.Create("Use nameof", x => UseNameofAsync(context.Document, root, objectCreationExpression)), diagnostic);
context.RegisterCodeFix(CodeAction.Create("Use nameof", x => UseNameofAsync(context.Document, root, objectCreationExpression), nameof(ArgumentExceptionWithoutNameofOperatorAnalyzer)), diagnostic);
}

private Task<Solution> UseNameofAsync(Document document, SyntaxNode root, ObjectCreationExpressionSyntax objectCreationExpression)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var diagnosticSpan = diagnostic.Location.SourceSpan;
var throwStatement = root.FindNode(diagnosticSpan).AncestorsAndSelf().OfType<ThrowStatementSyntax>().First();

context.RegisterCodeFix(CodeAction.Create("Remove rethrow", x => RemoveRethrowAsync(context.Document, root, throwStatement)), diagnostic);
context.RegisterCodeFix(CodeAction.Create("Remove rethrow", x => RemoveRethrowAsync(context.Document, root, throwStatement), nameof(RethrowExceptionWithoutLosingStacktraceAnalyzer)), diagnostic);
}

private Task<Solution> RemoveRethrowAsync(Document document, SyntaxNode root, ThrowStatementSyntax throwStatement)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var diagnosticSpan = diagnostic.Location.SourceSpan;

var statement = root.FindNode(diagnosticSpan);
context.RegisterCodeFix(CodeAction.Create("Simplify expression", x => SimplifyExpressionAsync(context.Document, root, statement)), diagnostic);
context.RegisterCodeFix(CodeAction.Create("Simplify expression", x => SimplifyExpressionAsync(context.Document, root, statement), nameof(CompareBooleanToTrueLiteralAnalyzer)), diagnostic);
}

private Task<Solution> SimplifyExpressionAsync(Document document, SyntaxNode root, SyntaxNode statement)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var diagnosticSpan = diagnostic.Location.SourceSpan;

var statement = root.FindNode(diagnosticSpan);
context.RegisterCodeFix(CodeAction.Create("Remove conditional", x => RemoveConditionalAsync(context.Document, root, statement)), diagnostic);
context.RegisterCodeFix(CodeAction.Create("Remove conditional", x => RemoveConditionalAsync(context.Document, root, statement), nameof(ConditionalOperatorReturnsDefaultOptionsAnalyzer)), diagnostic);
}

private Task<Solution> RemoveConditionalAsync(Document document, SyntaxNode root, SyntaxNode statement)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var diagnosticSpan = diagnostic.Location.SourceSpan;

var statement = root.FindNode(diagnosticSpan);
context.RegisterCodeFix(CodeAction.Create("Use braces", x => UseBracesNotationAsync(context.Document, root, statement)), diagnostic);
context.RegisterCodeFix(CodeAction.Create("Use braces", x => UseBracesNotationAsync(context.Document, root, statement), nameof(IfStatementWithoutBracesAnalyzer)), diagnostic);
}

private Task<Solution> UseBracesNotationAsync(Document document, SyntaxNode root, SyntaxNode statement)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var diagnosticSpan = diagnostic.Location.SourceSpan;

var identifier = root.FindToken(diagnosticSpan.Start);
context.RegisterCodeFix(CodeAction.Create("Rename", x => RenameAsync(context.Document, root, identifier)), diagnostic);
context.RegisterCodeFix(CodeAction.Create("Rename", x => RenameAsync(context.Document, root, identifier), nameof(NamingConventionsAnalyzer)), diagnostic);
}

private Task<Solution> RenameAsync(Document document, SyntaxNode root, SyntaxToken identifier)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var diagnosticSpan = diagnostic.Location.SourceSpan;

var statement = root.FindNode(diagnosticSpan);
context.RegisterCodeFix(CodeAction.Create("Use property", x => UsePropertyAsync(context.Document, statement)), diagnostic);
context.RegisterCodeFix(CodeAction.Create("Use property", x => UsePropertyAsync(context.Document, statement), nameof(NonEncapsulatedOrMutableFieldAnalyzer)), diagnostic);
}

private async Task<Solution> UsePropertyAsync(Document document, SyntaxNode statement)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var diagnosticSpan = diagnostic.Location.SourceSpan;

var declaration = root.FindToken(diagnosticSpan.Start);
context.RegisterCodeFix(CodeAction.Create("Use shorthand notation", x => UseShorthandNotationAsync(context.Document, root, declaration)), diagnostic);
context.RegisterCodeFix(CodeAction.Create("Use shorthand notation", x => UseShorthandNotationAsync(context.Document, root, declaration), nameof(NullableToShorthandAnalyzer)), diagnostic);
}

private static async Task<Solution> UseShorthandNotationAsync(Document document, SyntaxNode root, SyntaxToken declaration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var diagnosticSpan = diagnostic.Location.SourceSpan;

var argumentDeclaration = root.FindNode(diagnosticSpan).AncestorsAndSelf().OfType<ArgumentSyntax>().FirstOrDefault();
context.RegisterCodeFix(CodeAction.Create("Use nameof", x => UseNameOfAsync(context.Document, root, argumentDeclaration)), diagnostic);
context.RegisterCodeFix(CodeAction.Create("Use nameof", x => UseNameOfAsync(context.Document, root, argumentDeclaration), nameof(OnPropertyChangedWithoutNameOfOperatorAnalyzer)), diagnostic);
}

private Task<Solution> UseNameOfAsync(Document document, SyntaxNode root, ArgumentSyntax argumentDeclaration)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ public override async Task RegisterCodeFixesAsync(CodeFixContext context)
var diagnosticSpan = diagnostic.Location.SourceSpan;

var statement = root.FindNode(diagnosticSpan);
context.RegisterCodeFix(CodeAction.Create("Use expression bodied member", x => UseExpressionBodiedMemberAsync(context.Document, root, statement)), diagnostic);
context.RegisterCodeFix(CodeAction.Create("Use expression bodied member", x => UseExpressionBodiedMemberAsync(context.Document, root, statement), nameof(SimplifyExpressionBodiedMemberAnalyzer)), diagnostic);
}

private Task<Solution> UseExpressionBodiedMemberAsync(Document document, SyntaxNode root, SyntaxNode statement)
Expand Down

0 comments on commit 2e80a19

Please sign in to comment.