Skip to content

Conversation

@MathiasPius
Copy link

I've fixed a few issues I encountered whilst trying to build and use the latest version of Visual Rust.

  1. When trying to build a project generated from the standard Rust Application template, MSBuild would crash, because the json-formatted feedback returned from the cargo build command didn't contain a .message component referenced in the LogRustcMessage function. I've chosen here to just exit the logging function early since there's no real message to log. I'm not sure if the information contained in the parent message object itself is perhaps relevant to the output window still.

  2. When you open a file in a project and save it, the MsBuildFileSystemWatcher would produce an error, because Visual Studio 2017* briefly creates a temporary file in the project directory, and in the process of checking its relevance to the project, the MsBuildFileSystemWatcher would attempt to shorten the path of the file after the temporary file was already removed again. This causes the ToShortPath function to throw a Win32Exception that was not handled in the IsFileAllowed function. Since the file no longer exists, the accessibility of the file is a little irrelevant, so I just caught the error so the function returns false.

  • Might be the case with earlier versions as well, but I've only tested it with 2017
  1. The code for loading a project file from scratch sets up an empty project, and then intends to mark it as dirty before requesting a rebuild of the project tree, but never actually marks it as dirty. This means that loading an existing solution from disk yielded a tree in the Solution Explorer containing only the solution and the project itself, but none of the items contained within. It required you to unload and reload the project through the Solution Explorer to actually see the files and folders that made up the project.

Mathias Pius Damm-Pedersen added 3 commits May 6, 2017 12:32
Building Visual Rust projects would cause MSBuild to break when
attempting to access members of a null message
…in32Exception

The core FileSystem.ToShortPath function would throw an exception when
the file whose path it was trying to shorten no longer existed, which
happens when saving a file under Visual Studio 2017, and a temporary
file is created and deleted before the FileSystemWatcher can shorten the
path of it
If projects aren't explicitly marked dirty, loading existing projects
would yield empty project structures in the solution explorer, and
require the user to unload and reload the project in order to see the
file structure.
@MaulingMonkey
Copy link
Collaborator

Looks like I've accidentally duplicated some (but not all!) of the work here in #286 . Was this intentionally closed?

@MathiasPius
Copy link
Author

There seemed to be little interest in it, and it looked like there were a lot of other - bigger - efforts to achieve VS2017 compatibility so I figured my small changes would probably be irrelevant at best, or conflicting at worst.

It looks like your PR is one such effort, so if you can get anything useful out of this one, help yourself :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants