Skip to content
This repository has been archived by the owner on Sep 24, 2018. It is now read-only.

Fixing invalid X-MiniProfiler-Ids responses #5

Closed
wants to merge 1 commit into from
Closed

Fixing invalid X-MiniProfiler-Ids responses #5

wants to merge 1 commit into from

Conversation

SeriousM
Copy link
Contributor

Sometimes the X-MiniProfiler-Ids response contains a double-array instead of a single.
With this change, we take the first one and discard the rest.

A normal response looks like that:

["94A4A68F-C2C5-4A66-8369-CC5DAAEF3640"]

Sometimes I get this response:

["94A4A68F-C2C5-4A66-8369-CC5DAAEF3640"], ["94A4A68F-C2C5-4A66-8369-CC5DAAEF3640"]

I do not know why, but this is a fix/workaround for that.

Edit:
I forgot to mention that all the id-parsings now also bundled in one method.

Sometimes the X-MiniProfiler-Ids response contains a double-array instead of a single.
With this change, we take the first one and discard the rest.
@dixon
Copy link
Member

dixon commented Nov 26, 2013

Hmm, which language are you using? It sounds like a bug in one of the server implementations - the client should expect well-formed responses from the server.

@SeriousM
Copy link
Contributor Author

I'm using .net mvc4.
The Double-Response appeared with the official miniprofiler package as well
with the current source I build today.
Used packages: miniprofiler, miniprofiler.ef, miniprofiler.mvc3

@yellis
Copy link
Member

yellis commented Nov 27, 2013

@SeriousM any chance you can see if you can replicate it using the code in the dotnet repo? The code in the nugets you used is from version 2.x - code up here right now is from version 3.x (new nugets imminent)

@SeriousM
Copy link
Contributor Author

Yes I was able to reproduce the situation with the current source.
Can I help you further?

@yellis
Copy link
Member

yellis commented Nov 27, 2013

Can you post code or a fork that reproduces this?

@SeriousM
Copy link
Contributor Author

SeriousM commented Dec 3, 2013

I can give you the relevant code examples.

public static void PreStart(bool autoShow)
{
    MiniProfiler.Settings.SqlFormatter = new StackExchange.Profiling.SqlFormatters.SqlServerFormatter();

    MiniProfiler.Settings.ExcludeStackTraceSnippetFromCustomTimings = false;
    MiniProfiler.Settings.StackMaxLength = 1000;

    MiniProfiler.Settings.TrivialDurationThresholdMilliseconds = 3;

    MiniProfiler.Settings.IgnoredPaths = 
        new[]
            {
                "/content/", "/scripts/", "/favicon.ico", "/images/", "/viewscripts/"
            };

    MiniProfilerEF.InitializeEF42(false);

    GlobalFilters.Filters.Add(new ProfilingActionFilter());

    MiniProfiler.Settings.PopupShowTrivial = false;
    MiniProfiler.Settings.PopupRenderPosition = RenderPosition.Right;
    MiniProfiler.Settings.PopupMaxTracesToShow = 50;
    MiniProfiler.Settings.ShowControls = autoShow;
    MiniProfiler.Settings.PopupShowTimeWithChildren = true;
}
public static void PostStart()
{
    var copy = ViewEngines.Engines.ToList();
    ViewEngines.Engines.Clear();
    foreach (var item in copy)
    {
        ViewEngines.Engines.Add(new ProfilingViewEngine(item));
    }
}
static void OnBeginRequest(HttpRequest request)
{
    if (request.IsLocal)
    {
        MiniProfiler.Start();
    }
}
public static void OnEndRequest()
{
    MiniProfiler.Stop();
}

I call these functions on my own during the app-startup, not via the attributes.

Is that enough?

@SeriousM
Copy link
Contributor Author

SeriousM commented Dec 6, 2013

any updates on this issue?

@SeriousM
Copy link
Contributor Author

SeriousM commented Jan 7, 2014

bump?

@jcoutch
Copy link

jcoutch commented Apr 7, 2014

Has any progress been made towards fixing this bug? We're also experiencing it in our ASP.NET MVC 4 application.

@maddyblue
Copy link
Member

Please move this issue to https://github.com/MiniProfiler/dotnet.

@maddyblue maddyblue closed this Apr 12, 2014
@SeriousM
Copy link
Contributor Author

Due my current situation (changed company + project) I'm not interested in the solution anymore. @jcoutch, can you take the responsibility?

@SeriousM SeriousM deleted the patch-1 branch April 15, 2014 10:54
@jcoutch
Copy link

jcoutch commented Jun 10, 2014

@SeriousM - Sorry for the delay...been busy the past couple months. Sure, I'll move it over to the dotnet project and follow up.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants