dotnet / dotnet/msbuild

[Bug]: Cannot create a Project object with the long path prefix \\?\.

Open
#10,645 1 comment 0 reactions 1 assignee Claimed by @rainersigwald View on GitHub
bug triaged
Dominant language
C#
Stars
5.5k
Forks
1.5k
Avg merge
1d 8h
Merged PRs (30d)
141

Description

### Issue Description

Trying to create a `Project` object from a long path when using .NET Framework does not work - fails with various exceptions.

### Steps to Reproduce

The following unit test passes, when it should fail on the first or second assertion:
```csharp
[Test]
public void ProjectPath()
{
var path = ... ; // some project path 255 characters long
Assert.That(() => new Project(path, new Dictionary(), null), Throws.Exception);
Assert.That(() => new Project(@"\\?\" + path, new Dictionary(), null), Throws.Exception);
path = ... ; // a shorter project path
_ = new Project(path, new Dictionary(), null);
}
```
An important detail - the code must be targeting .NET Framework.

### Expected Behavior

Using a long path should work. At least with the `\\?\` prefix.

### Actual Behavior

Either long path variant result in an exception. Albeit a different one.

### Analysis

_No response_

### Versions & Configurations

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.