Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
87fe133
Fix BuildActionTelemetryTable tool
mavasani Jun 9, 2022
2f000f9
Apply suggestions from code review
mavasani Jun 10, 2022
6995bb9
Initial work to get asp.net doc highlights
CyrusNajmabadi Jun 10, 2022
5525284
work
CyrusNajmabadi Jun 10, 2022
5478e19
Work
CyrusNajmabadi Jun 10, 2022
e88c25e
Renames
CyrusNajmabadi Jun 10, 2022
1c7fb01
Add regex highlighters
CyrusNajmabadi Jun 10, 2022
332e27b
Add docs
CyrusNajmabadi Jun 10, 2022
de06f05
Use the complete branch name in DartLab yml
JoeRobich Jun 11, 2022
2397223
Generate better descriptions for code actions from nested classes.
JoeRobich Jun 11, 2022
c4552fe
Fix up TFM
JoeRobich Jun 11, 2022
c4bb7a4
Ensure Refactorings are named differently than Fixes
JoeRobich Jun 11, 2022
e2edd17
Update Action description table
JoeRobich Jun 11, 2022
75a71d1
Use last namespace name when not a nested class.
JoeRobich Jun 11, 2022
9f883da
Fix VB compiler crashes when decoding attributes (#61537)
Youssef1313 Jun 13, 2022
ff32144
Lint
CyrusNajmabadi Jun 13, 2022
f04aec5
Simplify export attribute for embedded language features
CyrusNajmabadi Jun 13, 2022
a7695a6
Add check
CyrusNajmabadi Jun 13, 2022
c3d42b0
REname
CyrusNajmabadi Jun 13, 2022
2cb0e4d
Merge pull request #61821 from dotnet/dev/jorobich/dartlab-fix
JoeRobich Jun 13, 2022
90049f7
Merge branch 'unifyAttribute' into aspHighlights
CyrusNajmabadi Jun 13, 2022
eee6b3c
Disallow an interface containing or inheriting static abstract/virtua…
AlekseyTs Jun 13, 2022
691d709
Organize contributing notes and add WSL testing section (#61408)
jcouv Jun 13, 2022
65f8ef6
Require spaces within line span directives and relax LangVer check (#…
jcouv Jun 13, 2022
cfa6478
Merge pull request #61853 from CyrusNajmabadi/unifyAttribute
CyrusNajmabadi Jun 13, 2022
0234a7b
Merge remote-tracking branch 'upstream/main' into aspHighlights
CyrusNajmabadi Jun 13, 2022
7a41231
Renames
CyrusNajmabadi Jun 13, 2022
0662acd
Adjust implementation of user-defined conversion resolution according…
AlekseyTs Jun 13, 2022
ca30a19
Simplify importing of embedded languages
CyrusNajmabadi Jun 13, 2022
a9f6300
simplify further
CyrusNajmabadi Jun 13, 2022
36ddff6
Merge pull request #61817 from CyrusNajmabadi/aspHighlights
CyrusNajmabadi Jun 13, 2022
14deead
Merge remote-tracking branch 'upstream/main' into simplifyEmbeddedLan…
CyrusNajmabadi Jun 13, 2022
ac754ec
Merge pull request #61795 from mavasani/FixBuildTelemetryTool
JoeRobich Jun 13, 2022
34088e0
Lint
CyrusNajmabadi Jun 13, 2022
dada467
Report an error for an implicit implementation of an inaccessible int…
AlekseyTs Jun 13, 2022
d1ca234
Merge pull request #61862 from CyrusNajmabadi/simplifyEmbeddedLanguages
CyrusNajmabadi Jun 13, 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
12 changes: 6 additions & 6 deletions Roslyn.sln
Original file line number Diff line number Diff line change
Expand Up @@ -1473,7 +1473,7 @@ Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.projitems*{0141285d-8f6c-42c7-baf3-3c0ccd61c716}*SharedItemsImports = 5
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\VisualBasicWorkspaceExtensions.projitems*{0141285d-8f6c-42c7-baf3-3c0ccd61c716}*SharedItemsImports = 5
src\Compilers\CSharp\CommandLine\CscCommandLine.projitems*{0161e25c-918a-4dc8-9648-30fdcc8e31e9}*SharedItemsImports = 5
src\Compilers\CSharp\csc\CscCommandLine.projitems*{0161e25c-918a-4dc8-9648-30fdcc8e31e9}*SharedItemsImports = 5
src\Analyzers\VisualBasic\Tests\VisualBasicAnalyzers.UnitTests.projitems*{0be66736-cdaa-4989-88b1-b3f46ebdca4a}*SharedItemsImports = 5
src\Analyzers\Core\CodeFixes\CodeFixes.projitems*{1b6c4a1a-413b-41fb-9f85-5c09118e541b}*SharedItemsImports = 13
src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{1ee8cad3-55f9-4d91-96b2-084641da9a6c}*SharedItemsImports = 5
Expand All @@ -1495,7 +1495,7 @@ Global
src\Analyzers\CSharp\CodeFixes\CSharpCodeFixes.projitems*{3973b09a-4fbf-44a5-8359-3d22ceb71f71}*SharedItemsImports = 5
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{3973b09a-4fbf-44a5-8359-3d22ceb71f71}*SharedItemsImports = 5
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\CSharp\CSharpWorkspaceExtensions.projitems*{438db8af-f3f0-4ed9-80b5-13fddd5b8787}*SharedItemsImports = 13
src\Compilers\CSharp\CommandLine\CscCommandLine.projitems*{4b45ca0c-03a0-400f-b454-3d4bcb16af38}*SharedItemsImports = 5
src\Compilers\CSharp\csc\CscCommandLine.projitems*{4b45ca0c-03a0-400f-b454-3d4bcb16af38}*SharedItemsImports = 5
src\Analyzers\CSharp\Tests\CSharpAnalyzers.UnitTests.projitems*{5018d049-5870-465a-889b-c742ce1e31cb}*SharedItemsImports = 5
src\Compilers\CSharp\CSharpAnalyzerDriver\CSharpAnalyzerDriver.projitems*{54e08bf5-f819-404f-a18d-0ab9ea81ea04}*SharedItemsImports = 13
src\Workspaces\SharedUtilitiesAndExtensions\Compiler\VisualBasic\VisualBasicCompilerExtensions.projitems*{57ca988d-f010-4bf2-9a2e-07d6dcd2ff2c}*SharedItemsImports = 5
Expand All @@ -1513,8 +1513,8 @@ Global
src\Analyzers\Core\Analyzers\Analyzers.projitems*{76e96966-4780-4040-8197-bde2879516f4}*SharedItemsImports = 13
src\Analyzers\VisualBasic\Tests\VisualBasicAnalyzers.UnitTests.projitems*{7b7f4153-ae93-4908-b8f0-430871589f83}*SharedItemsImports = 13
src\Analyzers\VisualBasic\Analyzers\VisualBasicAnalyzers.projitems*{94faf461-2e74-4dbb-9813-6b2cde6f1880}*SharedItemsImports = 13
src\Compilers\Server\CommandLine\VBCSCompilerCommandLine.projitems*{9508f118-f62e-4c16-a6f4-7c3b56e166ad}*SharedItemsImports = 5
src\Compilers\VisualBasic\CommandLine\VbcCommandLine.projitems*{975cd834-45f4-4ea0-a395-cb60dbd0e214}*SharedItemsImports = 5
src\Compilers\Server\VBCSCompiler\VBCSCompilerCommandLine.projitems*{9508f118-f62e-4c16-a6f4-7c3b56e166ad}*SharedItemsImports = 5
src\Compilers\VisualBasic\vbc\VbcCommandLine.projitems*{975cd834-45f4-4ea0-a395-cb60dbd0e214}*SharedItemsImports = 5
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\Core\WorkspaceExtensions.projitems*{99f594b1-3916-471d-a761-a6731fc50e9a}*SharedItemsImports = 13
src\Analyzers\VisualBasic\CodeFixes\VisualBasicCodeFixes.projitems*{9f9ccc78-7487-4127-9d46-db23e501f001}*SharedItemsImports = 13
src\Analyzers\CSharp\CodeFixes\CSharpCodeFixes.projitems*{a07abcf5-bc43-4ee9-8fd8-b2d77fd54d73}*SharedItemsImports = 5
Expand All @@ -1535,9 +1535,9 @@ Global
src\Compilers\Core\AnalyzerDriver\AnalyzerDriver.projitems*{d0bc9be7-24f6-40ca-8dc6-fcb93bd44b34}*SharedItemsImports = 13
src\Dependencies\CodeAnalysis.Debugging\Microsoft.CodeAnalysis.Debugging.projitems*{d73adf7d-2c1c-42ae-b2ab-edc9497e4b71}*SharedItemsImports = 13
src\Analyzers\CSharp\CodeFixes\CSharpCodeFixes.projitems*{da973826-c985-4128-9948-0b445e638bdb}*SharedItemsImports = 13
src\Compilers\Server\CommandLine\VBCSCompilerCommandLine.projitems*{dc8c78cc-b6fe-47bf-93b1-b65a1c67c08d}*SharedItemsImports = 5
src\Compilers\Server\VBCSCompiler\VBCSCompilerCommandLine.projitems*{dc8c78cc-b6fe-47bf-93b1-b65a1c67c08d}*SharedItemsImports = 5
src\Analyzers\VisualBasic\Tests\VisualBasicAnalyzers.UnitTests.projitems*{e512c6c1-f085-4ad7-b0d9-e8f1a0a2a510}*SharedItemsImports = 5
src\Compilers\VisualBasic\CommandLine\VbcCommandLine.projitems*{e58ee9d7-1239-4961-a0c1-f9ec3952c4c1}*SharedItemsImports = 5
src\Compilers\VisualBasic\vbc\VbcCommandLine.projitems*{e58ee9d7-1239-4961-a0c1-f9ec3952c4c1}*SharedItemsImports = 5
src\Compilers\VisualBasic\BasicAnalyzerDriver\BasicAnalyzerDriver.projitems*{e8f0baa5-7327-43d1-9a51-644e81ae55f1}*SharedItemsImports = 13
src\Dependencies\Collections\Microsoft.CodeAnalysis.Collections.projitems*{e919dd77-34f8-4f57-8058-4d3ff4c2b241}*SharedItemsImports = 13
src\Workspaces\SharedUtilitiesAndExtensions\Workspace\VisualBasic\VisualBasicWorkspaceExtensions.projitems*{e9dbfa41-7a9c-49be-bd36-fd71b31aa9fe}*SharedItemsImports = 13
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines-integration-dartlab.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ resources:
endpoint: dnceng/internal dotnet-roslyn
type: git
name: internal/dotnet-roslyn
ref: $(Build.SourceBranchName)
ref: $(Build.SourceBranch)
trigger:
- main

Expand Down
11 changes: 11 additions & 0 deletions docs/compilers/CSharp/Compiler Breaking Changes - DotNet 7.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,16 @@
# This document lists known breaking changes in Roslyn after .NET 6 all the way to .NET 7.

## Required spaces in #line span directives

***Introduced in .NET SDK 6.0.400, Visual Studio 2022 version 17.3.***

When the `#line` span directive was introduced in C# 10, it required no particular spacing.
For example, this would be valid: `#line(1,2)-(3,4)5"file.cs"`.

In Visual Studio 17.3, the compiler requires spaces before the first parenthesis, the character
offset, and the file name.
So the above example fails to parse unless spaces are added: `#line (1,2)-(3,4) 5 "file.cs"`.

## Checked operators on System.IntPtr and System.UIntPtr

***Introduced in .NET SDK 7.0.100, Visual Studio 2022 version 17.3.***
Expand Down
56 changes: 37 additions & 19 deletions docs/contributing/Building, Debugging, and Testing on Windows.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,22 @@ Tests can be run and debugged from the Test Explorer window. For best performanc
2. Use the Search box of Test Explorer to narrow the scope of visible tests to the feature(s) you are working on
3. When you are not actively running tests, set the search query to `__NonExistent__` to hide all tests from the UI

#### Testing in Linux using WSL

Tests can be run and debugged under WSL. This requires a bit of setup the first time. After that, it is as easy as selecting WSL as the active environment in Test Explorer.

1. Install WSL by running `wsl --install` ([details](https://docs.microsoft.com/en-us/windows/wsl/setup/environment#get-started))
2. In the VS installer, install ".NET Debugging with WSL" as an individual component
3. In Test Explorer, go into "Configure Remote Test Environments" (under the gear icon) and uncomment the wsl/Ubuntu environment:
![image](https://user-images.githubusercontent.com/12466233/169365278-485573de-0b14-466e-a96d-b1de5e67e891.png)
![image](https://user-images.githubusercontent.com/12466233/169365165-a2bfc6bc-96ba-45fa-8705-eb8e7997df62.png)
4. Select that test environment from Test Explorer drop-down:
![image](https://user-images.githubusercontent.com/12466233/169365451-681fcbb2-0b21-46f6-bc30-de58ce01bfdc.png)
5. Run a test from Test Explorer test list. This will prompt you to install some dotnet bits into the WSL environment the first time.
6. Debug a test. This will prompt you to install some remote debugging bits into the WSL environment the first time.

[More details](https://docs.microsoft.com/en-us/visualstudio/debugger/debug-dotnet-core-in-wsl-2)

### WPF Test Runner

To debug through tests, you can right click the test project that contains your
Expand All @@ -66,6 +82,13 @@ give it a try.

## Trying Your Changes in Visual Studio

### Deploying with command-line (recommended method)

You can build and deploy with the following command:
`.\Build.cmd -Configuration Release -deployExtensions -launch`.

Then you can launch the `RoslynDev` hive with `devenv /rootSuffix RoslynDev`.

### Deploying with F5

The Rosyln solution is designed to support easy debugging via F5. Several of our
Expand Down Expand Up @@ -140,13 +163,7 @@ your csproj. As shown below, you'll want to (1) add a nuget source pointing to y

![image](https://user-images.githubusercontent.com/12466233/81206129-7fbe8680-8f80-11ea-9438-acc0481a3585.png)


### Deploying with command-line

You can build and deploy with the following command:
`.\Build.cmd -Configuration Release -deployExtensions -launch`.

Then you can launch the `RoslynDev` hive with `devenv /rootSuffix RoslynDev`.
## Various other tips

### Referencing bootstrap compiler

Expand Down Expand Up @@ -185,18 +202,7 @@ Run `build.cmd -testIOperation` which sets the `ROSLYN_TEST_IOPERATION` environm
For running those tests in an IDE, the easiest is to find the `//#define ROSLYN_TEST_IOPERATION` directive and uncomment it.
See more details in the [IOperation test hook](https://github.com/dotnet/roslyn/blob/main/docs/compilers/IOperation%20Test%20Hook.md) doc.

### Running the PublicAPI fixer

1. Install `dotnet-format` as a global tool. It does ship as part of the SDK, but a separate version can be installed as a global tool and invoked with `dotnet-format {options}`.
`C:\Source\roslyn> dotnet tool install -g dotnet-format --version "6.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json`
2. Restore and build `Compilers.sln`. This is necessary to ensure the source generator project is built and we can load the generator assembly when running `dotnet-format`.
`C:\Source\roslyn> .\restore.cmd`
`C:\Source\roslyn> .\build.cmd`
3. Invoke the `dotnet-format` global tool. Running only the analyzers subcommand and fixing only the "missing Public API signature" diagnostic. We must also pass the `--include-generated` flag to include source generated documents in the analysis.
`C:\Source\roslyn> cd ..`
`C:\Source> dotnet-format analyzers .\roslyn\Compilers.sln --diagnostics=RS0016 --no-restore --include-generated -v diag`

## Replicating Failures in the Used Assemblies leg
### Replicating Failures in the Used Assemblies leg

In order to replicate test failures in that leg, there are a few options:

Expand All @@ -210,6 +216,18 @@ When a test failure is isolated, please add a _dedicated_ test for this (ie. fai
Preferrably, don't replicate the entire original test, just enough to hit the bug to ensure that it's protected against regressions.
Before pushing a relevant fix to CI, you can validate locally using the `-testUsedAssemblies` command-line option for `build.cmd`. For example: `build.cmd -testCoreClr -testCompilerOnly -testUsedAssemblies`.

### Running the PublicAPI fixer

1. Install `dotnet-format` as a global tool. It does ship as part of the SDK, but a separate version can be installed as a global tool and invoked with `dotnet-format {options}`.
`C:\Source\roslyn> dotnet tool install -g dotnet-format --version "6.*" --add-source https://pkgs.dev.azure.com/dnceng/public/_packaging/dotnet6/nuget/v3/index.json`
2. Restore and build `Compilers.sln`. This is necessary to ensure the source generator project is built and we can load the generator assembly when running `dotnet-format`.
`C:\Source\roslyn> .\restore.cmd`
`C:\Source\roslyn> .\build.cmd`
3. Invoke the `dotnet-format` global tool. Running only the analyzers subcommand and fixing only the "missing Public API signature" diagnostic. We must also pass the `--include-generated` flag to include source generated documents in the analysis.
`C:\Source\roslyn> cd ..`
`C:\Source> dotnet-format analyzers .\roslyn\Compilers.sln --diagnostics=RS0016 --no-restore --include-generated -v diag`


## Contributing

Please see [Contributing Code](https://github.com/dotnet/roslyn/blob/main/CONTRIBUTING.md) for details on contributing changes back to the code.
Original file line number Diff line number Diff line change
Expand Up @@ -1754,12 +1754,11 @@ public bool HasAnyNullabilityImplicitConversion(TypeWithAnnotations source, Type
ClassifyImplicitConversionFromType(source.Type, destination.Type, ref discardedUseSiteInfo).Kind != ConversionKind.NoConversion;
}

public static bool HasIdentityConversionToAny<T>(T type, ArrayBuilder<T> targetTypes)
where T : TypeSymbol
private static bool HasIdentityConversionToAny(NamedTypeSymbol type, ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol ConstrainedToTypeOpt)> targetTypes)
{
foreach (var targetType in targetTypes)
{
if (HasIdentityConversionInternal(type, targetType, includeNullability: false))
if (HasIdentityConversionInternal(type, targetType.ParticipatingType, includeNullability: false))
{
return true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,19 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

#nullable disable

using System.Diagnostics;
using Microsoft.CodeAnalysis.CSharp.Symbols;
using Microsoft.CodeAnalysis.CSharp.Syntax;
using Microsoft.CodeAnalysis.PooledObjects;
using Microsoft.CodeAnalysis.Text;
using System.Collections.Generic;
using System.Collections.Immutable;

namespace Microsoft.CodeAnalysis.CSharp
{
internal partial class ConversionsBase
{
public static void AddTypesParticipatingInUserDefinedConversion(ArrayBuilder<TypeSymbol> result, TypeSymbol type, bool includeBaseTypes, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
public static void AddTypesParticipatingInUserDefinedConversion(ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol? ConstrainedToTypeOpt)> result, TypeSymbol type, bool includeBaseTypes, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
{
// CONSIDER: These sets are usually small; if they are large then this is an O(n^2)
// CONSIDER: algorithm. We could use a hash table instead to build up the set.
Expand Down Expand Up @@ -52,37 +51,33 @@ public static void AddTypesParticipatingInUserDefinedConversion(ArrayBuilder<Typ
if (type is TypeParameterSymbol typeParameter)
{
NamedTypeSymbol effectiveBaseClass = typeParameter.EffectiveBaseClass(ref useSiteInfo);

addFromClassOrStruct(result, excludeExisting, effectiveBaseClass, includeBaseTypes, ref useSiteInfo);

switch (effectiveBaseClass.SpecialType)
ImmutableArray<NamedTypeSymbol> interfaces = includeBaseTypes ?
typeParameter.AllEffectiveInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo) :
typeParameter.EffectiveInterfacesWithDefinitionUseSiteDiagnostics(ref useSiteInfo);

foreach (NamedTypeSymbol iface in interfaces)
{
case SpecialType.System_ValueType:
case SpecialType.System_Enum:
case SpecialType.System_Array:
case SpecialType.System_Object:
if (!excludeExisting || !HasIdentityConversionToAny(typeParameter, result))
{
// Add the type parameter to the set as well. This will be treated equivalent to adding its
// effective interfaces to the set. We are not doing that here because we still need to know
// the originating type parameter as "constrained to" type.
result.Add(typeParameter);
}
break;
if (!excludeExisting || !HasIdentityConversionToAny(iface, result))
{
result.Add((iface, typeParameter));
}
}
}
else
{
addFromClassOrStruct(result, excludeExisting, type, includeBaseTypes, ref useSiteInfo);
}

static void addFromClassOrStruct(ArrayBuilder<TypeSymbol> result, bool excludeExisting, TypeSymbol type, bool includeBaseTypes, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
static void addFromClassOrStruct(ArrayBuilder<(NamedTypeSymbol ParticipatingType, TypeParameterSymbol? ConstrainedToTypeOpt)> result, bool excludeExisting, TypeSymbol type, bool includeBaseTypes, ref CompoundUseSiteInfo<AssemblySymbol> useSiteInfo)
{
if (type.IsClassType() || type.IsStructType())
{
if (!excludeExisting || !HasIdentityConversionToAny(type, result))
var namedType = (NamedTypeSymbol)type;
if (!excludeExisting || !HasIdentityConversionToAny(namedType, result))
{
result.Add(type);
result.Add((namedType, null));
}
}

Expand All @@ -96,7 +91,7 @@ static void addFromClassOrStruct(ArrayBuilder<TypeSymbol> result, bool excludeEx
{
if (!excludeExisting || !HasIdentityConversionToAny(t, result))
{
result.Add(t);
result.Add((t, null));
}

t = t.BaseTypeWithDefinitionUseSiteDiagnostics(ref useSiteInfo);
Expand Down
Loading