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/dev16.11 to release/dev16.11-vs-deps #53826

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -383,5 +383,21 @@ public void CombinePaths_DifferentFromPathCombine(string expected, string path1,
{
Assert.Equal(expected, PathUtilities.CombinePaths(path1, path2));
}

[ConditionalFact(typeof(WindowsOnly)), WorkItem(51602, @"https://github.com/dotnet/roslyn/issues/51602")]
public void GetRelativePath_EnsureNo_IndexOutOfRangeException_Windows()
{
var expected = "";
var result = PathUtilities.GetRelativePath(@"C:\A\B\", @"C:\A\B");
Assert.Equal(expected, result);
}

[ConditionalFact(typeof(UnixLikeOnly)), WorkItem(51602, @"https://github.com/dotnet/roslyn/issues/51602")]
public void GetRelativePath_EnsureNo_IndexOutOfRangeException_Unix()
{
var expected = "";
var result = PathUtilities.GetRelativePath(@"/A/B/", @"/A/B");
Assert.Equal(expected, result);
}
}
}
3 changes: 3 additions & 0 deletions src/Compilers/Core/Portable/FileSystem/PathUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -534,6 +534,9 @@ public static string GetRelativePath(string directory, string fullPath)
{
string relativePath = string.Empty;

directory = TrimTrailingSeparators(directory);
fullPath = TrimTrailingSeparators(fullPath);

if (IsChildPath(directory, fullPath))
{
return GetRelativeChildPath(directory, fullPath);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Licensed to the .NET Foundation under one or more agreements.
// 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.
// < auto-generated />
#nullable enable
using System;
using System.ComponentModel;
using Microsoft.CodeAnalysis.FlowAnalysis;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,21 @@ private void WriteFiles()
}
}

using (_writer = new StreamWriter(File.Open(Path.Combine(_location, "OperationKind.Generated.cs"), FileMode.Create), Encoding.UTF8))
{
writeHeader();
WriteUsing("System");
WriteUsing("System.ComponentModel");
WriteUsing("Microsoft.CodeAnalysis.FlowAnalysis");
WriteUsing("Microsoft.CodeAnalysis.Operations");

WriteStartNamespace(namespaceSuffix: null);

WriteOperationKind();

WriteEndNamespace();
}

void writeHeader()
{
WriteLine("// Licensed to the .NET Foundation under one or more agreements.");
Expand Down