Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
147 commits
Select commit Hold shift + click to select a range
c96f3b2
Update targets to reduce syntax tree recreations due to ParseOption c…
ToddGrun Apr 10, 2025
15551b8
1) Reorder telemetry logging with updating _projectPropertyModificati…
ToddGrun Apr 10, 2025
3e5705d
Extract to local function and simplify
ToddGrun Apr 10, 2025
00fd718
comment update
ToddGrun Apr 10, 2025
7b05697
Remove parameter that was always passed the same constant value
CyrusNajmabadi Apr 10, 2025
2f9723b
update comments again
ToddGrun Apr 10, 2025
776352c
remove unused var and mis-spelling
ToddGrun Apr 10, 2025
2fe4cd1
Delete a long-obsoleted method
jasonmalinowski Apr 10, 2025
af386a5
Update src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSy…
ToddGrun Apr 10, 2025
aa80af4
Update src/Workspaces/Core/Portable/Workspace/ProjectSystem/ProjectSy…
ToddGrun Apr 10, 2025
603d832
Cyrus did me wrong
ToddGrun Apr 11, 2025
55ae12e
Update dependencies from https://github.com/dotnet/source-build-refer…
dotnet-maestro[bot] Apr 11, 2025
202030e
Initial refactor
jaredpar Apr 11, 2025
e9e0418
more
jaredpar Apr 11, 2025
69ca379
more
jaredpar Apr 11, 2025
9bd6643
Cleanup dump assembly responsibility
jaredpar Apr 11, 2025
40078fd
Finish removal of RuntimeUtilities
jaredpar Apr 11, 2025
2ce37e8
more NRT annotations
jaredpar Apr 11, 2025
3e03448
test failures
jaredpar Apr 11, 2025
0207c0b
more
jaredpar Apr 11, 2025
f0f0fa1
test failures
jaredpar Apr 11, 2025
842e77a
Remove old TODO
jasonmalinowski Apr 10, 2025
a78ef3e
Ensure that if we don't have any values we don't crash
jasonmalinowski Apr 11, 2025
d221efa
Delete unused test hook
jasonmalinowski Apr 10, 2025
36c48da
Merge remote-tracking branch 'origin/main' into eval
jaredpar Apr 11, 2025
0bd0744
Delete unused test hook (#78105)
jasonmalinowski Apr 12, 2025
0578e10
Project system cleanups (#78104)
jasonmalinowski Apr 12, 2025
a85270b
Move MiscellaneousFilesWorkspace construction to background thread (#…
ToddGrun Apr 12, 2025
630f2e9
Add generic log message
CyrusNajmabadi Apr 12, 2025
36bbab1
Use args
CyrusNajmabadi Apr 12, 2025
7571b75
Use args
CyrusNajmabadi Apr 12, 2025
0986fc8
Use args
CyrusNajmabadi Apr 12, 2025
ce7c5fe
Use args
CyrusNajmabadi Apr 12, 2025
deb17b0
Use args
CyrusNajmabadi Apr 12, 2025
396dd98
Use args
CyrusNajmabadi Apr 12, 2025
db92776
Use args
CyrusNajmabadi Apr 12, 2025
de4fd67
Use args
CyrusNajmabadi Apr 12, 2025
0556a11
Use args
CyrusNajmabadi Apr 12, 2025
7afe25f
Use args
CyrusNajmabadi Apr 12, 2025
66f0219
Use args
CyrusNajmabadi Apr 12, 2025
24d03f2
Use args
CyrusNajmabadi Apr 12, 2025
715ffcd
Fix
CyrusNajmabadi Apr 12, 2025
474ba27
Lint
CyrusNajmabadi Apr 12, 2025
55d53bc
Lint
CyrusNajmabadi Apr 12, 2025
f335aaf
Enable Implement with Copilot by default
maryamariyan Apr 12, 2025
69508b6
Move ICodeFixService back to Features layer
CyrusNajmabadi Apr 12, 2025
348b240
Update src/LanguageServer/Protocol/Microsoft.CodeAnalysis.LanguageSer…
CyrusNajmabadi Apr 12, 2025
65ce1f5
Enable Implement with Copilot by default (#78131)
CyrusNajmabadi Apr 12, 2025
046b4d5
Remove unused code fix methods
CyrusNajmabadi Apr 12, 2025
7216393
Remove unused code fix methods (#78133)
CyrusNajmabadi Apr 13, 2025
e2700e8
Add generic log message to avoid lambda allocations. (#78128)
CyrusNajmabadi Apr 13, 2025
9021762
Merge remote-tracking branch 'upstream/main' into moveServiceDown
CyrusNajmabadi Apr 13, 2025
e3f3ac9
Move ICodeFixService back to Features layer (#78132)
CyrusNajmabadi Apr 13, 2025
a0a78da
Use ReadOnlySpans
CyrusNajmabadi Apr 14, 2025
ab37dd6
Use readonly span
CyrusNajmabadi Apr 14, 2025
6aaafc5
Use readonly span
CyrusNajmabadi Apr 14, 2025
066a799
Use readonly span
CyrusNajmabadi Apr 14, 2025
e60bf12
Move Copilot context provider to EA.Copilot and handler to LanguageSe…
genlu Apr 14, 2025
50b6120
[Blocked] System.CommandLine update (#78142)
adamsitnik Apr 14, 2025
84dd277
Ensure new Razor features project gets codebase
dibarbet Apr 14, 2025
959bcb7
Ensure new Razor features project gets codebase (#78147)
dibarbet Apr 14, 2025
ddbfba7
Update dependencies from https://github.com/dotnet/source-build-refer…
dotnet-maestro[bot] Apr 15, 2025
e6ca9a7
move DiagnosticService impl down to Features layer
CyrusNajmabadi Apr 15, 2025
844bc01
Merge remote-tracking branch 'upstream/main' into ros
CyrusNajmabadi Apr 15, 2025
b7aa5c7
Fix
CyrusNajmabadi Apr 15, 2025
e9d9b76
Soimplify
CyrusNajmabadi Apr 15, 2025
7ebe9bf
Fix issue #70183: adjust the plural for expression collection (#78110)
kirisky Apr 15, 2025
4f8f5e6
Use ReadOnlySpans (#78141)
CyrusNajmabadi Apr 15, 2025
776bf75
Move more down
CyrusNajmabadi Apr 15, 2025
eb52dfd
Handle textDocument/didChange notifications that don't pass across th…
ToddGrun Apr 16, 2025
ff90dc5
Fix build break due to a type I renamed. Switch over to just use an a…
ToddGrun Apr 16, 2025
c4510c9
Update dependencies from https://github.com/dotnet/source-build-refer…
dotnet-maestro[bot] Apr 16, 2025
657e394
fix spelling
ToddGrun Apr 16, 2025
89219d1
Revert "Remove dependency on EditorFeatures from codelens layer (#780…
dibarbet Apr 16, 2025
bbc5b45
Fix quick info for pp symbols
Rekkonnect Apr 16, 2025
7f757da
Apply suggestions from code review
jaredpar Apr 16, 2025
a4f4d0f
Update src/EditorFeatures/CSharpTest/QuickInfo/SemanticQuickInfoSourc…
CyrusNajmabadi Apr 16, 2025
ca42961
PR feedback
jaredpar Apr 16, 2025
0b626fe
PR feedback
jaredpar Apr 16, 2025
2fd9731
Adding new EA api at 'Features' layer for unit testing ot use
CyrusNajmabadi Apr 16, 2025
c05cbdb
Add helper
CyrusNajmabadi Apr 16, 2025
fbaea7f
Add docs
CyrusNajmabadi Apr 16, 2025
aaa80ec
Add cherry pick parameters to pipeline
dibarbet Apr 16, 2025
5180dc1
Revert "Remove EditorFeatures from OOP (#78069)"
dibarbet Apr 17, 2025
75a6df5
Update dependencies from https://github.com/dotnet/source-build-refer…
dotnet-maestro[bot] Apr 17, 2025
86a6e47
Parse shebang unconditionally
jjonescz Apr 15, 2025
d0fb724
Update other pre-existing tests
jjonescz Apr 17, 2025
72266a2
Revert "Remove EditorFeatures from OOP (#78069)" (#78179)
jasonmalinowski Apr 17, 2025
a7cc029
add comment
dibarbet Apr 17, 2025
1b5d17b
Fix issue where we were innapropriately suggesting we remove a ref-field
CyrusNajmabadi Apr 17, 2025
205a5a9
Merge branch 'main' into simplifyLinkedDocs
CyrusNajmabadi Apr 17, 2025
3a3aa4c
Reapply "Remove EditorFeatures from OOP (#78069)" (#78179)
Apr 17, 2025
7b4264b
Fix missing VSIX, IVT, and PublishData changes
Apr 17, 2025
9d86df9
undo publishdata changes
Apr 17, 2025
da32faa
Delete dead code
jasonmalinowski Apr 15, 2025
39e3a54
Ensure FindSourceDefinitionAsync works in frozen compilation cases
jasonmalinowski Apr 14, 2025
d329245
Fix Local-Symbol Containing-Symbol in New-Extension-Method-Rewriter f…
bernd5 Apr 18, 2025
3300482
Execute core compiler from full framework msbuild (#77914)
jjonescz Apr 18, 2025
c123334
Add more telemetry for progression graph query commands to help bette…
ToddGrun Apr 18, 2025
284e2d8
Move assembly versions back to 4.14.0.0 (#78200)
jaredpar Apr 18, 2025
411a192
Write ETW event for CreateNonLockingLoader (#78177)
dibarbet Apr 18, 2025
c9019e0
Parse shebang unconditionally (#78183)
arunchndr Apr 18, 2025
00b71c8
Fix issue where we were inappropriately suggesting we remove a ref-fi…
arunchndr Apr 18, 2025
749a789
Fix quick info for pp symbols (#78173)
arunchndr Apr 18, 2025
c407108
Ensure FindSourceDefinitionAsync works in frozen compilation cases (#…
arunchndr Apr 18, 2025
37a6dff
Add more telemetry for progression graph query commands to help bette…
arunchndr Apr 18, 2025
48abcb5
Remove parameter that was always passed the same constant value (#78100)
arunchndr Apr 18, 2025
e7069f2
Update targets to reduce syntax tree recreations due to ParseOption c…
arunchndr Apr 18, 2025
8968ec5
Cleanup how code is executed in our unit tests (#78112)
arunchndr Apr 18, 2025
20e9836
[main] Update dependencies from dotnet/source-build-reference-package…
arunchndr Apr 18, 2025
59eae07
Handle textDocument/didChange notifications that don't pass across th…
arunchndr Apr 18, 2025
a9113d5
Create a NuGet package for Microsoft.VisualStudio.LanguageServices.Xaml
jasonmalinowski Apr 18, 2025
6dad8a6
Revert "Move assembly versions back to 4.14.0.0 (#78200)" (#78210)
jaredpar Apr 19, 2025
facd2f3
Merge branch 'main' into moveDiagnosticServiceDown
CyrusNajmabadi Apr 19, 2025
aa77509
Merge branch 'main' into unitTestingEA
CyrusNajmabadi Apr 19, 2025
35aefce
Do not offer 'use auto prop' on a ref returning property
CyrusNajmabadi Apr 20, 2025
5753826
Add tests
CyrusNajmabadi Apr 20, 2025
868038d
Revert "Handle textDocument/didChange notifications that don't pass a…
dibarbet Apr 20, 2025
0242548
Revert "Handle textDocument/didChange notifications that don't pass a…
dibarbet Apr 20, 2025
73ec6d0
Update expected code for skipped tests
sharwell Apr 21, 2025
91db641
Support empty root namespaces
sharwell Apr 21, 2025
d6a4f0f
Fix crash when converting primary constructor to normal constructor
CyrusNajmabadi Apr 21, 2025
3683d8b
Reapply "Remove EditorFeatures from OOP (#78069)" (#78179) (#78194)
dibarbet Apr 21, 2025
4950cbe
Fix toolset package not building from clean state in VS
jjonescz Apr 22, 2025
6c14d6b
Allocate slightly less in ImmutableArrayExtensions.ConditionallyDeOrd…
ToddGrun Apr 22, 2025
f4ba25f
Support empty root namespaces in ResxSourceGenerator (#78233)
sharwell Apr 22, 2025
81de82f
Reduce LOH allocations in MetadataWriter (#78245)
ToddGrun Apr 22, 2025
fd5372b
Fix crash when converting primary constructor to normal constructor (…
CyrusNajmabadi Apr 22, 2025
090a943
Move DiagnosticService impl down to Features layer (#78155)
CyrusNajmabadi Apr 22, 2025
054a41e
Fix razor analyzer loading (#78116)
chsienki Apr 22, 2025
2ab7334
Use collection expressions
CyrusNajmabadi Apr 21, 2025
6ddda90
Adding new EA api at 'Features' layer for unit testing ot use (#78175)
CyrusNajmabadi Apr 22, 2025
b0da3f2
Add cherry pick parameters to pipeline (#78178)
dibarbet Apr 22, 2025
3892d46
Do not offer 'use auto prop' on a ref returning property (#78226)
CyrusNajmabadi Apr 22, 2025
8205001
EnC: Track stale projects (#78166)
tmat Apr 22, 2025
489d016
Create a NuGet package for Microsoft.VisualStudio.LanguageServices.Xa…
jasonmalinowski Apr 22, 2025
79a6402
Apply suggestions from code review
CyrusNajmabadi Apr 22, 2025
d43a04e
Update src/ExpressionEvaluator/Core/Source/ExpressionCompiler/EEMetad…
CyrusNajmabadi Apr 22, 2025
386241a
Update src/ExpressionEvaluator/Core/Source/ExpressionCompiler/EEMetad…
CyrusNajmabadi Apr 22, 2025
ccbab07
Simplify the build targets for copying files
jasonmalinowski Apr 22, 2025
2d939b2
Fix indenting
jasonmalinowski Apr 22, 2025
9eb88c2
Clean up output capture on .NET Core (#78205)
jaredpar Apr 22, 2025
4768d19
Use collection expressions (#78237)
CyrusNajmabadi Apr 22, 2025
245bdc1
Update 17.14 insertion title
dibarbet Apr 22, 2025
f9c0ad9
Fix toolset package failing to build from clean state in VS (#78251)
jasonmalinowski Apr 22, 2025
096eb58
Update 17.14 insertion title (#78258)
dibarbet Apr 22, 2025
3ca1d1e
Merge 'main' into UserDefinedCompoundAssignment
AlekseyTs Apr 22, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
45 changes: 45 additions & 0 deletions .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,51 @@
"stopAtEntry": false,
"console": "internalConsole"
},
{
"name": "Launch Microsoft.Build.Tasks.CodeAnalysis.dll via MSBuild.exe (netfx)",
"type": "clr",
"request": "launch",
"preLaunchTask": "build toolset",
"program": "C:/Program Files/Microsoft Visual Studio/2022/Preview/MSBuild/Current/Bin/amd64/MSBuild.exe",
"args": [
"-restore",
"-p:RoslynTargetsPath=${workspaceFolder}/artifacts/bin/Microsoft.Net.Compilers.Toolset.Package/Debug/tasks/net472",
],
// A simple project that can be used to debug the build tasks against.
"cwd": "${workspaceFolder}/src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator",
"stopAtEntry": false,
"console": "internalConsole"
},
{
"name": "Launch Microsoft.Build.Tasks.CodeAnalysis.dll via MSBuild.exe (netcore)",
"type": "clr",
"request": "launch",
"preLaunchTask": "build toolset",
"program": "C:/Program Files/Microsoft Visual Studio/2022/Preview/MSBuild/Current/Bin/amd64/MSBuild.exe",
"args": [
"-restore",
"-p:RoslynTargetsPath=${workspaceFolder}/artifacts/bin/Microsoft.Net.Compilers.Toolset.Package/Debug/tasks/netcore",
],
// A simple project that can be used to debug the build tasks against.
"cwd": "${workspaceFolder}/src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator",
"stopAtEntry": false,
"console": "internalConsole"
},
{
"name": "Launch Microsoft.Build.Tasks.CodeAnalysis.dll via dotnet build",
"type": "coreclr",
"request": "launch",
"preLaunchTask": "build toolset",
"program": "dotnet",
"args": [
"build",
"-p:RoslynTargetsPath=${workspaceFolder}/artifacts/bin/Microsoft.Net.Compilers.Toolset.Package/Debug/tasks/netcore",
],
// A simple project that can be used to debug the build tasks against.
"cwd": "${workspaceFolder}/src/Tools/Source/CompilerGeneratorTools/Source/BoundTreeGenerator",
"stopAtEntry": false,
"console": "internalConsole"
},
{
"name": ".NET Core Launch (console)",
"type": "coreclr",
Expand Down
12 changes: 12 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,18 @@
"problemMatcher": "$msCompile",
"group": "build"
},
{
"label": "build toolset",
"type": "shell",
"command": "dotnet",
"args": [
"build",
"-p:GenerateFullPaths=true",
"${workspaceFolder}/src/NuGet/Microsoft.Net.Compilers.Toolset/AnyCpu/Microsoft.Net.Compilers.Toolset.Package.csproj"
],
"problemMatcher": "$msCompile",
"group": "build"
},
{
"label": "msbuild current project",
"type": "shell",
Expand Down
7 changes: 7 additions & 0 deletions azure-pipelines-official.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,12 @@ parameters:
type: boolean
default: true

# An optional VS commit SHA that will be automatically cherry-picked
# to the insertion PR created by this build.
- name: VisualStudioCherryPickSHA
type: string
default: '(default)'

schedules:
- cron: "0 8 23-29 * 0"
displayName: "Monthly smoke test"
Expand Down Expand Up @@ -394,6 +400,7 @@ extends:
publishDataURI: "https://dev.azure.com/dnceng/internal/_apis/git/repositories/dotnet-roslyn/items?path=eng/config/PublishData.json&api-version=6.0"
publishDataAccessToken: "$(System.AccessToken)"
dropPath: '$(Pipeline.Workspace)\VSSetup'
cherryPick: ${{ parameters.VisualStudioCherryPickSHA }}

- ${{ if and(ne(variables['System.TeamProject'], 'public'), notin(variables['Build.Reason'], 'PullRequest')) }}:
- template: /eng/common/templates-official/post-build/post-build.yml@self
Expand Down
4 changes: 4 additions & 0 deletions azure-pipelines-pr-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,9 @@ parameters:
- name: OptionalTitlePrefix
type: string
default: '[PR Validation]'
- name: VisualStudioCherryPickSHA
type: string
default: '(default)'
- name: InsertToolset
type: boolean
default: true
Expand Down Expand Up @@ -323,6 +326,7 @@ extends:
queueSpeedometerValidation: true
dropPath: '$(Pipeline.Workspace)\VSSetup'
retainInsertedBuild: false
cherryPick: ${{ parameters.VisualStudioCherryPickSHA }}
# Arcade is done so we can set BuildNumber back
- powershell: Write-Host "##vso[build.updatebuildnumber]$(FancyBuildNumber)"
displayName: Reset BuildNumber
Expand Down
12 changes: 6 additions & 6 deletions eng/Version.Details.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,19 +13,19 @@
<SourceBuild RepoName="source-build-externals" ManagedOnly="true" />
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="10.0.620702">
<Dependency Name="Microsoft.SourceBuild.Intermediate.source-build-reference-packages" Version="10.0.621601">
<Uri>https://github.com/dotnet/source-build-reference-packages</Uri>
<Sha>8a21184a27103ca3e365b21553e32f2a1c0661d3</Sha>
<Sha>4b566314cf9602b77f25538a88b9c8175231c106</Sha>
<SourceBuild RepoName="source-build-reference-packages" ManagedOnly="true" />
</Dependency>
<Dependency Name="System.CommandLine" Version="2.0.0-beta4.24528.1">
<Dependency Name="System.CommandLine" Version="2.0.0-beta5.25210.1">
<Uri>https://github.com/dotnet/command-line-api</Uri>
<Sha>feb61c7f328a2401d74f4317b39d02126cfdfe24</Sha>
<Sha>e9b0511d7f1128e2bc3be7a658a2a4ea977e602d</Sha>
</Dependency>
<!-- Intermediate is necessary for source build. -->
<Dependency Name="Microsoft.SourceBuild.Intermediate.command-line-api" Version="0.1.552801">
<Dependency Name="Microsoft.SourceBuild.Intermediate.command-line-api" Version="0.1.621001">
<Uri>https://github.com/dotnet/command-line-api</Uri>
<Sha>feb61c7f328a2401d74f4317b39d02126cfdfe24</Sha>
<Sha>e9b0511d7f1128e2bc3be7a658a2a4ea977e602d</Sha>
<SourceBuild RepoName="command-line-api" ManagedOnly="true" />
</Dependency>
<!-- Necessary for source-build. This allows the live version of the package to be used by source-build. -->
Expand Down
2 changes: 1 addition & 1 deletion eng/Versions.props
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
Versions managed by Arcade (see Versions.Details.xml)
-->
<PropertyGroup>
<SystemCommandLineVersion>2.0.0-beta4.24528.1</SystemCommandLineVersion>
<SystemCommandLineVersion>2.0.0-beta5.25210.1</SystemCommandLineVersion>
<SystemCompositionVersion>9.0.0</SystemCompositionVersion>
<SystemConfigurationConfigurationManagerVersion>9.0.0</SystemConfigurationConfigurationManagerVersion>
<SystemDiagnosticsEventLogVersion>9.0.0</SystemDiagnosticsEventLogVersion>
Expand Down
3 changes: 2 additions & 1 deletion eng/config/PublishData.json
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@
"Microsoft.VisualStudio.LanguageServices.LiveShare": "vs-impl",
"Microsoft.VisualStudio.LanguageServices.Razor.RemoteClient": "vs-impl",
"Microsoft.VisualStudio.LanguageServices.ExternalAccess.Copilot": "vs-impl",
"Microsoft.VisualStudio.LanguageServices.Xaml": "vs-impl",
"Microsoft.CommonLanguageServerProtocol.Framework": "vs-impl",
"Microsoft.CommonLanguageServerProtocol.Framework.Binary": "vs-impl",
"Microsoft.CodeAnalysis.Analyzers": "arcade",
Expand Down Expand Up @@ -170,7 +171,7 @@
"NonShipping"
],
"vsBranch": "rel/d17.14",
"insertionTitlePrefix": "[d17.14 P3]",
"insertionTitlePrefix": "[d17.14]",
"insertionCreateDraftPR": false
},
"main": {
Expand Down
5 changes: 4 additions & 1 deletion eng/pipelines/insert.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ parameters:
type: string
default: ''

- name: cherryPick
type: string

steps:
- checkout: none

Expand Down Expand Up @@ -183,7 +186,7 @@ steps:
.\RIT\tools\net472\OneOffInsertion.ps1 `
-autoComplete "$(Template.AutoComplete)" `
-buildQueueName "$(Build.DefinitionName)" `
-cherryPick "(default)" `
-cherryPick "${{ parameters.cherryPick }}" `
-userName "$(Template.BuildUserName)" `
-password "$(Template.BuildPassword)" `
-componentUserName "$(Template.ComponentUserName)" `
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3530,4 +3530,33 @@ public unsafe void ToUnmanaged()
ReferenceAssemblies = ReferenceAssemblies.Net.Net90,
}.RunAsync();
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/77251")]
public async Task TestRefFieldWrittenNotRead()
{
await new VerifyCS.Test
{
TestCode = """
public readonly ref struct RefScope<T>
{
public RefScope(ref T originalvalue, T newvalue)
{
_OriginalValue = originalvalue;
_Reference = ref originalvalue;
originalvalue = newvalue;
}

readonly ref T _Reference; // Should get no diagnostic here.
readonly T _OriginalValue;

public void Dispose()
{
_Reference = _OriginalValue;
}
}
""",
LanguageVersion = LanguageVersion.CSharp13,
ReferenceAssemblies = ReferenceAssemblies.Net.Net90,
}.RunAsync();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3134,4 +3134,52 @@ int P
}
""");
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/78225")]
public async Task TestRefProperty1()
{
await TestMissingInRegularAndScriptAsync(
"""
class Class
{
[|int i|];

ref int P
{
get
{
return ref i;
}
}
}
""");
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/78225")]
public async Task TestRefProperty2()
{
await TestMissingInRegularAndScriptAsync(
"""
class Class
{
[|int i|];

ref int P => ref i;
}
""");
}

[Fact, WorkItem("https://github.com/dotnet/roslyn/issues/78225")]
public async Task TestRefProperty3()
{
await TestMissingInRegularAndScriptAsync(
"""
class Class
{
[|int i|];

readonly ref int P => ref i;
}
""");
}
}
3 changes: 2 additions & 1 deletion src/Analyzers/Core/Analyzers/DiagnosticCustomTags.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Collections.Immutable;
using System.Diagnostics;
using Microsoft.CodeAnalysis.CodeStyle;
Expand Down Expand Up @@ -64,7 +65,7 @@ public static string[] UnnecessaryAndNotConfigurable
}

[Conditional("DEBUG")]
private static void Assert(string[] customTags, params string[] tags)
private static void Assert(string[] customTags, params ReadOnlySpan<string> tags)
{
Debug.Assert(customTags.Length == tags.Length);

Expand Down
4 changes: 1 addition & 3 deletions src/Analyzers/Core/Analyzers/Helpers/DiagnosticHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -343,7 +343,7 @@ public sealed class LocalizableStringWithArguments : LocalizableString
private readonly LocalizableString _messageFormat;
private readonly string[] _formatArguments;

public LocalizableStringWithArguments(LocalizableString messageFormat, params object[] formatArguments)
public LocalizableStringWithArguments(LocalizableString messageFormat, params ReadOnlySpan<object> formatArguments)
{
if (messageFormat == null)
{
Expand All @@ -358,9 +358,7 @@ public LocalizableStringWithArguments(LocalizableString messageFormat, params ob
_messageFormat = messageFormat;
_formatArguments = new string[formatArguments.Length];
for (var i = 0; i < formatArguments.Length; i++)
{
_formatArguments[i] = $"{formatArguments[i]}";
}
}

protected override string GetText(IFormatProvider? formatProvider)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -583,8 +583,16 @@ private void OnSymbolEnd(SymbolAnalysisContext symbolEndContext, bool hasUnsuppo
continue;

// Do not flag ref-fields that are not read. A ref-field can exist to have side effects by
// writing into some other location when a write happens to it.
if (member is IFieldSymbol { IsReadOnly: false, RefKind: RefKind.Ref })
// writing into some other location when a write happens to it. Note: this includes `readonly
// ref` fields as well. It's still legal to assign a normal value into a `readonly ref` field.
// It's just not allowed to overwrite it *with another ref*. In other words:
//
// _readonlyRefField = value; // is fine.
// _readonlyRefField = ref value; // is not.
//
// So as long as it is a ref-field, we don't care if it is unread, but is written to. We must
// continue allowing it.
if (member is IFieldSymbol { RefKind: RefKind.Ref })
continue;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,9 @@ private void AnalyzePropertyDeclaration(
if (property.GetMethod == null)
return;

if (property.RefKind != RefKind.None)
return;

if (!CanExplicitInterfaceImplementationsBeFixed && property.ExplicitInterfaceImplementations.Length != 0)
return;

Expand Down
Loading