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/dev17.7 to main #67994

Merged
merged 19 commits into from
May 1, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
c4a24b3
Use exception with specific type and HResult to aid tracking in telem…
tmat Mar 4, 2023
a37be08
Associate rude edits with project id
tmat Mar 4, 2023
df678c8
Update the packages and add fix
Cosifne Apr 4, 2023
6a378d3
Remove service hub version
Cosifne Apr 4, 2023
dd8fdbd
Fix null warning
Cosifne Apr 4, 2023
0e0741d
Fix nullable warning
Cosifne Apr 4, 2023
ce420eb
Downgrade MicrosoftVisualStudioCompositionVersion to maintain analyze…
Cosifne Apr 5, 2023
00770db
Change servicehub package version to maintain the same version of ser…
Cosifne Apr 5, 2023
0c24919
Fix nullable warning
Cosifne Apr 5, 2023
bb94f18
Merge remote-tracking branch 'upstream/release/dev17.6-vs-deps' into …
Cosifne Apr 7, 2023
a10bbf2
Merge pull request #67639 from dotnet/dev/shech/CheckConfigurationCap…
Cosifne Apr 11, 2023
3248c02
Merge pull request #67178 from tmat/RudeEditProjectId
arunchndr Apr 11, 2023
a6aeb31
[17.6] Cache source generator node tables only if their state counts …
jjonescz Apr 11, 2023
6181785
Port EnC telemetry improvements to 17.6 (#67752)
tmat Apr 11, 2023
ba68579
Merge pull request #67761 from dotnet/merges/release/dev17.5-vs-deps-…
dotnet-bot Apr 11, 2023
9123d36
Merge pull request #67763 from dotnet/merges/release/dev17.6-to-relea…
dotnet-bot Apr 12, 2023
d78a163
Merge pull request #67769 from dotnet/merges/release/dev17.6-to-relea…
dotnet-bot Apr 12, 2023
4c8fb00
Merge branch 'release/dev17.7' into merges/release/dev17.6-vs-deps-to…
tmat Apr 26, 2023
5639322
Merge pull request #67969 from dotnet/merges/release/dev17.6-vs-deps-…
dotnet-bot Apr 26, 2023
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
30 changes: 15 additions & 15 deletions eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -25,24 +25,23 @@
<MicrosoftVisualStudioExtensibilityTestingVersion>0.1.149-beta</MicrosoftVisualStudioExtensibilityTestingVersion>
<!-- CodeStyleAnalyzerVersion should we updated together with version of dotnet-format in dotnet-tools.json -->
<CodeStyleAnalyzerVersion>4.3.0-1.final</CodeStyleAnalyzerVersion>
<VisualStudioEditorPackagesVersion>17.6.76-preview</VisualStudioEditorPackagesVersion>
<VisualStudioEditorPackagesVersion>17.6.252</VisualStudioEditorPackagesVersion>
<!-- This should generally be set to $(VisualStudioEditorPackagesVersion),
but sometimes EditorFeatures.Cocoa specifically requires a newer editor build. -->
<VisualStudioMacEditorPackagesVersion>$(VisualStudioEditorPackagesVersion)</VisualStudioMacEditorPackagesVersion>
<ILAsmPackageVersion>6.0.0-rtm.21518.12</ILAsmPackageVersion>
<ILDAsmPackageVersion>6.0.0-rtm.21518.12</ILDAsmPackageVersion>
<MicrosoftVisualStudioLanguageServerClientPackagesVersion>17.6.26-preview</MicrosoftVisualStudioLanguageServerClientPackagesVersion>
<MicrosoftVisualStudioLanguageServerProtocolPackagesVersion>17.6.15-preview</MicrosoftVisualStudioLanguageServerProtocolPackagesVersion>
<MicrosoftVisualStudioShellPackagesVersion>17.5.33422.76</MicrosoftVisualStudioShellPackagesVersion>
<MicrosoftVisualStudioLanguageServerProtocolPackagesVersion>17.6.22</MicrosoftVisualStudioLanguageServerProtocolPackagesVersion>
<MicrosoftVisualStudioShellPackagesVersion>17.6.35829</MicrosoftVisualStudioShellPackagesVersion>
<RefOnlyMicrosoftBuildPackagesVersion>16.10.0</RefOnlyMicrosoftBuildPackagesVersion>
<!-- The version of Roslyn we build Source Generators against that are built in this
repository. This must be lower than MicrosoftNetCompilersToolsetVersion,
but not higher than our minimum dogfoodable Visual Studio version, or else
the generators we build would load on the command line but not load in IDEs. -->
<SourceGeneratorMicrosoftCodeAnalysisVersion>4.1.0</SourceGeneratorMicrosoftCodeAnalysisVersion>
<MicrosoftILVerificationVersion>7.0.0-alpha.1.22060.1</MicrosoftILVerificationVersion>
<MicrosoftServiceHubVersion>4.1.3100</MicrosoftServiceHubVersion>
<MicrosoftVisualStudioThreadingPackagesVersion>17.5.21</MicrosoftVisualStudioThreadingPackagesVersion>
<MicrosoftVisualStudioThreadingPackagesVersion>17.6.40</MicrosoftVisualStudioThreadingPackagesVersion>
<MicrosoftTestPlatformVersion>17.4.0-preview-20220707-01</MicrosoftTestPlatformVersion>
</PropertyGroup>
<!--
Expand Down Expand Up @@ -114,6 +113,7 @@
<MicrosoftInternalVisualStudioInteropVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftInternalVisualStudioInteropVersion>
<MicrosoftInternalVisualStudioShellFrameworkVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftInternalVisualStudioShellFrameworkVersion>
<MicrosoftmacOSRefVersion>12.3.300-rc.3.83</MicrosoftmacOSRefVersion>
<MicrosoftIORedistVersion>6.0.0</MicrosoftIORedistVersion>
<MicrosoftMetadataVisualizerVersion>1.0.0-beta3.21075.2</MicrosoftMetadataVisualizerVersion>
<MicrosoftNETBuildExtensionsVersion>2.2.101</MicrosoftNETBuildExtensionsVersion>
<MicrosoftNETCorePlatformsVersion>5.0.0</MicrosoftNETCorePlatformsVersion>
Expand All @@ -127,8 +127,8 @@
<MicrosoftNetSdkVersion>2.0.0-alpha-20170405-2</MicrosoftNetSdkVersion>
<MicrosoftNuGetBuildTasksVersion>0.1.0</MicrosoftNuGetBuildTasksVersion>
<MicrosoftPortableTargetsVersion>0.1.2-dev</MicrosoftPortableTargetsVersion>
<MicrosoftServiceHubClientVersion>$(MicrosoftServiceHubVersion)</MicrosoftServiceHubClientVersion>
<MicrosoftServiceHubFrameworkVersion>$(MicrosoftServiceHubVersion)</MicrosoftServiceHubFrameworkVersion>
<MicrosoftServiceHubClientVersion>4.2.1009</MicrosoftServiceHubClientVersion>
<MicrosoftServiceHubFrameworkVersion>4.2.100</MicrosoftServiceHubFrameworkVersion>
<MicrosoftSourceLinkToolsVersion>1.1.1-beta-21566-01</MicrosoftSourceLinkToolsVersion>
<MicrosoftTeamFoundationServerClientVersion>16.170.0</MicrosoftTeamFoundationServerClientVersion>
<MicrosoftTestPlatformTranslationLayerVersion>$(MicrosoftTestPlatformVersion)</MicrosoftTestPlatformTranslationLayerVersion>
Expand All @@ -137,8 +137,8 @@
<MicrosoftVisualStudioCacheVersion>17.3.26-alpha</MicrosoftVisualStudioCacheVersion>
<MicrosoftVisualStudioCallHierarchyPackageDefinitionsVersion>15.8.27812-alpha</MicrosoftVisualStudioCallHierarchyPackageDefinitionsVersion>
<MicrosoftVisualStudioCodeAnalysisSdkUIVersion>15.8.27812-alpha</MicrosoftVisualStudioCodeAnalysisSdkUIVersion>
<MicrosoftVisualStudioComponentModelHostVersion>17.6.76-preview</MicrosoftVisualStudioComponentModelHostVersion>
<MicrosoftVisualStudioCompositionVersion>16.9.20</MicrosoftVisualStudioCompositionVersion>
<MicrosoftVisualStudioComponentModelHostVersion>17.6.199-preview</MicrosoftVisualStudioComponentModelHostVersion>
<MicrosoftVisualStudioCompositionVersion>17.6.6</MicrosoftVisualStudioCompositionVersion>
<MicrosoftVisualStudioCoreUtilityVersion>$(VisualStudioEditorPackagesVersion)</MicrosoftVisualStudioCoreUtilityVersion>
<MicrosoftVisualStudioDebuggerUIInterfacesVersion>17.4.0-beta.22368.1</MicrosoftVisualStudioDebuggerUIInterfacesVersion>
<MicrosoftVisualStudioDebuggerContractsVersion>17.4.0-beta.22368.1</MicrosoftVisualStudioDebuggerContractsVersion>
Expand Down Expand Up @@ -178,14 +178,14 @@
<MicrosoftVisualStudioProgressionCommonVersion>15.8.27812-alpha</MicrosoftVisualStudioProgressionCommonVersion>
<MicrosoftVisualStudioProgressionInterfacesVersion>15.8.27812-alpha</MicrosoftVisualStudioProgressionInterfacesVersion>
<MicrosoftVisualStudioProjectSystemVersion>17.0.77-pre-g62a6cb5699</MicrosoftVisualStudioProjectSystemVersion>
<MicrosoftVisualStudioRemoteControlVersion>16.3.44</MicrosoftVisualStudioRemoteControlVersion>
<MicrosoftVisualStudioRemoteControlVersion>16.3.52</MicrosoftVisualStudioRemoteControlVersion>
<MicrosoftVisualStudioSDKAnalyzersVersion>16.10.10</MicrosoftVisualStudioSDKAnalyzersVersion>
<MicrosoftVisualStudioSearchVersion>17.5.0-preview-2-33111-081</MicrosoftVisualStudioSearchVersion>
<MicrosoftVisualStudioSetupConfigurationInteropVersion>3.0.4492</MicrosoftVisualStudioSetupConfigurationInteropVersion>
<MicrosoftVisualStudioSetupConfigurationInteropVersion>3.6.2080</MicrosoftVisualStudioSetupConfigurationInteropVersion>
<MicrosoftVisualStudioShell150Version>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioShell150Version>
<MicrosoftVisualStudioShellFrameworkVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioShellFrameworkVersion>
<MicrosoftVisualStudioShellDesignVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioShellDesignVersion>
<MicrosoftVisualStudioTelemetryVersion>16.6.18</MicrosoftVisualStudioTelemetryVersion>
<MicrosoftVisualStudioTelemetryVersion>17.6.46</MicrosoftVisualStudioTelemetryVersion>
<MicrosoftVisualStudioTemplateWizardInterfaceVersion>8.0.0.0-alpha</MicrosoftVisualStudioTemplateWizardInterfaceVersion>
<MicrosoftVisualStudioTextDataVersion>$(VisualStudioEditorPackagesVersion)</MicrosoftVisualStudioTextDataVersion>
<MicrosoftVisualStudioTextInternalVersion>$(VisualStudioEditorPackagesVersion)</MicrosoftVisualStudioTextInternalVersion>
Expand All @@ -196,7 +196,7 @@
<MicrosoftVisualStudioThreadingAnalyzersVersion>$(MicrosoftVisualStudioThreadingPackagesVersion)</MicrosoftVisualStudioThreadingAnalyzersVersion>
<MicrosoftVisualStudioThreadingVersion>$(MicrosoftVisualStudioThreadingPackagesVersion)</MicrosoftVisualStudioThreadingVersion>
<MicrosoftVisualStudioUtilitiesVersion>$(MicrosoftVisualStudioShellPackagesVersion)</MicrosoftVisualStudioUtilitiesVersion>
<MicrosoftVisualStudioValidationVersion>17.0.71</MicrosoftVisualStudioValidationVersion>
<MicrosoftVisualStudioValidationVersion>17.6.11</MicrosoftVisualStudioValidationVersion>
<MicrosoftVisualStudioInteractiveWindowVersion>4.0.0</MicrosoftVisualStudioInteractiveWindowVersion>
<MicrosoftVisualStudioVsInteractiveWindowVersion>4.0.0</MicrosoftVisualStudioVsInteractiveWindowVersion>
<MicrosoftVisualStudioWinFormsInterfacesVersion>17.0.0-previews-4-31709-430</MicrosoftVisualStudioWinFormsInterfacesVersion>
Expand Down Expand Up @@ -290,8 +290,8 @@
If you bump their versions, you must push your changes to a dev branch in dotnet/roslyn and
create a test insertion in Visual Studio to validate.
-->
<NewtonsoftJsonVersion>13.0.1</NewtonsoftJsonVersion>
<StreamJsonRpcVersion>2.14.24</StreamJsonRpcVersion>
<NewtonsoftJsonVersion>13.0.3</NewtonsoftJsonVersion>
<StreamJsonRpcVersion>2.15.26</StreamJsonRpcVersion>
<!--
When updating the S.C.I or S.R.M version please let the MSBuild team know in advance so they
can update to the same version. Version changes require a VS test insertion for validation.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2098,6 +2098,130 @@ class C { }
});
}

[Fact, WorkItem(61162, "https://github.com/dotnet/roslyn/issues/61162")]
public void IncrementalGenerator_Collect_SyntaxProvider_01()
{
var generator = new IncrementalGeneratorWrapper(new PipelineCallbackGenerator(static ctx =>
{
var invokedMethodsProvider = ctx.SyntaxProvider
.CreateSyntaxProvider(
static (node, _) => node is InvocationExpressionSyntax,
static (ctx, ct) => ctx.SemanticModel.GetSymbolInfo(ctx.Node, ct).Symbol?.Name ?? "(method not found)")
.Collect();

ctx.RegisterSourceOutput(invokedMethodsProvider, static (spc, invokedMethods) =>
{
spc.AddSource("InvokedMethods.g.cs", string.Join(Environment.NewLine,
invokedMethods.Select(m => $"// {m}")));
});
}));

var source = """
System.Console.WriteLine();
System.Console.WriteLine();
System.Console.WriteLine();
System.Console.WriteLine();
""";
var parseOptions = TestOptions.RegularPreview;
Compilation compilation = CreateCompilation(source, options: TestOptions.DebugExeThrowing, parseOptions: parseOptions);

GeneratorDriver driver = CSharpGeneratorDriver.Create(new[] { generator }, parseOptions: parseOptions);
verify(ref driver, compilation, """
// WriteLine
// WriteLine
// WriteLine
// WriteLine
""");

replace(ref compilation, parseOptions, """
System.Console.WriteLine();
System.Console.WriteLine();
""");
verify(ref driver, compilation, """
// WriteLine
// WriteLine
""");

replace(ref compilation, parseOptions, "_ = 0;");
verify(ref driver, compilation, "");

static void verify(ref GeneratorDriver driver, Compilation compilation, string generatedContent)
{
driver = driver.RunGeneratorsAndUpdateCompilation(compilation, out var outputCompilation, out var generatorDiagnostics);
outputCompilation.VerifyDiagnostics();
generatorDiagnostics.Verify();
var generatedTree = driver.GetRunResult().GeneratedTrees.Single();
AssertEx.EqualOrDiff(generatedContent, generatedTree.ToString());
}

static void replace(ref Compilation compilation, CSharpParseOptions parseOptions, string source)
{
compilation = compilation.ReplaceSyntaxTree(compilation.SyntaxTrees.Single(), CSharpSyntaxTree.ParseText(source, parseOptions));
}
}

[Fact, WorkItem(61162, "https://github.com/dotnet/roslyn/issues/61162")]
public void IncrementalGenerator_Collect_SyntaxProvider_02()
{
var generator = new IncrementalGeneratorWrapper(new PipelineCallbackGenerator(static ctx =>
{
var invokedMethodsProvider = ctx.SyntaxProvider
.CreateSyntaxProvider(
static (node, _) => node is InvocationExpressionSyntax,
static (ctx, ct) => ctx.SemanticModel.GetSymbolInfo(ctx.Node, ct).Symbol?.Name ?? "(method not found)")
.Select((n, _) => n);

ctx.RegisterSourceOutput(invokedMethodsProvider, static (spc, invokedMethod) =>
{
spc.AddSource(invokedMethod, "// " + invokedMethod);
});
}));

var source = """
System.Console.WriteLine();
System.Console.ReadLine();
""";
var parseOptions = TestOptions.RegularPreview;
Compilation compilation = CreateCompilation(source, options: TestOptions.DebugExeThrowing, parseOptions: parseOptions);

GeneratorDriver driver = CSharpGeneratorDriver.Create(new[] { generator }, parseOptions: parseOptions);
verify(ref driver, compilation, new[]
{
"// WriteLine",
"// ReadLine"
});

replace(ref compilation, parseOptions, """
System.Console.WriteLine();
""");

verify(ref driver, compilation, new[]
{
"// WriteLine"
});

replace(ref compilation, parseOptions, "_ = 0;");
verify(ref driver, compilation, Array.Empty<string>());

static void verify(ref GeneratorDriver driver, Compilation compilation, string[] generatedContent)
{
driver = driver.RunGeneratorsAndUpdateCompilation(compilation, out var outputCompilation, out var generatorDiagnostics);
outputCompilation.VerifyDiagnostics();
generatorDiagnostics.Verify();
var trees = driver.GetRunResult().GeneratedTrees;
Assert.Equal(generatedContent.Length, trees.Length);
for (int i = 0; i < generatedContent.Length; i++)
{
AssertEx.EqualOrDiff(generatedContent[i], trees[i].ToString());
}
}

static void replace(ref Compilation compilation, CSharpParseOptions parseOptions, string source)
{
compilation = compilation.ReplaceSyntaxTree(compilation.SyntaxTrees.Single(), CSharpSyntaxTree.ParseText(source, parseOptions));
}
}

[Fact]
public void IncrementalGenerator_Register_End_Node_Only_Once_Through_Combines()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -585,6 +585,45 @@ public void Batch_Node_Records_InputModified_Step_When_Inputs_Are_Changed()
});
}

[Fact, WorkItem(61162, "https://github.com/dotnet/roslyn/issues/61162")]
public void Batch_Node_Remove_From_Beginning()
{
// [A], [B]
var input = new[] { ("A", EntryState.Added), ("B", EntryState.Added) };
var inputNode = new CallbackNode<string>((_, _) =>
{
// Simulate syntax node.
var builder = NodeStateTable<string>.Empty.ToBuilder(null, false);
foreach (var (value, state) in input)
{
builder.AddEntry(value, state, TimeSpan.Zero, default, state);
}
return builder.ToImmutableAndFree();
});
var dstBuilder = GetBuilder(DriverStateTable.Empty);
var table1 = dstBuilder.GetLatestStateTableForNode(inputNode);
AssertTableEntries(table1, new[] { ("A", EntryState.Added, 0), ("B", EntryState.Added, 0) });
AssertTableEntries(table1.AsCached(), new[] { ("A", EntryState.Cached, 0), ("B", EntryState.Cached, 0) });

// batch => [[A], [B]]
var batchNode = new BatchNode<string>(inputNode);
var table2 = dstBuilder.GetLatestStateTableForNode(batchNode);
AssertTableEntries(table2, new[] { (ImmutableArray.Create("A", "B"), EntryState.Added, 0) });
AssertTableEntries(table2.AsCached(), new[] { (ImmutableArray.Create("A", "B"), EntryState.Cached, 0) });

// [B]
input = new[] { ("B", EntryState.Cached) };
dstBuilder = GetBuilder(dstBuilder.ToImmutable());
table1 = dstBuilder.GetLatestStateTableForNode(inputNode);
AssertTableEntries(table1, new[] { ("B", EntryState.Cached, 0) });
AssertTableEntries(table1.AsCached(), new[] { ("B", EntryState.Cached, 0) });

// batch => [[B]]
table2 = dstBuilder.GetLatestStateTableForNode(batchNode);
AssertTableEntries(table2, new[] { (ImmutableArray.Create("B"), EntryState.Modified, 0) });
AssertTableEntries(table2.AsCached(), new[] { (ImmutableArray.Create("B"), EntryState.Cached, 0) });
}

[Fact]
[WorkItem(54832, "https://github.com/dotnet/roslyn/issues/54832")]
public void Transform_Node_Records_NewInput_OnFirst_Run()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,24 +60,24 @@ internal interface IStateTable
/// <typeparam name="T">The type of the items tracked by this table</typeparam>
internal sealed class NodeStateTable<T> : IStateTable
{
internal static NodeStateTable<T> Empty { get; } = new NodeStateTable<T>(ImmutableArray<TableEntry>.Empty, ImmutableArray<IncrementalGeneratorRunStep>.Empty, hasTrackedSteps: true);
internal static NodeStateTable<T> Empty { get; } = new NodeStateTable<T>(ImmutableArray<TableEntry>.Empty, ImmutableArray<IncrementalGeneratorRunStep>.Empty, hasTrackedSteps: true, isCached: false);

private readonly ImmutableArray<TableEntry> _states;

private NodeStateTable(ImmutableArray<TableEntry> states, ImmutableArray<IncrementalGeneratorRunStep> steps, bool hasTrackedSteps)
private NodeStateTable(ImmutableArray<TableEntry> states, ImmutableArray<IncrementalGeneratorRunStep> steps, bool hasTrackedSteps, bool isCached)
{
Debug.Assert(!hasTrackedSteps || steps.Length == states.Length);

_states = states;
Steps = steps;
IsCached = !states.IsEmpty && states.All(s => s.IsCached);
IsCached = isCached;
HasTrackedSteps = hasTrackedSteps;
}

public int Count => _states.Length;

/// <summary>
/// Indicates if every entry in this table has a state of <see cref="EntryState.Cached"/>
/// Indicates that this table is unchanged from the previous version.
/// </summary>
public bool IsCached { get; }

Expand Down Expand Up @@ -126,7 +126,7 @@ public NodeStateTable<T> AsCached()

// Ensure we are completely full so that ToImmutable translates to a MoveToImmutable
Debug.Assert(compacted.Count == nonRemovedCount);
return new NodeStateTable<T>(compacted.ToImmutableAndFree(), ImmutableArray<IncrementalGeneratorRunStep>.Empty, hasTrackedSteps: false);
return new NodeStateTable<T>(compacted.ToImmutableAndFree(), ImmutableArray<IncrementalGeneratorRunStep>.Empty, hasTrackedSteps: false, isCached: true);
}

IStateTable IStateTable.AsCached() => AsCached();
Expand Down Expand Up @@ -451,7 +451,8 @@ public NodeStateTable<T> ToImmutableAndFree()
return new NodeStateTable<T>(
finalStates,
TrackIncrementalSteps ? _steps.ToImmutableAndFree() : default,
hasTrackedSteps: TrackIncrementalSteps);
hasTrackedSteps: TrackIncrementalSteps,
isCached: finalStates.All(static s => s.IsCached) && _previous.GetTotalEntryItemCount() == finalStates.Sum(static s => s.Count));
}

private static (T chosen, EntryState state, bool chosePrevious) GetModifiedItemAndState(T previous, T replacement, IEqualityComparer<T> comparer)
Expand Down
Loading