question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Hide some generated Razor page properties in the debugger

See original GitHub issue

We’re improving the ASP.NET Core debugging experience. One area that can improve is debugging Razor pages.

A generated Razor pages add some properties:

https://github.com/dotnet/razor/blob/dd8b2717ea1c0707cbeb9cbdb4807d8395229705/src/Compiler/Microsoft.AspNetCore.Mvc.Razor.Extensions/test/TestFiles/IntegrationTests/CodeGenerationIntegrationTest/ViewWithNamespace_Runtime.codegen.cs#L28-L47

These don’t provide useful information in the debugger and clutter the debug view for the page. We want to limit the debug view to useful information such as the page model, properties added to the page by the developer, and request information.

Because this properties are added in generated pages, the Razor page generator needs to place [DebuggerBrowsable(DebuggerBrowsableState.Never)] on the properties.

These should be hidden in Razor pages and MVC views.

Issue Analytics

  • State:closed
  • Created 2 months ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
jaredparcommented, Jul 12, 2023

Because this properties are added in generated pages, the Razor page generator needs to place [DebuggerBrowsable(DebuggerBrowsableState.Never)] on the properties.

Don’t think this is the best approach. While not useful in most scenarios I’m sure that certain segments of customers do find them useful. This property effectively hides them in all cases.

0reactions
JamesNKcommented, Aug 7, 2023

I don’t think there is a good way to do this. Closing for now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

hide model variable's / property's value from the developer ...
Simplest way to add a hidden field for all properties of a Asp.net MVC 3 model? 1. MVC 3 - Only display/use certain...
Read more >
Introduction to Debugging ASP.NET Web Pages (Razor) ...
This article explains various ways to debug pages in an ASP.NET Web Pages (Razor) website. Debugging is the process of finding and fixing ......
Read more >
Debug ASP.NET Core Blazor WebAssembly
Learn how to debug Blazor WebAssembly with browser developer ... Set a breakpoint in the Pages/FetchData.razor page in OnInitializedAsync.
Read more >
Debugging .NET Core Apps with Visual Studio Code
Open the Pages directory and the Index.cshtml.cs file. Set a breakpoint on the first line of the OnGet method and run the app...
Read more >
Razor Pages for ASP.NET Core - Full Course (.NET 6)
Learn the basics of Razor Pages for ASP. ... Create Property in Page Model ⌨️ (1:48:29) Create Category and Bind Property ⌨️ (1:55:09) ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found