Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix "Ambiguity" errors appearing when files are modified during project load #1357

Merged
merged 1 commit into from
Dec 10, 2018

Conversation

SirIntruder
Copy link
Contributor

@SirIntruder SirIntruder commented Dec 10, 2018

fixes #1356

Context of what happens:

  1. When you edit file before projects get loaded, o# puts them in "Misc" project, because that's the best it can do at the moment.
  2. On project load, MSBuildProjectManager creates a real Document on the same path, which kills the "Misc" document
  3. Problem is: there is a bit of code that tries to "promote" misc documents into the newly loaded project, and this happens before step 2.

This unfortunate timing means that both "TryPromote" and "ProjectLoad" create each their own version of non-misc document (and ambiguity errors follow).

Moving "TryPromote" after actual project load, lets MSBuild properly delete misc files, so unnecessary document creating in "TryPromote" is avoided

cc @akshita31 @rchande @DustinCampbell

On a sIde note:
Its weird that MiscProject has its own version of "Try-to-put-file-into-exisitng-projects" - IMHO TryPromote should use some part of bufferManager's "TryAddTransientDocument".

@SirIntruder SirIntruder changed the title Fix "Already defined" errors appearing when files are modified during project load Fix "Ambiguity" errors appearing when files are modified during project load Dec 10, 2018
@rchande rchande merged commit 2881c46 into OmniSharp:master Dec 10, 2018
@rchande
Copy link

rchande commented Dec 10, 2018

Thanks @SirIntruder!

@glenlance
Copy link

I understand the reason of what this error happen, but I don't know how to resolve it. Could somebody can help me please?

@glenlance
Copy link

Well, in some case, this error seem neither effect the compile process nor the app running normally.

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.

"Ambiguity between '<Type> and '<Type>’" errors if a file is edited before projects are loaded
4 participants