-
-
Notifications
You must be signed in to change notification settings - Fork 764
Closed
Description
Prerequisites
- I have written a descriptive issue title
- I have searched issues to ensure it has not already been reported
Cake runner
Cake .NET Tool
Cake version
2.2.0
Operating system
Windows
Operating system architecture
64-Bit
CI Server
No response
What are you seeing?
If I turn build caching on and run my build script, and after that dry run the same unchanged script (or vice versa), I get an exception.
What is expected?
I would expect Cake to clear the cache after a dry run (and before running a dry run), or perhaps keep track of whether a switch between dry run and non-dry run has occurred.
Steps to Reproduce
- Enable build script caching via a
cake.configfile - Run
dotnet cake - Run
dotnet cake --dryrun
Output log
Error: System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation.
---> System.InvalidCastException: Unable to cast object of type 'Cake.Cli.DryRunScriptHost' to type 'Cake.Cli.BuildScriptHost'.
at Submission#0..ctor(Object[] submissionArray)
at Submission#0.<Factory>(Object[] submissionArray)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Span`1& arguments, Signature sig, Boolean constructor, Boolean wrapExceptions)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Cake.Infrastructure.Scripting.RoslynScriptSession.RunScriptAssembly(String assemblyPath) in C:\projects\cake\src\Cake\Infrastructure\Scripting\RoslynScriptSession.cs:line 232
at Cake.Infrastructure.Scripting.RoslynScriptSession.Execute(Script script) in C:\projects\cake\src\Cake\Infrastructure\Scripting\RoslynScriptSession.cs:line 115
at Cake.Core.Scripting.ScriptRunner.Run(IScriptHost host, FilePath scriptPath) in C:\projects\cake\src\Cake.Core\Scripting\ScriptRunner.cs:line 172
at Cake.Features.Building.BuildFeature.RunCore(IRemainingArguments arguments, BuildFeatureSettings settings) in C:\projects\cake\src\Cake\Features\Building\BuildFeature.cs:line 99
at Cake.Features.Building.BuildFeature.Run(IRemainingArguments arguments, BuildFeatureSettings settings) in C:\projects\cake\src\Cake\Features\Building\BuildFeature.cs:line 49
at Cake.Commands.DefaultCommand.Execute(CommandContext context, DefaultCommandSettings settings) in C:\projects\cake\src\Cake\Commands\DefaultCommand.cs:line 73