Skip to content

Commit 201b8c4

Browse files
committed
Use newer vs-mef analyzers
The vs-mef library received several new analyzers recently. This change bumps the package version and addresses all new diagnostics.
1 parent b414946 commit 201b8c4

File tree

4 files changed

+9
-6
lines changed

4 files changed

+9
-6
lines changed

Directory.Packages.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
<PackageVersion Include="Microsoft.ServiceHub.Framework" Version="4.9.11-beta" />
4747
<PackageVersion Include="Microsoft.VisualStudio.ComponentModelHost" Version="17.14.116" />
4848
<PackageVersion Include="Microsoft.VisualStudio.Composition" Version="17.13.50" />
49+
<PackageVersion Include="Microsoft.VisualStudio.Composition.Analyzers" Version="18.3.29-preview" />
4950
<PackageVersion Include="Microsoft.VisualStudio.Data.Core" Version="18.0.1755-preview.1" />
5051
<PackageVersion Include="Microsoft.VisualStudio.Data.Services" Version="18.0.1755-preview.1" />
5152
<PackageVersion Include="Microsoft.VisualStudio.DataDesign.Common" Version="18.0.1755-preview.1" />

eng/imports/HostAgnostic.props

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333

3434
<!-- VS MEF -->
3535
<PackageReference Include="Microsoft.VisualStudio.Composition" />
36+
<PackageReference Include="Microsoft.VisualStudio.Composition.Analyzers" />
3637

3738
<PackageReference Include="MessagePack" />
3839

src/Microsoft.VisualStudio.ProjectSystem.Managed.VS/ProjectSystem/VS/Automation/VsBuildManager.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ internal VSBuildManager(IProjectThreadingService threadingService, IUnconfigured
3838

3939
// This has to be a property import to prevent a circular dependency as the bridge imports this class in order to fire events
4040
[Import]
41-
internal Lazy<IDesignTimeInputsBuildManagerBridge, IAppliesToMetadataView>? DesignTimeInputsBuildManagerBridge { get; private set; }
41+
internal Lazy<IDesignTimeInputsBuildManagerBridge, IAppliesToMetadataView> DesignTimeInputsBuildManagerBridge { get; private set; } = null!;
4242

4343
/// <summary>
4444
/// Occurs when a design time output moniker is deleted.
@@ -72,7 +72,7 @@ public object DesignTimeOutputMonikers
7272
{
7373
get
7474
{
75-
if (DesignTimeInputsBuildManagerBridge?.AppliesTo(_unconfiguredProjectServices.Project.Capabilities) == true)
75+
if (DesignTimeInputsBuildManagerBridge.AppliesTo(_unconfiguredProjectServices.Project.Capabilities))
7676
{
7777
IDesignTimeInputsBuildManagerBridge bridge = DesignTimeInputsBuildManagerBridge.Value;
7878

@@ -91,7 +91,7 @@ public object DesignTimeOutputMonikers
9191
/// </summary>
9292
public string BuildDesignTimeOutput(string bstrOutputMoniker)
9393
{
94-
if (DesignTimeInputsBuildManagerBridge?.AppliesTo(_unconfiguredProjectServices.Project.Capabilities) == true)
94+
if (DesignTimeInputsBuildManagerBridge.AppliesTo(_unconfiguredProjectServices.Project.Capabilities))
9595
{
9696
IDesignTimeInputsBuildManagerBridge bridge = DesignTimeInputsBuildManagerBridge.Value;
9797

tests/Microsoft.VisualStudio.ProjectSystem.Managed.VS.UnitTests/ProjectSystem/VS/ComponentComposition.ScopeComponents.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements. The .NET Foundation licenses this file to you under the MIT license. See the LICENSE.md file in the project root for more information.
22

33
#pragma warning disable IDE0051 // Remove unused private members
4+
#pragma warning disable VSMEF003 // Exported type not implemented by exporting class
45

56
using ImportAttribute = System.Composition.ImportAttribute;
67
using ExportAttribute = System.Composition.ExportAttribute;
@@ -19,7 +20,7 @@ private class GlobalScope
1920
{
2021
[Import]
2122
[SharingBoundary(ExportContractNames.Scopes.ProjectService)]
22-
private System.Composition.ExportFactory<IProjectService>? ProjectServiceFactory { get; set; }
23+
private System.Composition.ExportFactory<IProjectService> ProjectServiceFactory { get; set; } = null!;
2324
}
2425

2526
[Export(typeof(IProjectService))]
@@ -28,7 +29,7 @@ private class ProjectServiceScope
2829
{
2930
[Import]
3031
[SharingBoundary(ExportContractNames.Scopes.UnconfiguredProject)]
31-
private ExportFactory<UnconfiguredProject>? UnconfiguredProjectFactory { get; set; }
32+
private ExportFactory<UnconfiguredProject> UnconfiguredProjectFactory { get; set; } = null!;
3233
}
3334

3435
[Export(typeof(UnconfiguredProject))]
@@ -37,7 +38,7 @@ private class UnconfiguredProjectScope
3738
{
3839
[Import]
3940
[SharingBoundary(ExportContractNames.Scopes.ConfiguredProject)]
40-
private ExportFactory<ConfiguredProject>? ConfiguredProjectFactory { get; set; }
41+
private ExportFactory<ConfiguredProject> ConfiguredProjectFactory { get; set; } = null!;
4142
}
4243

4344
[Export(typeof(ConfiguredProject))]

0 commit comments

Comments
 (0)