MiniProfiler / dotnet

A simple but effective mini-profiler for ASP.NET (and Core) websites
https://miniprofiler.com/dotnet/
MIT License
2.93k stars 603 forks source link

setting PopupRenderPosition seems to have no effect? #632

Open fluffynuts opened 1 year ago

fluffynuts commented 1 year ago

Since the popup is obscuring some of the navigation I have on my site, I do:

services.AddMiniProfiler(opts =>
{
    opts.PopupRenderPosition = RenderPosition.BottomRight;
});

but the popup still renders top-right. Indeed, if I set to RenderPosition.Left or RenderPosition.BottomLeft neither of these is observed either. Is there something I'm missing here?

rumplin commented 1 year ago

By the looks it seems you are using the ASP.NET Core version https://miniprofiler.com/dotnet/AspDotNetCore PopupRenderPosition property is used by ASP.NET https://miniprofiler.com/dotnet/AspDotNet

Check the bottom of the ASP.NET Core page, there is well documented how to place the tags to _Layout.cshtml document.

fluffynuts commented 1 year ago

then I'd suggest that the dotnet / netstandard version of the library shouldn't have this property available, if it can't be applied? eg something like

public class MiniProfilerOptions
{
  #if !NETSTANDARD
    public RenderPosition PopupRenderPosition { get; set; }
  #endif
}

because otherwise you're going to get a bunch of stupid questions like mine, surely?

Also, I specifically skipped out on the attributes because I was hoping for a central source of truth - I have areas in this app, so I have multiple _Layout.cshtml files

(thanks for getting back to me on this though)

NickCraver commented 1 year ago

@fluffynuts I just tried this in the samples and cannot repro (e.g. the setting works) - are you sure it's not set specifically on the tag helper in the page or something overriding it?

fluffynuts commented 1 year ago

hm, having a quick look (vscode, not my main machine) I see a lot of <mini-profiler position="RenderPosition.Right" so I'll have to double-check tomorrow (ie, remove that attrib) because i have to believe in your testing (: Thanks for the tip (:

NickCraver commented 1 year ago

Welcome! If that doesn't help let's dig deeper :)

fluffynuts commented 1 year ago

Ok, so I've looked into this again, and even if I take out all the attributes where I set position, and set position as anything other than RenderPosition.Right, I still get the overlay at the top right. I've tried RenderPosition.Left at setup time, as well as attempting to force it in the actual view, but the results still come out on the top-right, with the class name mp-right applied. I'm not sure what else to try? I have a feeling those last position attributes were from me fiddling the same some time last year and giving up - this project has been through an upgrade from asp.net mvc4 to asp.net core 7.0, so I had far more pressing concerns 😅

This is what I get, btw: image