Visual Studio 2022 only - Glimpse error; "Runtime policy does not allow execution of resource named 'glimpse_config'."

136 Views Asked by At

When I debug my project (in VS 2022), using URL: "https://localhost:44329/glimpse.axd" I get the following error in the browser window. "Runtime policy does not allow execution of resource named 'glimpse_config'."

This error only happens when using Visual Studio 2022 Professional. When running the same code, same repository in Visual Studio 2019 Professional, Glimpse runs fine and I can access it, as mentioned in: https://learn.microsoft.com/en-us/aspnet/mvc/overview/performance/profile-and-debug-your-aspnet-mvc-app-with-glimpse

I've reviewed the option settings between my two Visual Studios and no luck. What am I missing?

Note: My web.config file already has code mentioned here: Runtime policy does not allow execution of resource named 'glimpse_config'

For better or worse, I made this a separate question and didn't tac it onto the above question because this seems to pertain to my Visual Studio 2022 setup.

1

There are 1 best solutions below

0
Chris Patterson On

I figured the problem out.

This code that I inherited, had this Glimpse class and methods in it:

    public class GlimpseSecurityPolicy:IRuntimePolicy
{
    public RuntimePolicy Execute(IRuntimePolicyContext policyContext)
    {
       stuff...
    }

    public RuntimeEvent ExecuteOn
    {
       stuff...
    }
}

I just commented out this entire class and that has allowed Glimpse to work in Visual Studio 2022. Interestingly enough, this was NOT causing an issue in Visual Studio 2019.