-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Targeting IDE projects to .NET 6 #66655
Conversation
@@ -257,7 +257,7 @@ internal sealed class PdbSourceDocumentMetadataAsSourceFileProvider : IMetadataA | |||
// to the document passed in, which we just use the first document for. | |||
// TODO: Support results from multiple source files: https://github.com/dotnet/roslyn/issues/55834 | |||
var firstDocumentFilePath = sourceFileInfos[0]!.FilePath; | |||
var firstDocument = navigateProject.Documents.FirstOrDefault(d => d.FilePath?.Equals(firstDocumentFilePath, StringComparison.OrdinalIgnoreCase) ?? false); | |||
var firstDocument = navigateProject.Documents.First(d => d.FilePath?.Equals(firstDocumentFilePath, StringComparison.OrdinalIgnoreCase) ?? false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@davidwengier Does this look right to you?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i'd like this answered as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems fine to me. We fill that project with documents from the sourceFileInfos
, and check that its got files in it on line 243, so if this every fails, we would want a PRISM bug to tell us.
@@ -89,7 +89,7 @@ private static string GetIndentation(Document document, SyntaxNode node, SyntaxF | |||
protected override async Task<Document> AddIndentationToDocumentAsync(Document document, int position, ISyntaxFacts syntaxFacts, CancellationToken cancellationToken) | |||
{ | |||
var root = await document.GetRequiredSyntaxRootAsync(cancellationToken).ConfigureAwait(false); | |||
var snippet = root.GetAnnotatedNodes(_findSnippetAnnotation).FirstOrDefault(); | |||
var snippet = root.GetAnnotatedNodes(_findSnippetAnnotation).First(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FYI @akhera99 for snippet related change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i don't trust this at all. @akhera99 how do you know you will absolutely find the node here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I figured it would given that, when we annotate the added snippet, we throw if the added snippet can't be found. I think it's safer to keep it as FirstOrDefault, but I believe we bail out earlier in case it's not found.
@@ -5,7 +5,7 @@ | |||
// Copied from: | |||
// https://github.com/dotnet/runtime/blob/fdd104ec5e1d0d2aa24a6723995a98d0124f724b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/CompilerFeatureRequiredAttribute.cs | |||
|
|||
#if !NET6_0_OR_GREATER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would #if NETSTANDARD
be better, so that it is not updated every time we bump version?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems this type is not in .net 6 either, only in net 7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here's the runtime PR addign those types
dotnet/runtime#64287
@@ -5,7 +5,7 @@ | |||
// Copied from: | |||
// https://github.com/dotnet/runtime/blob/fdd104ec5e1d0d2aa24a6723995a98d0124f724b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/RequiredMemberAttribute.cs | |||
|
|||
#if !NET6_0_OR_GREATER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would #if NETSTANDARD
be better, so that it is not updated every time we bump version?
@@ -5,7 +5,7 @@ | |||
// Copied from: | |||
// https://github.com/dotnet/runtime/blob/fdd104ec5e1d0d2aa24a6723995a98d0124f724b/src/libraries/System.Private.CoreLib/src/System/Diagnostics/CodeAnalysis/SetsRequiredMembersAttribute.cs | |||
|
|||
#if !NET6_0_OR_GREATER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would #if NETSTANDARD
be better, so that it is not updated every time we bump version?
@@ -28,7 +29,7 @@ public AnalyzerSettingsProvider(string fileName, AnalyzerSettingsUpdater setting | |||
|
|||
protected override void UpdateOptions(TieredAnalyzerConfigOptions options, ImmutableArray<Project> projectsInScope) | |||
{ | |||
var analyzerReferences = projectsInScope.SelectMany(p => p.AnalyzerReferences).DistinctBy(a => a.Id).ToImmutableArray(); | |||
var analyzerReferences = RoslynEnumerableExtensions.DistinctBy(projectsInScope.SelectMany(p => p.AnalyzerReferences), a => a.Id).ToImmutableArray(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we actually need the extension method?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can unify them to BCL implementation, but I'd keep the original logic in this PR
@@ -5,7 +5,7 @@ | |||
// Copied from: | |||
// https://github.com/dotnet/runtime/blob/fdd104ec5e1d0d2aa24a6723995a98d0124f724b/src/libraries/System.Private.CoreLib/src/System/Runtime/CompilerServices/CompilerFeatureRequiredAttribute.cs | |||
|
|||
#if !NET6_0_OR_GREATER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is no need to change this directive (now or in the future). net7.0
falls under NET6_0_OR_GREATER
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
the problem is we are compiled for .NET6, which would exclude this from code, but the type only available in .NET7
src/Compilers/Core/Portable/InternalUtilities/PlatformInformation.cs
Outdated
Show resolved
Hide resolved
@@ -2,7 +2,7 @@ | |||
<!-- 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 file in the project root for more information. --> | |||
<Project Sdk="Microsoft.NET.Sdk"> | |||
<PropertyGroup> | |||
<TargetFrameworks>net6.0;netcoreapp3.1;netstandard2.0</TargetFrameworks> | |||
<TargetFrameworks>net6.0;netstandard2.0</TargetFrameworks> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
❓ Is there a need to change this? This project is usable outside Roslyn. I'd prefer to only increase the version if the new version is providing some new feature/ability.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason for this is I'm also gonna bump our BCL reference to 7, which would cause error for project targeting 3.1
packages/system.text.encoding.codepages/7.0.0/buildTransitive/netcoreapp2.0/System.Text.Encoding.CodePages.targets(4,5): error : (NETCORE_ENGINEERING_TELEMETRY=Build) System.Text.Encoding.CodePages 7.0.0 doesn't support netcoreapp3.1 and has not been tested with it. Consider upgrading your TargetFramework to net6.0 or later. You may also set true in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You may also set true in the project file to ignore this warning and attempt to run in this unsupported configuration at your own risk.
Can we set that something to true to ignore the error? This is a source package anyways, so it shouldn't matter.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sure. I just wasn't aware of a reason that warrants suppressing the warning.
…ion.cs Co-authored-by: Sam Harwell <sam@tunnelvisionlabs.com>
src/Dependencies/Collections/Microsoft.CodeAnalysis.Collections.Package.csproj
Outdated
Show resolved
Hide resolved
...harp/Analyzers/UseIndexOrRangeOperator/CSharpUseRangeOperatorDiagnosticAnalyzer.InfoCache.cs
Outdated
Show resolved
Hide resolved
src/Features/CSharp/Portable/ConvertNamespace/ConvertNamespaceCodeRefactoringProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/CSharp/Portable/Snippets/CSharpElseSnippetProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/Core/Portable/Snippets/SnippetProviders/AbstractSnippetProvider.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compiler changes LGTM.
@CyrusNajmabadi @akhera99 Could you take another look please? Thanks! |
Snippet changes look good |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Compiler changes LGTM.
src/Analyzers/CSharp/Analyzers/ConvertNamespace/ConvertNamespaceAnalysis.cs
Outdated
Show resolved
Hide resolved
src/Features/CSharp/Portable/ConvertNamespace/ConvertNamespaceCodeRefactoringProvider.cs
Outdated
Show resolved
Hide resolved
src/Features/CSharp/Portable/ConvertNamespace/ConvertNamespaceCodeRefactoringProvider.cs
Outdated
Show resolved
Hide resolved
src/Workspaces/Core/Portable/Rename/ConflictEngine/MutableConflictResolution.cs
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
signing off on most of the IDE changes. but there are outstanding questions for DavidW and JasonMal that need to be answered. Thanks :)
:-/ |
@CyrusNajmabadi the issues that led to those questions were reverted |
I answered mine :P |
@dotnet/roslyn-ide @dotnet/roslyn-compiler Please take a look. Thanks