question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The project system 'DotNetProjectSystem' threw exception during initialization. The specified path, file name, or both are too long

See original GitHub issue

When editing my project even the slightest space breaks the omnisharp service with the following errors. Seems like a windows max path issue to me but don’t seem to make any sense. I tried to copy my project from the c:\Users\[username]\Repos\[solution]\[projectname]\ to a shallow location in c:\[projectname] and it worked did not work after all. The length of the path is about 60 characters long anyway (way shorter than 248).

Since I like my solutions organized I would like to know If this is considered a bug and will be fixed in future versions.

Cheers and keep up the good work.

The error

[INFORMATION:OmniSharp.DotNet.DotNetProjectSystem] Processing [ProjectState] MyCoreApp.WebApi/.NETCoreApp,Version=v1.0 [ERROR:OmniSharp.Startup] The project system ‘DotNetProjectSystem’ threw exception during initialization. The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. at System.IO.PathHelper.GetFullPathName() at System.IO.Path.NormalizePath(String path, Boolean fullCheck, Int32 maxPathLength, Boolean expandShortPaths) at System.IO.Path.GetFullPathInternal(String path) at System.IO.FileSystemEnumerableIterator1..ctor(String path, String originalUserPath, String searchPattern, SearchOption searchOption, SearchResultHandler1 resultHandler, Boolean checkHost) at System.IO.DirectoryInfo.EnumerateFileSystemInfos(String searchPattern, SearchOption searchOption) at Microsoft.Extensions.FileSystemGlobbing.Abstractions.DirectoryInfoWrapper.<EnumerateFileSystemInfos>d__3.MoveNext() at System.Collections.Generic.List1.InsertRange(Int32 index, IEnumerable1 collection) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Match(DirectoryInfoBase directory, String parentRelativePath) at Microsoft.Extensions.FileSystemGlobbing.Internal.MatcherContext.Execute() at Microsoft.Extensions.FileSystemGlobbing.MatcherExtensions.GetResultsInFullPath(Matcher matcher, String directoryPath) at Microsoft.DotNet.ProjectModel.Files.PatternGroup.SearchFiles(String rootPath) at Microsoft.DotNet.ProjectModel.Files.ProjectFilesCollection.get_SourceFiles() at OmniSharp.DotNet.Tools.ProjectContextLens.Resolve() in C:\projects\omnisharp-roslyn\src\OmniSharp.DotNet\Tools\ProjectContextLens.cs:line 41 at OmniSharp.DotNet.DotNetProjectSystem.Update(Boolean allowRestore) in C:\projects\omnisharp-roslyn\src\OmniSharp.DotNet\DotNetProjectSystem.cs:line 134 at OmniSharp.DotNet.DotNetProjectSystem.Initalize(IConfiguration configuration) in C:\projects\omnisharp-roslyn\src\OmniSharp.DotNet\DotNetProjectSystem.cs:line 108 at OmniSharp.Startup.Configure(IApplicationBuilder app, IServiceProvider serviceProvider, IOmnisharpEnvironment env, ILoggerFactory loggerFactory, ISharedTextWriter writer, IOmnisharpAssemblyLoader loader, IOptions`1 optionsAccessor) in C:\projects\omnisharp-roslyn\src\OmniSharp.Host\Startup.cs:line 182 [INFORMATION:OmniSharp.MSBuild.MSBuildProjectSystem] No solution files found in ‘c:\Users\cleft\Source\Repos\helintec\helintec.Forms.Web’ [INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem] Detecting CSX files in ‘c:\Users\cleft\Source\Repos\helintec\helintec.Forms.Web’. [INFORMATION:OmniSharp.ScriptCs.ScriptCsProjectSystem] Could not find any CSX files [INFORMATION:OmniSharp.Startup] Configuration finished. [ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. [ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. [INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /projects: 500 351ms [INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /projects: 500 283ms [ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. [ERROR:Microsoft.AspNetCore.Diagnostics.ExceptionHandlerMiddleware] An unhandled exception has occurred: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters. [INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /projects: 500 250ms [INFORMATION:OmniSharp.Middleware.LoggingMiddleware] /projects: 500 250ms

my setup:

.NET Command Line Tools (1.0.0-rc2-002659)

Product Information: Version: 1.0.0-rc2-002659 Commit Sha: 11a001706f

Runtime Environment: OS Name: Windows OS Version: 10.0.14295 OS Platform: Windows RID: win10-x64

I run on Vs Code insiders v 1.1.0-insider and have installed the RC2 Release Candidate for 4/29.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:10 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
cleftheriscommented, May 11, 2016

@troydai One more thing I noticed. I am currently running on the latest dotnet core where the project.json schema has changed (announcement). The omnisharp plugin currently supports ignoring folders the old way.

This means that the RC2 Release Candidate for 4/29 needs exclude member to be outside of buildOptions.

{
  "description": "My App",
  "authors": [ "indice" ],
  "packOptions": {
    "tags": [ "" ],
    "projectUrl": "",
    "licenseUrl": ""
  },
  "exclude": "node_modules",  <-- this works
  "buildOptions": {
    "preserveCompilationContext": true,
    "emitEntryPoint": true,
    "debugType": "portable",
    "compile": {
      "exclude": "node_modules" <-- this does not work!

    }
  },
 ...
}
1reaction
cleftheriscommented, May 6, 2016

@troydai Wow I added the exclude property like so "exclude": "node_modules" and now it works. But why?? Is it scanning for c# everywhere under the root directory… probably.

Why is this still an issue even for dotnet core.? I thought dotnet core gave an excellent opportunity for breaking changes so why not getting rid of the old 260 character path length limit?. Beats me …

Thanks for the help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Path too long exception with FirefoxProfile - Stack Overflow
Starting FirefoxDriver with FirefoxProfile leads to Exception: The specified path, file name, or both are too long. The fully qualified file ...
Read more >
The specified path, file name, or both are too long.
I am building Xamarin Forms Project with VS2017 Community Edition. An at some point I started to get error messages: The specified path,...
Read more >
How can I handle The specified path, file name, or both are ...
The exception message : The specified path, file name, or both are too long. The fully qualified file name must be less than...
Read more >
omnisharp.msbuild.projectmanager failed to load project file ...
[ERROR:OmniSharp.Startup] The project system 'DotNetProjectSystem' threw exception during initialization. The specified path, file name, or both are too ...
Read more >
The specified path, file name, or both are too long - Support
Purpose You want to resolve the error "The file path is too long". Background A file name that was provided, either on the......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found