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

Merge release/6.x to main #1473

Merged
merged 40 commits into from
Mar 1, 2022
Merged
Changes from 3 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
e5ad844
Update dependencies from https://github.com/dotnet/roslyn build 20211…
dotnet-maestro[bot] Dec 17, 2021
38e82ce
Use AnalyzerFileReference when loading analyzers
JoeRobich Dec 19, 2021
cd118c4
Add comment
JoeRobich Dec 19, 2021
cf375d5
Fix double add scenario
JoeRobich Dec 19, 2021
a72ab9d
Update dependencies from https://github.com/dotnet/roslyn build 20211…
dotnet-maestro[bot] Dec 20, 2021
74c1bfb
Update dependencies from https://github.com/dotnet/arcade build 20211…
dotnet-maestro[bot] Dec 21, 2021
a13780d
Update dependencies from https://github.com/dotnet/roslyn build 20220…
dotnet-maestro[bot] Jan 4, 2022
bcbe2e7
Update dependencies from https://github.com/dotnet/arcade build 20220…
dotnet-maestro[bot] Jan 4, 2022
59a2767
Update dependencies from https://github.com/dotnet/arcade build 20220…
dotnet-maestro[bot] Jan 5, 2022
272b450
Update dependencies from https://github.com/dotnet/arcade build 20220…
dotnet-maestro[bot] Jan 13, 2022
96dae0e
Update dependencies from https://github.com/dotnet/arcade build 20220…
dotnet-maestro[bot] Jan 20, 2022
ebd6260
Downgrade System.CommandLine. Reverts https://github.com/dotnet/forma…
JoeRobich Jan 20, 2022
cd8eeeb
Ran dotnet-format
JoeRobich Jan 20, 2022
33fcee1
Skip Roslyn integration test.
JoeRobich Jan 20, 2022
901fc23
Merge pull request #1497 from JoeRobich/downgrade-commandline
JoeRobich Jan 20, 2022
617b261
Update devcontainer for NET 6
JoeRobich Jan 26, 2022
9e6f3e4
Merge pull request #1503 from JoeRobich/fix-devcontainer
JoeRobich Jan 26, 2022
d010015
Update dependencies from https://github.com/dotnet/arcade build 20220…
dotnet-maestro[bot] Jan 28, 2022
74fba77
Update dependencies from https://github.com/dotnet/arcade build 20220…
dotnet-maestro[bot] Feb 3, 2022
c764c85
Update dependencies from https://github.com/dotnet/arcade build 20220…
dotnet-maestro[bot] Feb 5, 2022
a98697c
Update dependencies from https://github.com/dotnet/roslyn build 20220…
dotnet-maestro[bot] Feb 8, 2022
3ea63e9
Update dependencies from https://github.com/dotnet/arcade build 20220…
dotnet-maestro[bot] Feb 8, 2022
1b57132
Update dependencies from https://github.com/dotnet/arcade build 20220…
dotnet-maestro[bot] Feb 10, 2022
3652e43
Update dependencies from https://github.com/dotnet/roslyn build 20220…
dotnet-maestro[bot] Feb 11, 2022
ed22cd4
Update dependencies from https://github.com/dotnet/roslyn build 20220…
dotnet-maestro[bot] Feb 15, 2022
8d65d73
Update dependencies from https://github.com/dotnet/arcade build 20220…
dotnet-maestro[bot] Feb 15, 2022
46fbb91
Update dependencies from https://github.com/dotnet/roslyn build 20220…
dotnet-maestro[bot] Feb 17, 2022
5c5803f
Update dependencies from https://github.com/dotnet/arcade build 20220…
dotnet-maestro[bot] Feb 17, 2022
570440c
Update dependencies from https://github.com/dotnet/arcade build 20220…
dotnet-maestro[bot] Feb 23, 2022
c93edfb
Merge pull request #1470 from dotnet/darc-release/6.x-3b560e25-48ec-4…
JoeRobich Feb 23, 2022
51c4f22
Update NuGet version to match 6.0.101 sdk
JoeRobich Feb 23, 2022
c8685d7
Merge pull request #1475 from dotnet/darc-release/6.x-d8c50cd4-684b-4…
JoeRobich Feb 23, 2022
340502a
Merge remote-tracking branch 'origin/main' into merges/release/6.x-to…
JoeRobich Feb 28, 2022
418ad58
Update dependencies from https://github.com/dotnet/roslyn build 20220…
dotnet-maestro[bot] Feb 28, 2022
5c0a685
Update Microsoft.CodeAnalysis.Analyzers version to 3.3.3
JoeRobich Feb 28, 2022
b074485
Merge pull request #1532 from dotnet/darc-release/6.x-8c0890ef-e85f-4…
JoeRobich Feb 28, 2022
801b92c
Update dependencies from https://github.com/dotnet/roslyn build 20220…
dotnet-maestro[bot] Feb 28, 2022
0296568
Merge pull request #1533 from dotnet/darc-release/6.x-00f96554-a3f2-4…
JoeRobich Mar 1, 2022
4a64248
Merge remote-tracking branch 'origin/release/6.x' into merges/release…
JoeRobich Mar 1, 2022
0389cec
Ignore diagnostics during MVC project loading test
JoeRobich Mar 1, 2022
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
16 changes: 13 additions & 3 deletions src/Analyzers/AnalyzerReferenceInformationProvider.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information.
// Copyright (c) Microsoft. All Rights Reserved. Licensed under the MIT license. See License.txt in the project root for license information.

using System;
using System.Collections.Generic;
Expand All @@ -7,6 +7,7 @@
using System.Linq;
using System.Reflection;
using System.Runtime.Loader;
using Microsoft.CodeAnalysis.Diagnostics;
using Microsoft.CodeAnalysis.Tools.Utilities;
using Microsoft.Extensions.Logging;

Expand All @@ -31,14 +32,14 @@ public ImmutableDictionary<ProjectId, AnalyzersAndFixers> GetAnalyzersAndFixers(
private AnalyzersAndFixers GetAnalyzersAndFixers(Project project)
{
var analyzerAssemblies = project.AnalyzerReferences
.Select(reference => TryLoadAssemblyFrom(reference.FullPath))
.Select(reference => TryLoadAssemblyFrom(reference.FullPath, reference as AnalyzerFileReference))
.OfType<Assembly>()
.ToImmutableArray();

return AnalyzerFinderHelpers.LoadAnalyzersAndFixers(analyzerAssemblies);
}

private static Assembly? TryLoadAssemblyFrom(string? path)
private static Assembly? TryLoadAssemblyFrom(string? path, AnalyzerFileReference? analyzerFileReference)
{
// Since we are not deploying these assemblies we need to ensure the files exist.
if (path is null || !File.Exists(path))
Expand All @@ -55,6 +56,15 @@ private AnalyzersAndFixers GetAnalyzersAndFixers(Project project)

try
{
if (analyzerFileReference is not null)
{
// If we have access to the analyzer file reference we can prepopulate our
// cache with the assembly. We will still go through the AnalyzerLoadContext
// so that dependency resolution will be handled.
var analyzerAssembly = analyzerFileReference.GetAssembly();
s_namesToAssemblies.TryAdd(analyzerAssembly.GetName().FullName, analyzerAssembly);
}

var context = new AnalyzerLoadContext(path);
var assembly = context.LoadFromAssemblyPath(path);

Expand Down