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

Improve Razor diagnostic experience when not using a debugger #561

Merged
merged 1 commit into from
Apr 2, 2013

Conversation

aaronlerch
Copy link
Contributor

Improve the experience of Razor view template exceptions by including
the error messages in the output. When running outside of a debugger,
this information is otherwise nearly impossible to retrieve.

An example output (this happens to be running under Mono on a mac):

ERROR: Error compiling /Views/Example.cshtml with errors:
 -- /var/folders/tw/gm7sjw2n5m1fg8mp75g36ww80000gn/T/1a800d9b/15e87bd7.0.cs(53,12) : error CS0029: Cannot implicitly convert type `string' to `bool'
, Exception: Unable to compile template. Check the Errors list for details.

Unhandled Exception:
ServiceStack.Razor.Templating.TemplateCompilationException: Unable to compile template. Check the Errors list for details.
  at ServiceStack.Razor.Compilation.CompilerServiceBase.CompileType (ServiceStack.Razor.Compilation.TypeContext context) [0x00000] in <filename unknown>:0 
  at ServiceStack.Razor.Templating.TemplateService.CreateTemplate (System.String template, System.Type modelType) [0x00000] in <filename unknown>:0 
  at ServiceStack.Razor.Templating.TemplateService.Compile (ServiceStack.Razor.ViewPageRef viewPageRef, System.String template, System.Type modelType, System.String name) [0x00000] in <filename unknown>:0 
  at ServiceStack.Razor.Templating.TemplateService.Compile (ServiceStack.Razor.ViewPageRef viewPageRef, System.String template, System.String name) [0x00000] in <filename unknown>:0 
  at ServiceStack.Razor.ViewPageRef.Compile (Boolean force) [0x00000] in <filename unknown>:0

Improve the experience of Razor view template exceptions by including
the error messages in the output. When running outside of a debugger,
this information is otherwise nearly impossible to retrieve.
@aaronlerch
Copy link
Contributor Author

I finally got annoyed enough with having to load up a debugger and break on exceptions just to see the razor syntax I screwed up 👍

mythz added a commit that referenced this pull request Apr 2, 2013
Improve Razor diagnostic experience when not using a debugger
@mythz mythz merged commit b3b6a98 into ServiceStack:master Apr 2, 2013
@mythz
Copy link
Member

mythz commented Apr 2, 2013

ok brilliant, thx!

@mythz
Copy link
Member

mythz commented Apr 2, 2013

Great, frustration-driven-development is a great way to encourage pull-requests! :)

@aaronlerch
Copy link
Contributor Author

At the rate I'm going, I might submit the Razor v2 integration soon enough!! ;)

@jeffgabhart
Copy link
Contributor

Thanks Aaron - this is going to be quite helpful

@stabbylambda
Copy link
Contributor

Agreed. This is fantastic. I was contemplating doing the same thing, but I just hadn't gotten fed up enough yet. 👍

@mythz
Copy link
Member

mythz commented Apr 2, 2013

@aaronlerch Great, if you do want to take on Razor v2 you should talk with @dsimunic as you might be able to divvy up the work: https://github.com/ServiceStack/ServiceStack/issues/547

@bchavez
Copy link
Contributor

bchavez commented Apr 5, 2013

I still like ASP.NET's ability to show the source in the browser when debugging.

@mythz Would you accept a pull request that had the same kind of dev experience? I'd be happy to write a pull request.

Screen022

@mythz
Copy link
Member

mythz commented Apr 5, 2013

@bchavez yep for sure, thing to watch out for is EndpointHostConfig.DebugMode if its true it means its in development and you can show all the diagnostic info you want. If it's false it means it's in production and you need to be careful not to leak any sensitive info out.

@IdleMach
Copy link

Is this change now released in v3.9.45+ as I'm still getting a generic HttpCompileException for binding errors?

@waynebrantley
Copy link
Contributor

Since this change is from a month ago - there have been several releases to NuGet since then, so yes, I would say it is released. Post a question on stackoverflow or submit a broken test case here.

@dsimunic
Copy link
Contributor

Razor support got rewritten since this commit.

I committed one improvement to the latest Razor code yesterday (#684), please see if that resolves your problem.

On 21 mai 2013, at 13:53, waynebrantley notifications@github.com wrote:

Since this change is from a month ago - there have been several releases to NuGet since then, so yes, I would say it is released. Post a question on stackoverflow or submit a broken test case here.


Reply to this email directly or view it on GitHub.

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