RD v2.1.1 in Winword x86, Win10 1709 x64. Installed as local admin, but running as a non-admin user.
I had a parse error with no results, a la #2915. In the TRACE log, I found:
2018-03-11 16:33:11.0510;ERROR-2.1.1.2532;Rubberduck.Parsing.VBA.ComponentParseTask; Unexpected exception thrown in thread 11 while parsing module frmSelectReference, ParseTaskID 80ee7d6e-b27d-447e-be6e-da811ef870b8.;System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Users\username\AppData\Local\Temp\Rubberduck\j2jeja1h.djk'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options, String msgPath, Boolean bFromProxy, Boolean useLongPath, Boolean checkHost)
at System.IO.StreamWriter.CreateFile(String path, Boolean append, Boolean checkHost)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize, Boolean checkHost)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding)
at System.IO.File.WriteAllLines(String path, String[] contents, Encoding encoding)
at Rubberduck.VBEditor.SafeComWrappers.VBA.VBComponent.ExportUserFormModule(String path) in C:\projects\rubberduck\Rubberduck.VBEEditor\SafeComWrappers\VBA\VBComponent.cs:line 135
at Rubberduck.VBEditor.SafeComWrappers.VBA.VBComponent.ExportAsSourceFile(String folder, Boolean tempFile) in C:\projects\rubberduck\Rubberduck.VBEEditor\SafeComWrappers\VBA\VBComponent.cs:line 92
at Rubberduck.Common.ModuleExporter.Export(IVBComponent component, Boolean tempFile) in C:\projects\rubberduck\RetailCoder.VBE\Common\ModuleExporter.cs:line 18
at Rubberduck.Parsing.VBA.AttributeParser.Parse(QualifiedModuleName module, CancellationToken cancellationToken) in C:\projects\rubberduck\Rubberduck.Parsing\VBA\AttributeParser.cs:line 35
at Rubberduck.Parsing.VBA.ComponentParseTask.RunAttributesPass(CancellationToken cancellationToken) in C:\projects\rubberduck\Rubberduck.Parsing\VBA\ComponentParseTask.cs:line 148
at Rubberduck.Parsing.VBA.ComponentParseTask.Start(CancellationToken cancellationToken) in C:\projects\rubberduck\Rubberduck.Parsing\VBA\ComponentParseTask.cs:line 53
I looked in C:\Users\username\AppData\Local\Temp, which is %TEMP%, and found there was no Rubberduck subdirectory. I created 'C:\Users\username\AppData\Local\Temp\Rubberduck in Explorer without errors. After that the parse worked fine.
We should possibly ensure that that folder exists before using it... The fix should be rather simple, especially considering that we should definitely have write access there
Note that the fix in the upcoming PR is specific to the issue of RUBBERDUCK_TEMP_PATH not existing. I'm assuming there are other "unsafe" file writes elsewhere in the code that need Path.Exists tests.
Most helpful comment
Note that the fix in the upcoming PR is specific to the issue of
RUBBERDUCK_TEMP_PATHnot existing. I'm assuming there are other "unsafe" file writes elsewhere in the code that needPath.Existstests.