I have ASP.NET Core MVC project (targeting .NET 4.62) and I'm trying to save files. Everything works while the length of the path is under 260 (or 248 I'm not sure), but when it's longer I get a System.IO.DirectoryNotFoundException
. Previously when I was targeting .NET 4.61 I was getting Path too long exception, I've read that the problem is fixed in .NET 4.62 but not for me.
Here's exception that I'm getting while path is too long
File.Copy(file, Path.Combine(path, dbFile.Id.ToString()));
I'm pretty sure that directory exists.