Hi, I have a request rather than a bug report.
When the code threw an exception, I got this page.
Although I tried to set the values, I could not found the static properties named TraceConfiguration.DisplayErrroTraces
or the method named environment#Tracing
.
I guess this features are no longer available in the Nancy 2.0, right?
I noticed a few minutes later, that the following code works.
public class Bootstrapper : Nancy.DefaultNancyBootstrapper
{
public override void Configure(INancyEnvironment environment)
{
var config = new Nancy.TraceConfiguration(enabled: false, displayErrorTraces: true);
environment.AddValue(config);
}
}
I think it is better to show the example like above, How do you think?
Hi,
Thanks for letting us know. I think the error message it pretty straight forward, especially the sentence is very explicit about what to do
So for the time being we'll not be making any changes
I find this confusing too, didn't find a way to enable these on the documentation, and using the class from miyatin shows this error:
error CS0234: The type or namespace name 'INancyEnvironment' does not exist in the namespace 'Nancy' (are you missing an assembly reference?)
error CS0115: 'CustomBootstrapper.Configure(INancyEnvironment)': no suitable method found to override
If you're using v2 follow the instructions in the error page. In a bootstrapper override Configure and use environment.Tracing
Right, I was missing a using directive, full class for other people in case they have the same problem:
using Nancy;
using Nancy.Bootstrapper;
using Nancy.TinyIoc;
using Nancy.Configuration;
public class CustomBootstrapper : DefaultNancyBootstrapper
{
public override void Configure(INancyEnvironment environment)
{
environment.Tracing(enabled: false, displayErrorTraces: true);
}
}
Thank you!
What level of logging does config change actually provide? :)
public override void Configure(INancyEnvironment environment) { environment.Tracing(enabled: false, displayErrorTraces: true); }
Yesterday I ran into an issue with the Nancy Bind<> crashing on me with ModelBinding.ModelBindingException
which was caused by a bad DateTime field value 0002-01-01 00:00:00 +0000;
, and I had kind of hoped that this config would actually tell me what the offending attribute was by name
but it didn't.
BTW. Found the bug but I had to resort to writing out several get/set methods on my date fields to find the offending one. :)
Most helpful comment
Right, I was missing a using directive, full class for other people in case they have the same problem:
Thank you!