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

Error when invoking fake run with different casings #2314

Closed
nikolamilekic opened this issue May 9, 2019 · 4 comments
Closed

Error when invoking fake run with different casings #2314

nikolamilekic opened this issue May 9, 2019 · 4 comments
Labels

Comments

@nikolamilekic
Copy link
Contributor

Description

I got the following error so I'm opening an issue as requested.

CACHING WARNING
this might happen after Updates...
please open a issue on FAKE and /cc @matthid ONLY IF this happens reproducibly)

Error: System.Exception: We could not find a type similar to '<StartupCode$Hello_39CC74F39529626A47F150CE9573BBEA9E7A121F27DB517781F4AAE80B07F7A3>.$Hello$fsx' containing a 'main@' method in the cached assembly (D:\projects\Scripts.fake\Hello.fsx\Hello_39CC74F39529626A47F150CE9573BBEA9E7A121F27DB517781F4AAE80B07F7A3.dll)!
at Microsoft.FSharp.Core.PrintfModule.PrintFormatToStringThenFail@1647.Invoke(String message)
at Yaaf.FSharp.Scripting.Helper.consoleCapture[a](TextWriter out, TextWriter err, FSharpFunc2 f) in D:\a\1\s\src\app\Fake.Runtime\YaafFSharpScripting.fs:line 1242 at Fake.Runtime.CompileRunner.tryRunCached(CoreCacheInfo c, FakeContext context) in D:\a\1\s\src\app\Fake.Runtime\CompileRunner.fs:line 47 at Fake.Runtime.CompileRunner.runFakeScript(FSharpOption1 cache, FakeContext context) in D:\a\1\s\src\app\Fake.Runtime\CompileRunner.fs:line 155
Script is not valid:
commandLineArgs (0,0)-(0,0): Error FS2014: A problem occurred writing the binary 'D:\projects\Scripts.fake\Hello.fsx\Hello_39CC74F39529626A47F150CE9573BBEA9E7A121F27DB517781F4AAE80B07F7A3.dll': Could not open file for writing (binary mode): D:\projects\Scripts.fake\Hello.fsx\Hello_39CC74F39529626A47F150CE9573BBEA9E7A121F27DB517781F4AAE80B07F7A3.dll

Repro steps

Please provide the steps required to reproduce the problem

  1. Create a script called hello.fsx

  2. fake run hello.fsx

  3. fake run Hello.fsx (capital H!)

Expected behavior

No error.

Actual behavior

The error.

Known workarounds

Correct capitalization.

Related information

  • Operating system: Win10
  • Version of FAKE (4.X, 5.X): 5.13.5
@matthid
Copy link
Member

matthid commented May 9, 2019

Very nice find, thanks for reporting and the steps

@matthid matthid added the bug label May 9, 2019
@matthid
Copy link
Member

matthid commented May 9, 2019

This are actually two bugs:

  • I think what happens is that FAKE detects something is wrong with the cache and tries to recompile. However the assembly has already been loaded and is "locked", we probably need to "unload" the Assembly Context such that the file-lock disappears and the compilation succeeds.

  • Fake should realize on windows that it doesn't need to recompile stuff if only casing changed.

Imho the first bug should be fixed first. The second is more an enhancement (and a bit of ugliness), but not really a problem.

@matthid matthid changed the title Caching warning "this might happen after Updates..." Error when invoking fake run with different casings Jun 9, 2019
@matthid matthid closed this as completed in 797ddae Jun 9, 2019
@Thorium
Copy link
Member

Thorium commented Sep 3, 2024

I'm facing similar error with FAKE 6.1.1 when trying to run on .NET 8 globals.json, and the issue is probably that .NET compiles a build.fsx to a temporary dll under .fake directory, but then because it's .NET 8 dll, then FAKE (build with .NET 6) cannot read it properly and doesn't find the entry-point @main to the program (even when it actually is there if you look by IlSpy).

@xperiandri
Copy link
Collaborator

If you want to migrate everything to .NET 8, I support

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

4 participants