Search Issue Tracker
Duplicate
Votes
0
Found in
2017.2.0f3
Issue ID
960173
Regression
No
"FileNotFoundException: Could not find file" error when the path to script file is too long
To reproduce:
1. Download attached project "IssuePathTooLong.zip" and open in Unity
2. Create one more subfolder in "ReallyLongFolderNameWoopWoop 5" folder and put in it "behaviourparent.cs" script
Note: You should see in Console these errors:
"DirectoryNotFoundException: Could not find a part of the path "C:\Users\Jonas\Desktop\Projects\960173\Assets\ReallyLongFolderNameWoopWoop\ReallyLongFolderNameWoopWoop 1\ReallyLongFolderNameWoopWoop 2\ReallyLongFolderNameWoopWoop 3\ReallyLongFolderNameWoopWoop 4\ReallyLongFolderNameWoopWoop 5\reallylongfoldernamewoopwoop 6\behaviourparent.cs".
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, Boolean anonymous, FileOptions options) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/FileStream.cs:292)
System.IO.FileStream..ctor (System.String path, FileMode mode, FileAccess access, FileShare share)
(wrapper remoting-invoke-with-check) System.IO.FileStream:.ctor (string,System.IO.FileMode,System.IO.FileAccess,System.IO.FileShare)
System.IO.File.OpenRead (System.String path) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/File.cs:363)
System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding, Boolean detectEncodingFromByteOrderMarks, Int32 bufferSize) (at /Users/builduser/buildslave/mono/build/mcs/class/corlib/System.IO/StreamReader.cs:167)
System.IO.StreamReader..ctor (System.String path, System.Text.Encoding encoding)
(wrapper remoting-invoke-with-check) System.IO.StreamReader:.ctor (string,System.Text.Encoding)
ICSharpCode.NRefactory.ParserFactory.CreateParser (System.String fileName, System.Text.Encoding encoding)
ICSharpCode.NRefactory.ParserFactory.CreateParser (System.String fileName)
UnityEditor.Scripting.Compilers.CSharpLanguage.GetNamespace (System.String fileName, System.String definedSymbols) (at C:/buildslave/unity/build/Editor/Mono/Scripting/Compilers/CSharpLanguage.cs:44)
UnityEditor.Scripting.ScriptCompilers.GetNamespace (System.String file, System.String definedSymbols) (at C:/buildslave/unity/build/Editor/Mono/Scripting/ScriptCompilers.cs:98)
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEngine.GUIUtility:ProcessEvent(Int32, IntPtr)
"
"error CS2001: Source file `Assets/ReallyLongFolderNameWoopWoop/ReallyLongFolderNameWoopWoop 1/ReallyLongFolderNameWoopWoop 2/ReallyLongFolderNameWoopWoop 3/ReallyLongFolderNameWoopWoop 4/ReallyLongFolderNameWoopWoop 5/ReallyLongFolderNameWoopWoop 6/behaviourparent.cs' could not be found
Compilation failed: 1 error(s), 0 warnings"
Reproduced on Unity 5.5.5p1, 5.6.4p2, 2017.1.2p2, 2017.2.0p1, 2017.3.0b8 and 2018.1.0a3
On Unity 2017.1.2p2 it shows only "DirectoryNotFoundException: Could not find a part of the path" error, and on Unity 2017.2.0a2 it shows both errors
Comments (2)
Add comment
All about bugs
View bugs we have successfully reproduced, and vote for the bugs you want to see fixed most urgently.
Latest issues
- Material is not blitted onto the screen when the Camera is rendering to a Render Texture
- See what’s new AI Assistant window’s “Join the conversation in Discussions” hyperlink leads to a page that does not exist
- Items in asset list are not fully accessible due to missing scrollbar
- Inpaint tab does not display all AI Models shown in Generate tab
- "IOException: The process cannot access the file" error when double-clicking on a generated Cubemap
Brunel
Nov 20, 2017 12:41
Could someone please link to the solution/ original issue.