Exception during Context constructor #2937
-
Hi again, While working on moving some build processes to Frosting, I've found that exceptions thrown during the construction of the Context class aren't handled well - the only output when executing outside of an IDE is
At this point my workaround is to handle the exception and some useful output within the constructor, however I think that perhaps the issue here might be that not using this as intended... At this point our context class - which is the context class from the template - has additional properties for all of our build variables, mostly set from command line arguments, but some things are calculated or set from other tools. In this case, the issue was that GitVersion could not be found, because the tools installation process doesn't run until after the context constructor is called. So, what's the right way to go about this? Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Generally setup should be done in a Somthing like public sealed class Lifetime : FrostingLifetime<Context>
{
public override void Setup(Context context)
{
context.Information("Setting things up...");
// here goes the setup..
}
public override void Teardown(Context context, ITeardownContext info)
{
context.Information("Tearing things down...");
}
} |
Beta Was this translation helpful? Give feedback.
Generally setup should be done in a
IFrostingLifetime.Setup
.Somthing like