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

Broken on Windows #64

Closed
s-trooper opened this issue Aug 31, 2015 · 11 comments
Closed

Broken on Windows #64

s-trooper opened this issue Aug 31, 2015 · 11 comments

Comments

@s-trooper
Copy link

With all F# Plugins for Atom,ST and Vim i got StackOverflowException on Win7 64bit (VS2015 installed). Then I tried the following:

I have cloned master branch and build it with build.cmd, in the FsAutoComplete folder i have executed "bin\Debug\fsautocomplete.exe" and put in:

project "FsAutoComplete.fsproj"

Result

Process is terminated due to StackOverflowException.
@rneatherway
Copy link
Contributor

@s-trooper: thanks for reporting! This is obviously a big issue. I haven't seen this problem myself on Win7 with VS2013 or VS2015. Have you used git bisect before? It should be quite quick to find the offending commit using that technique as it is so easy to reproduce on your machine.

@Krzysztof-Cieslak
Copy link
Member

Hmm... I've also experienced some StackOverflowException while using Atom, but it seemed pretty random / I have not found any reliable replication yet. Also bear in mind that Atom is still using 0.21.1 (so F# 3.1 and MSBuild 12)

@s-trooper
Copy link
Author

Just to info, i have tested "0.22.0" brunch now and don't get "StackOverflowException" error but "normal" reference not found as i don't have msbuild12 installed:

{"Kind":"error","Data":"Could not load file or assembly 'Microsoft.Build.Framework, Version=12.0.0.0, Culture=neutral, P
ublicKeyToken=b03f5f7f11d50a3a' or one of its dependencies. ..."}

sadly i am not familiar with git/bisect and functional code debugging can be tricky but i will look at code maybe i am lucky ....

@rneatherway
Copy link
Contributor

@s-trooper: that is good to know. git bisect is very easy to use, I really recommend you try it. This page explains how: https://git-scm.com/book/en/v2/Git-Tools-Debugging-with-Git#Binary-Search

In essence you will want to do:

git bisect start
git bisect bad
git bisect good 0.22.0

At which point git will automatically choose the middle revision to test next, so you can run:

build.cmd
project\bin\Debug\fsautocomplete.exe
project "FsAutoComplete.fsproj"

To check if it fails, and then enter git bisect bad if it does and git bisect good if it is OK. Git will then checkout the next revision to test and repeat. This binary search will find the revision very quickly (probably < 5 tries).

@rneatherway
Copy link
Contributor

PS. You may have to run git fetch --tags so that git knows what 0.22.0 means.

@s-trooper
Copy link
Author

thanks for git tips i will look at it closer.

meanwhile i was lucky and found the bug in the old school fashion (debugging). i have a "Microsoft.Build.resources" file in my msbuild v14 and that cause the stackoverflow error. As i am not familiar with git yet, i have make attachment with patch i hope one can apply it :)

fix msbuild v14 resolution

@rneatherway
Copy link
Contributor

Thanks a lot for the patch. Please could you provide a directory listing for the directory where that file came from, so I can compare it to my own situation?

@s-trooper
Copy link
Author

i suppose you mean the resource file? i am not sure where that come from but i located one here. btw i have German installation here.

Microsoft.Build.resources, Version=14.0.0.0, Culture=de-DE, PublicKeyToken=b03f5f7f11d50a3a
C:\PROGRAM FILES (X86)\MSBUILD\14.0\BIN\AMD64
|   Microsoft.Build.Conversion.Core.dll
|   Microsoft.Build.dll
|   Microsoft.Build.Engine.dll
|   Microsoft.Build.Framework.dll
|   Microsoft.Build.Tasks.CodeAnalysis.dll
|   Microsoft.Build.Tasks.Core.dll
|   Microsoft.Build.Utilities.Core.dll
|
+---de
|       Microsoft.Build.Conversion.Core.resources.dll
|       Microsoft.Build.Engine.resources.dll
|       Microsoft.Build.resources.dll
|       Microsoft.Build.Tasks.Core.resources.dll
|       Microsoft.Build.Utilities.Core.resources.dll

@rneatherway
Copy link
Contributor

OK, it's great that that fixed it, but I would like to understand exactly what is going wrong. Unfortunately I don't have a German installation so I can't easily reproduce, but would you mind running it with a bit more debug and posting the output here?

Specifically, could you replace the event handler with:

  let addMSBuildv14BackupResolution () =
    let onResolveEvent = new ResolveEventHandler( fun sender evArgs ->
      printfn "Failed to resolve '%A'" evArgs.Name
      let requestedAssembly = AssemblyName(evArgs.Name)
      if requestedAssembly.Name.StartsWith("Microsoft.Build") then
        requestedAssembly.Version <- Version("14.0.0.0")
        printfn "Attempting to instead load '%A'" requestedAssembly
        Assembly.Load (requestedAssembly)
      else
        null
          )
    AppDomain.CurrentDomain.add_AssemblyResolve(onResolveEvent)

And then also try adding requestedAssembly.CultureInfo <- System.Globalization.CultureInfo.InvariantCulture after the line that sets the version to 14? That would be really useful, thanks.

@s-trooper
Copy link
Author

Sadly i don't know what is the reason of trouble. I have tested on college PC with VS2012 (German). The same Problem. Loading of "Microsoft.Build.resources.dll" ends in recursion but why?

Anyway

requestedAssembly.CultureInfo <- System.Globalization.CultureInfo.InvariantCulture

don't solve the Problem with and without this line i get the same following output:

project "FsAutoComplete.fsproj"
Failed to resolve '"Microsoft.Build.Framework, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"'
Attempting to instead load 'Microsoft.Build.Framework, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Failed to resolve '"Microsoft.Build.Engine, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"'
Attempting to instead load 'Microsoft.Build.Engine, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Failed to resolve '"Microsoft.Build, Version=12.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"'
Attempting to instead load 'Microsoft.Build, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'
Failed to resolve '"Microsoft.Build.resources, Version=14.0.0.0, Culture=de-DE, PublicKeyToken=b03f5f7f11d50a3a"'
Attempting to instead load 'Microsoft.Build.resources, Version=14.0.0.0, Culture=de-DE, PublicKeyToken=b03f5f7f11d50a3a'
Failed to resolve '"Microsoft.Build.resources, Version=14.0.0.0, Culture=de-DE, PublicKeyToken=b03f5f7f11d50a3a"'
...
Failed to resolve '"Microsoft.Build.resources, Version=14.0.0.0, Culture=de-DE, PublicKeyToken=b03f5f7f11d50a3a"'
Attempting to instead load 'Microsoft.Build.resources, Version=14.0.0.0, Culture=de-DE, PublicKeyToken=b03f5f7f11d50a3a'

Process is terminated due to StackOverflowException.

Where "..." long list of:

Failed to resolve '"Microsoft.Build.resources, Version=14.0.0.0, Culture=de-DE, PublicKeyToken=b03f5f7f11d50a3a"'
Attempting to instead load 'Microsoft.Build.resources, Version=14.0.0.0, Culture=de-DE, PublicKeyToken=b03f5f7f11d50a3a'

EDIT: of course not exactly the same, Culture is changed =)

Failed to resolve '"Microsoft.Build.resources, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a"'
Attempting to instead load 'Microsoft.Build.resources, Version=14.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'

@rneatherway
Copy link
Contributor

OK, latest version on MELPA now seems to fix this.

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

No branches or pull requests

3 participants