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

Visual Studio locking access to xml doc files #57

Closed
eiriktsarpalis opened this issue Jan 19, 2015 · 40 comments
Closed

Visual Studio locking access to xml doc files #57

eiriktsarpalis opened this issue Jan 19, 2015 · 40 comments
Labels

Comments

@eiriktsarpalis
Copy link
Member

This is a common annoyance when using Visual Studio together with FAKE. Running a FAKE build while the solution is open in Visual Studio invariably results in the following error:

FSC : error FS0193: Access to the path 'path_to_bin_folder\project.XML' is denied. ['path_to_project\project.fsproj']

The error persists even if the solution is closed from within Visual Studio. The IDE needs to be restarted in order for the problem to go away.

@forki
Copy link
Contributor

forki commented Jan 19, 2015

yes this is a major annoyance

@theimowski
Copy link

👍

@forki
Copy link
Contributor

forki commented Jan 19, 2015

any ideas where we need to look?

@braden
Copy link
Contributor

braden commented Jan 19, 2015

I have noticed this also happens occasionally when project files change externally and VS reloads them, unrelated to FAKE. I had suspected F# Power Tools, maybe there is something in common?

@latkin latkin added the Bug label Jan 19, 2015
@dsyme
Copy link
Contributor

dsyme commented Jan 19, 2015

I'd love to see this fixed, I've seen it somewhat randomly when compiling quite a range of projects with Visual F#.

@ovatsus
Copy link

ovatsus commented Jan 19, 2015

I've also seen this. On F# Data I went to some trouble to try to not lock the .dll files, but then the .xml file is still locked :/
fsprojects/FSharp.Data@8734a17

@latkin
Copy link
Contributor

latkin commented Jan 21, 2015

Curious - does this seem to affect only F#, or has anyone experienced it with C#, too? Would also be good to know if this is a long-standing problem, or has this been the case for multiple VS releases?

@ovatsus
Copy link

ovatsus commented Jan 21, 2015

This problem has existed at least since VS2012, and I never saw it in C#

@dungpa
Copy link
Contributor

dungpa commented Jan 22, 2015

According to this answer http://stackoverflow.com/questions/6515795/why-is-my-xml-doc-file-always-getting-locked, this code fragment supposes to fix the bug https://github.com/Microsoft/visualfsharp/blob/fac44095a8dbc7303efa9866e0e2d9dddbdeae5d/vsintegration/src/vs/FsPkgs/FSharp.Project/Common.Source.CSharp/Project/ProjectConfig.cs#L1877-L1896. I'm not sure there is any regression here. Is there any historical note elsewhere about this bug?

For now, this answer seems like a reasonable workaround http://stackoverflow.com/a/3969978.

@rojepp
Copy link
Contributor

rojepp commented Jan 26, 2015

@dungpa If I understand that fix correctly, it fixes for for building in VS only:
When a build starts, ask intellisense to stop locking xml doc. After build is finished, tell intellisense that its ok to lock this file again. This means building from command line will never work properly. How can we tell intellisense to never lock this file?

@dungpa
Copy link
Contributor

dungpa commented Jan 26, 2015

@rojepp

How can we tell intellisense to never lock this file?

No idea. I don't understand why it needs to lock xml files in the first place.

@vladima @KevinRansom @latkin Any pointer to investigate this further?

@latkin
Copy link
Contributor

latkin commented Jan 26, 2015

Ok, just investigated a bit. This repros for C#, as well, at least as far back as VS 2013.

Steps:

  • Create C# library project, add some XML doc comments, make sure project setting to generate doc file is enabled
  • Build, then close VS
  • Create new VS C# project, reference built binary from earlier.
  • Use editor to view XML doc comments via intellisense
  • Try re-building original project on command line via MSBuild
    • This fails due to XML doc file locked

So at least F# is not doing anything worse than C# here.

That's not to say this couldn't in theory be fixed (for all languages). Seems that project systems don't actually touch the XML doc files themselves, they rely on VS platform to handle this (lots of complexities around path to localized XML files, etc). Code here is using IVsXMLMemberIndexService. So the bug (and the fix) is somewhere in the VS platform/SDK, not in the F# codebase.

Maybe I will log a bug on the platform team to look at this.

@rojepp
Copy link
Contributor

rojepp commented Jan 27, 2015

@latkin Please do file a bug and report any progress back here. :)

latkin pushed a commit that referenced this issue Jan 28, 2015
@forki
Copy link
Contributor

forki commented Mar 12, 2015

@latkin any news about from the platform team?

@dnauck
Copy link

dnauck commented Mar 12, 2015

+1

1 similar comment
@Arcitectus
Copy link

👍

@latkin
Copy link
Contributor

latkin commented Mar 12, 2015

I've found an old internal bug tracking thing. It ended up getting closed, I think just because it was close to a deadline and nobody had a chance to follow up.

I can bring that bug back to life, but first I'd like to know when the issue was introduced. If would help if someone could give positive confirmation whether this repros in VS 2012 and VS 2010, if you have those installed. My steps here #57 (comment) should be valid to repro.

@yukitos
Copy link

yukitos commented Mar 13, 2015

I tried VS 2008, 2010, 2012, and this repros in all of them 😢

@dsyme
Copy link
Contributor

dsyme commented Mar 17, 2015

I hit this problem yesterday (I had to restart VS to update some nuget packages due to XML file locking)

@latkin
Copy link
Contributor

latkin commented Mar 21, 2015

FYI, @KevinRansom is poking the VS platform people about this, hopefully more updates next week

@KevinRansom
Copy link
Member

The team that owns this code has been identified and a bug raised. We will keep you posted as to progress.
Just to set expectations you should recognize that this behavior has been substantially the same since Whidbey without this bug getting a lot of attention and so they may not be inclined to change it at this time.

@forki
Copy link
Contributor

forki commented Mar 21, 2015

Thanks for opening the issue. Is this a private Microsoft issue tracker or can we see progress/discussion?

@forki
Copy link
Contributor

forki commented Mar 21, 2015

Regarding activity: maybe it wasn't a big issue at the time when the bug got introduced, but since NuGet is used everywhere people see this issue all the time (at least that's what my twitter stream is suggesting for a couple of years)

@latkin
Copy link
Contributor

latkin commented Mar 21, 2015

@forki it's in a private bug database

@KevinRansom
Copy link
Member

We'll keep y'all in the loop as my southern wife would say.

@latkin
Copy link
Contributor

latkin commented Apr 15, 2015

This got discussed a bit with platform people over the past few weeks. It's almost surely not going to be fixed for VS 2015 RTM, but it's on their radar perhaps for an early VS update after that. No guarantees , though.

Just wanted to let you know this hasn't totally disappeared into a black hole.

@dsyme dsyme added the pri-1 label May 12, 2015
@forki
Copy link
Contributor

forki commented Sep 4, 2015

Ping. Any news on this? It's still no. 1 annoyance for me. Working with cmd line tools like FAKE or git and having solution open is not possible.

@forki
Copy link
Contributor

forki commented Sep 22, 2015

ping

@eiriktsarpalis
Copy link
Member Author

ping++

@TWith2Sugars
Copy link

pong++

@cdrnet
Copy link

cdrnet commented Oct 4, 2015

ping - was just blocked once more where VisualStudio failed to compile an F# project because it was locking the xml file itself (sic) (no FSI or external tools involved).

@KevinRansom
Copy link
Member

Lol with the pings. This was fixed in the VS platform, and will be part of VS 2015 Update 1.

Kevin

@eiriktsarpalis
Copy link
Member Author

I just tried the CTP, and can confirm that the problem has gone away. This has easily saved me 20 minutes of work every day. 😃

@rojepp
Copy link
Contributor

rojepp commented Oct 16, 2015

Lovely!

@vasily-kirichenko
Copy link
Contributor

👍

@rodrigovidal
Copy link

\o/ What a day, what a lovely day!

@forki
Copy link
Contributor

forki commented Oct 17, 2015

Wow. That's great to hear. Thanks so much.
On Oct 17, 2015 6:01 AM, "Rodrigo Vidal" notifications@github.com wrote:

\o/ What a day, what a lovely day!


Reply to this email directly or view it on GitHub
#57 (comment)
.

@forki
Copy link
Contributor

forki commented Oct 27, 2015

@KevinRansom could you please ask if this was also resolved for dll file locking? Can we switch branches from cmd line when VS is open?

@hmemcpy
Copy link

hmemcpy commented Oct 27, 2015

Is the CTP containing this fix publicly available? If not, is there an ETA?

@khellang
Copy link
Member

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests