GithubHelp home page GithubHelp logo

miniprofiler / dotnet Goto Github PK

View Code? Open in Web Editor NEW
2.9K 130.0 595.0 53.54 MB

A simple but effective mini-profiler for ASP.NET (and Core) websites

Home Page: https://miniprofiler.com/dotnet/

License: MIT License

C# 88.76% PowerShell 0.17% CSS 2.16% Batchfile 0.05% TypeScript 6.67% Less 2.19%

dotnet's Introduction

MiniProfiler for .NET (and .NET Core)

Welcome to MiniProfiler for .NET, ASP.NET, ASP.NET Core, ASP.NET MVC and generally all the combinations of those words. Documentation for MiniProfiler for .NET is in /docs, accessible via GitHub pages at: miniprofiler.com/dotnet. General information for MiniProfiler across platforms can be found at miniprofiler.com. It is part of the .NET Foundation, and operates under their code of conduct.

AppVeyor Build Status Actions Build

The current major version of MiniProfiler is v4.

Handy Links

Building

To build the MiniProfiler solution in Visual Studio, you'll need:

  • Visual Studio 2019 16.3+ (or the .NET Core 3.x SDK)
  • The Web Compiler extension
    • Note: no extension is needed if building via build.cmd or build.ps1 in the repository root. They pull it in via a package.

After a clone, running build.cmd. To create packages, use build.cmd -CreatePackages $true and it'll output them in the .nukpgs\ folder.

Package Status

MyGet Pre-release feed: https://www.myget.org/gallery/miniprofiler

Package NuGet Stable NuGet Pre-release Downloads MyGet
MiniProfiler MiniProfiler MiniProfiler MiniProfiler MiniProfiler MyGet
MiniProfiler.AspNetCore MiniProfiler.AspNetCore MiniProfiler.AspNetCore MiniProfiler.AspNetCore MiniProfiler.AspNetCore MyGet
MiniProfiler.AspNetCore.Mvc MiniProfiler.AspNetCore.Mvc MiniProfiler.AspNetCore.Mvc MiniProfiler.AspNetCore.Mvc MiniProfiler.AspNetCore.Mvc MyGet
MiniProfiler.EF6 MiniProfiler.EF6 MiniProfiler.EF6 MiniProfiler.EF6 MiniProfiler.EF6 MyGet
MiniProfiler.EntityFrameworkCore MiniProfiler.EntityFrameworkCore MiniProfiler.EntityFrameworkCore MiniProfiler.EntityFrameworkCore MiniProfiler.EntityFrameworkCore MyGet
MiniProfiler.EFC7 MiniProfiler.EFC7 MiniProfiler.EFC7 MiniProfiler.EFC7 MiniProfiler.EFC7 MyGet
MiniProfiler.Mvc5 MiniProfiler.Mvc5 MiniProfiler.Mvc5 MiniProfiler.Mvc5 MiniProfiler.Mvc5 MyGet
MiniProfiler.Providers.MongoDB MiniProfiler.Providers.MongoDB MiniProfiler.Providers.MongoDB MiniProfiler.Providers.MongoDB MiniProfiler.Providers.MongoDB MyGet
MiniProfiler.Providers.MySql MiniProfiler.Providers.MySql MiniProfiler.Providers.MySql MiniProfiler.Providers.MySql MiniProfiler.Providers.MySql MyGet
MiniProfiler.Providers.PostgreSql MiniProfiler.Providers.PostgreSql MiniProfiler.Providers.PostgreSql MiniProfiler.Providers.PostgreSql MiniProfiler.Providers.PostgreSql MyGet
MiniProfiler.Providers.RavenDB MiniProfiler.Providers.RavenDB MiniProfiler.Providers.RavenDB MiniProfiler.Providers.RavenDB MiniProfiler.Providers.RavenDB MyGet
MiniProfiler.Providers.Redis MiniProfiler.Providers.Redis MiniProfiler.Providers.Redis MiniProfiler.Providers.Redis MiniProfiler.Providers.Redis MyGet
MiniProfiler.Providers.Sqlite MiniProfiler.Providers.Sqlite MiniProfiler.Providers.Sqlite MiniProfiler.Providers.Sqlite MiniProfiler.Providers.Sqlite MyGet
MiniProfiler.Providers.SqlServer MiniProfiler.Providers.SqlServer MiniProfiler.Providers.SqlServer MiniProfiler.Providers.SqlServer MiniProfiler.Providers.SqlServer MyGet
MiniProfiler.Providers.SqlServerCe MiniProfiler.Providers.SqlServerCe MiniProfiler.Providers.SqlServerCe MiniProfiler.Providers.SqlServerCe MiniProfiler.Providers.SqlServerCe MyGet
MiniProfiler.Shared MiniProfiler.Shared MiniProfiler.Shared MiniProfiler.Shared MiniProfiler.Shared MyGet

License

MiniProfiler is licensed under the MIT license.

dotnet's People

Contributors

adamjez avatar allrameest avatar atotic avatar benbryant0 avatar bgrainger avatar bunk avatar daniilsokolyuk avatar dixon avatar eviltrout avatar jdaigle avatar jeradrose avatar jimmymain avatar joshrobb avatar justinvp avatar kalahari avatar kamranayub avatar kiwidev avatar kosmakoff avatar m3lindru avatar maddyblue avatar nickcraver avatar rtomayko avatar rynonl avatar samsaffron avatar stebet avatar stuffofinterest avatar tommathias avatar trevorpilley avatar turnerj avatar yellis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

dotnet's Issues

No duplicate warning

After an upgrade from 2.1.0 to 3.1.1.140, i see the following:
image

I expected this (from 2.1.0):
image

Move the RenderIncludes method into the Mvc library

One of the things you appear to have done between 2.1 and 3.0.10 is to split the MVC code out of the core MiniProfiler into MiniProfiler.Mvc which is great, however the RenderIncludes method still exists in the core as a method on MiniProfiler. Should that be moved out into the MVC project (possibly as an extension method)?

Digging a little further, it looks like MiniProfilerHandler and WebRequestProfilerProvider also belongs in Mvc not the core.

If they should be shared by Mvc and some other Web platform, should a new MiniProfiler.Web be created which these live in and Mvc references that?

Not showing batch commands

Mini profiler is not showing batch SQL commands.

I'm using it with the MiniProfiler.NHibernate driver. At first I thought it was a problem on the driver (here is the issue link), but, using another profiler (NHibernate profiler), the log performed by the driver works just fine.

So I wonder if this is a problem in the mini profiler itself, not on the driver.

If someone could aid me on this one I would be grateful. So far the only thing preventing us (the company I work at) to use it solely as our profiling is this issue (right now we have to use the other profiler I mentioned, we really want to profile those batch queries).

I'm using the version 2.1.0.0, installed with NuGet.

I have a setup (for debugging) with MiniProfiler installed from NuGet and the code of the driver as another project. The logging performed by MiniProfiler.NHibernate is done by this line:

Factory.Settings.SqlStatementLogger.LogBatchCommand([the string to be logged]);

Where Factory is global::NHibernate.Engine.ISessionFactoryImplementor. I will be glad to perform any test that would help detecting the issue, feel free to ask.

Thanks in advance.

Filter on database

Is there a way to filter out only the database I'm interested in for profiling?

I have 2 databases for my web app. One database is used for the application itself. And another database is only used to log sql queries with the CommandInterceptor and unhandled exception with Elmah.

Also, I see a lot of duplicate sql statements, but it's hard to see if its across both databases or just one.

I don't want to see queries in the profiler that are used for the logger database.

ProfilingViewEngine cannot be added to ViewEngines.Engines with MVC 5.2

Very strange, but Visual Studio seems to complain about how the ProfilingViewEngine cannot be added to ViewEngines.Engines when using ASP.NET MVC 5.2, as seen below:

VS Error

However, this does not prevent from performing a successful build, which I found to be odd.

MP Working?

FWIW, I restarted Visual Studio and that didn't seem to do the trick. Cleaned the Solution and that didn't do a thing either. I am running Resharper with Solution Analysis enabled, but disabling it didn't seem to help either.

I'm not sure if this is something to even be worried about, but I wanted to bring it up anyways in case you guys had any ideas. I'm open to doing a pull request if we decide that this is an actual issue.

Issue when using the MiniProfiler with jQuery.HotKeys

In my project, I'm using the MiniProfiler plus the jQuery.HotKeys plug-in (http://github.com/jeresig/jquery.hotkeys).

I'm noticing that the MiniProfiler some how is affecting the jQuery.HotKeys initialization since jQuery.Hotkeys is dependent on jQuery, and its own initialization use the global variable jQuery.

¿Is there any possibility to ask for an update that allows the MiniProfiler and jQuery.HotKeys live together in the same project?

Thank you.

Kind regards,

Rodrigo.

NullReferenceException on the results page when no storage defined

When accessing /mini-profiler-resources/results and the app pool is not started the following exception happens if there is no storage defined in Application_Start():

[NullReferenceException: Object reference not set to an instance of an object.]
   StackExchange.Profiling.MiniProfilerHandler.GetSingleProfilerResult(HttpContext context) in c:\TeamCity\buildAgent\work\1de24adb938b932d\StackExchange.Profiling\MiniProfilerHandler.cs:292
   StackExchange.Profiling.MiniProfilerHandler.ProcessRequest(HttpContext context) in c:\TeamCity\buildAgent\work\1de24adb938b932d\StackExchange.Profiling\MiniProfilerHandler.cs:93
   System.Web.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute() +341
   System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously) +69

After the first request comes in few F5 retries show the page. Adding the storage fixes the issue:

        protected void Application_Start()
        {
            //....

            MiniProfiler.Settings.Storage = new HttpRuntimeCacheStorage(TimeSpan.FromDays(1));
        }

/mini-profiler-resources/includes.js 404 not found

I've googled around and all answers points to adding this in web.config:

<add name="MiniProfiler" path="mini-profiler-resources/*" verb="*"
           type="System.Web.Routing.UrlRoutingModule" resourceType="Unspecified" preCondition="integratedMode" />  

But it doesn't work for me, can i propose using some free cdns for some of us that are always facing these issues?

Full version of jQuery 1.10.2 (sort of) overwrites my sites old 1.9.1 version

The steps to reproduce my problem:

  1. jQuery 1.9.1 is loaded
  2. my custom plugin is defined on $.fn
  3. MiniProfiler includes is loaded with jQuery 1.10.2
  4. The jQuery variable points to 1.10.2 and the $ variable points to 1.9.1

This causes problems because the plugin i defined before minirpfoiler was loaded is no longer accessible via the jquery object, which I use in my project.

Using with MiniProfiler with MVC3 and EF6

Currently I have an MVC3 application that uses EF6 for it's data access. I am able to get things up and running just fine using the MiniProfiler.MVC3 package and have the timings all appear.

However, after adding MiniProfiler.EF6 package it seems that I am no longer able to resolve the @MiniProfiler.RenderIncludes() method in the StackExchange.Profiling namespace.

I do realise the mvc3 version hasn't seen much (any?) updates in a long while, really I am just after confirmation if this is at all possible before spending more time on it.

Plus I can make do without the db profiling until I have time in my schedule to bring the application up to mvc 4/5

ProfiledDbProviderFactory is breaking SqlDataAdapter if MiniProfiler.Current is null

Code blocks of the following form in ProfiledDbProviderFactory are breaking existing flow when an http request is not profiled.

Specifically,

  1. Create a DbDataAdapter by calling ProfiledDbProviderFactory.CreateDataAdapter method.
  2. Start profiling (MiniProfiler.Start()).
  3. Create a DbCommand with ProfiledDbProviderFactory.CreateCommand method.
  4. Assign the new command to SelectCommand property of the data adapter.

Step 1 creates a DbDataAdapter of the _tail factory's command type which is SqlDataAdapter for this case.
Step 3 creates a ProfiledDbCommand.
Step 4 will assign a ProfiledDbCommand to SqlDataAdapter's SelectCommand which will throw an exception because it is expecting a SqlCommand.

Workaround in https://gist.github.com/krk/e588d0c72c3386959d5e

ProfiledDbProviderFactory.cs:

      MiniProfiler current = MiniProfiler.Current;
      DbCommand command = this._tail.CreateCommand();
      if (current == null)
        return command;
      else
        return (DbCommand) new ProfiledDbCommand(command, (DbConnection) null, (IDbProfiler) MiniProfiler.Current);

MP.EF6 + ASP.NET identity + Owin

When i tryed to init MP.EF6 in my Startup class, i have an exception 👍

Message : The Entity Framework was already using a DbConfiguration instance before an attempt was made to add an 'Loaded' event handler. 'Loaded' event handlers can only be added as part of application start up before the Entity Framework is used. See http://go.microsoft.com/fwlink/?LinkId=260883 for more information.

StackTrace :
  at System.Data.Entity.Infrastructure.DependencyResolution.DbConfigurationManager.AddLoadedHandler(EventHandler`1 handler)
  at System.Data.Entity.DbConfiguration.add_Loaded(EventHandler`1 value)
  at StackExchange.Profiling.EntityFramework6.MiniProfilerEF6.Initialize() dans d:\Files\GitHub\miniprofiler\dotnet\StackExchange.Profiling.EntityFramework6\MiniProfilerEF6.cs:ligne 30
  at ManahostManager.App_Start.WebApiApplication.Configuration(IAppBuilder app) dans c:\Users\Fabrice\Source\Repos\manahostmanager\ManahostManager\App_Start\WebApiApplication.cs:ligne 86

That exception was only occured when i migrate to ASP.NET Identity after that he is working fine

EntityFramework6 DbProviderServices issue

I have updated EF5 to 6 and MiniProfiler.Ef to 2.0.3

I am having issues to run the application now. As per the suggestion by SamSaffron/MiniProfiler#142 I have updated my Web.Config to access the MiniProfiler Provider for the EntityFramework.

But the MiniProfiler.EntityFramework doesn't have a method named EFProfiledSqlClientDbProviderServices and I couldn't find a method which returns System.Data.Entity.Core.Common.DbProviderServices

Could anyone please help me to fix the issue to connect EntityFramework6 with MiniProfiler.Ef

Side note I am using StructureMap for depedency injection.

NullReferenceException in timing.cs

using miniprofiler in a non-mvc environment to capture sql timings

MiniProfiler.Settings.ProfilerProvider = new SingletonProfilerProvider();

var cn = new ProfiledDbConnection(new OleDbConnection(config.IssuesDbConn), MiniProfiler.Current);

using Parallel.Invoke method to perform multiple methods against a group of databases (currently three different methods are running in parallel)

Occasionally receive a NRE in the GetCustomTimingList() method.

    private List<CustomTiming> GetCustomTimingList(string category)
    {
       if (CustomTimings == null)
            CustomTimings = new Dictionary<string, List<CustomTiming>>();

        List<CustomTiming> result;
        lock (CustomTimings)
        {
            if (!CustomTimings.TryGetValue(category, out result))
            {
                result = new List<CustomTiming>();
                CustomTimings[category] = result;
            }
        }
        return result;

I think what is happening is that there is a race condition between the time CustomTimings is checked for existence and the instant when it is created.

If I put a lock around the initial if statement, I haven't encountered the NRE (yet).

Also, the code in this method may lose information in a concurrent environment. a decent explanation is at http://mortoray.com/2012/02/28/double-checked-locking-why-doesnt-it-work-and-how-to-fix-it/

EF6 package can't be installed due to targetFramework=4.5

@yellis The new EF6 package targets .net 4.5. I am using Entity Framework with Visual Studio 2010 and .net 4.0. I can't get the nuget package installed because of the error. Is there a reason for limiting the package to .net 4.5? If not is there a way to get around the issue?

packages.config:

<?xml version="1.0" encoding="utf-8"?>
<packages>
  <package id="EntityFramework" version="6.0.2" targetFramework="net45" />
</packages>

Invalid column name 'CreatedOn'

Why do I keep getting this error msg:

An exception of type 'System.Data.SqlClient.SqlException' occurred in MiniProfiler.dll but was not handled in user code
Additional information: Invalid column name 'CreatedOn'.

I'm using Entity Framework version 6 and miniprofiler.ef6 3.0.10-beta5 and targeting framework 4.5.1

Remove .pdb files from nuget packages

In anticipation of the Nuget package being released soon, I'd like to request that .pdb files be removed from the nuget packages. Having those files there means that if an exception is thrown in the Miniprofiler code, Visual Studio tries to break in the code, and it's annoying to have to tell it that I don't know where the .cs files are.

jQuery is not defined

I am receiving the error ‘jQuery is not defined’ when MiniProfiler loads. The affected website is not loading jQuery by default and it looks like the exception is being thrown by a call in the jquery.hotkeys.js code inside of of includes.js.

The value of useExistingjQuery is false.

I installed the package via NuGET.

SQL command log is not executable

Variable declarations have a single '@' whereas EXEC statement uses variable names with two at signs.

DECLARE @retval int;

EXEC @@retval = sp_Get
SELECT @@retval AS ReturnValue;

EF6 :: MiniProfiler will no longer work with EF 6.1.2 - throws "Unable to cast object of type 'StackExchange.Profiling.Data.ProfiledDbCommand' to type 'System.Data.SqlClient.SqlCommand"

EF6.1.2 introduced SqlProviderServices.CloneDbCommand method to fix one of the issues. Internally this method performs a cast to SqlCommand, and it fails with MiniProfiler (which uses StackExchange.Profiling.Data.ProfiledDbCommand). Method is virtual, and should be overriden by providers.

For more information see: https://entityframework.codeplex.com/workitem/2390

nuspec is wrong for EF 6

Its too specific. EF is up to 6.1 already and the install tries to put in 6.0.1

Suggest a dependency of '6.0' which should give 6.0 <= x according to the specs

Solution Doesn't Build

Hi,

The currently checked in solution does not build.
A set of ui components under StackExchange.Profiling/ui are missing from the repository.

Thanks.

ProfiledMongoCollection.FindAndRemove() yields "need remove or update" error in MiniProfiler.MongoDb 3.0.11

Understandable if this can't be fixed since MiniProfiler.MongoDb 3.0.11 is a bit older, though I thought I'd put it out there in case it can be (since 3.0.11 feels like a "supported version" for slightly older mongocsharpdriver versions, it being listed on the README and all). I'm mainly not sure what the version implications of a fix would be since 3.0.12 is already out. I also figured it'd be good to have this here for the Googles to pick up if anyone else runs into this and goes searching.


When using ProfiledMongoCollection.FindAndRemove() from MiniProfiler.MongoDb 3.0.11 along with mongocsharpdriver 1.8.3, mongo returns this error:

Command 'findAndModify' failed: need remove or update (response: { "ok" : 0.0, "errmsg" : "need remove or update" })

ProfiledMongoCollection.FindAndRemove() calls a private FindAndModifyImpl(), and passes a remove flag, but it doesn't get used by the driver's FindAndModify() call that it makes.

        public override FindAndModifyResult FindAndRemove(IMongoQuery query, IMongoSortBy sortBy)
        {
            return FindAndModifyImpl(query, sortBy, true, null, false, null, false);
        }

        private FindAndModifyResult FindAndModifyImpl(IMongoQuery query, IMongoSortBy sortBy, bool remove, IMongoUpdate update, bool returnNew, IMongoFields fields, bool upsert)
        {
            var sw = new Stopwatch();

            sw.Start();
            var result = base.FindAndModify(query, sortBy, update, fields, returnNew, upsert);
            sw.Stop();
            ...

According to the mongocsharpdriver 1.8.3 docs, it doesn't even look like you can pass a remove flag to its FindAndModify(), so there's probably a slight incompatibility between 3.0.11 and the driver. The fix probably involves calling the driver's FindAndDelete() directly (like is currently happening in master).

Again, not a huge deal, so if it can't be fixed, meh. We're probably going to update our driver sometime soon, anyway, at which point we can upgrade MiniProfiler to the latest and everything will be amazing and glorious. Just wanted this out there 'cause I didn't find it until it hit production for us, since we've only got a single, tucked away place in the code that calls FindAndRemove(), and it didn't get exercised by any of our tests.

Leaking MongoDB Connections

I am using MiniProfiler.MongoDb 3.0.12 (MiniProfiler 3.1.1.140), with MongoDB C# driver 1.9.2. When I use the ProfiledMongoServer wrapper, a connection to the server is left open for each instance of ProfiledMongoServer, quickly exhausting the server's thread limit.

Consider this example demonstrating the issue:

using System;
using System.Threading;
using MongoDB.Driver;
using StackExchange.Profiling.MongoDB;

namespace TestMiniProfilerMongoDb {
    class Program {
        static void Main(string[] args) {
            Console.Out.WriteLine("Press any key to exit...");
            while(!Console.KeyAvailable) {
                var client = new MongoClient("mongodb://smaug");
                var server = new ProfiledMongoServer(client.GetServer());
                var db = server.GetDatabase("test");
                var coll = db.GetCollection("foobar");
                Console.Out.WriteLine(coll.FindOne().ToString());
                Thread.Sleep(TimeSpan.FromSeconds(0.2));
            }
        }
    }
}

If left to run for a few minutes, it will quickly build up thousands of ope server connections. However, if var server = new ProfiledMongoServer(client.GetServer()); is replaces with var server = client.GetServer();, only a single connection to the server is used. I understand that creating a new server instance for each request may seem unusual, but it is an artifact of our implementation, and as MongoServer is not IDisposable, there is no implied need to manage them.

Sample.MVC returns SQLite error with default build: "no such table: RouteHits"

After cloning the repository and trying to run the Sample.Mvc project without changing any settings, I am getting the following error:

SQLite error no such table: RouteHits

Error occurs at ...\dotnet\StackExchange.Profiling\Data\ProfiledDbCommand.cs Line: 277

Stack trace points to
StackExchange.Profiling.Data.ProfiledDbCommand.ExecuteNonQuery() in c:\Users\jellis\Documents\GitHub\dotnet\StackExchange.Profiling\Data\ProfiledDbCommand.cs:277 Dapper.SqlMapper.ExecuteCommand(IDbConnection cnn, IDbTransaction transaction, String sql, Action2 paramReader, Object obj, Nullable1 commandTimeout, Nullable1 commandType) in c:\Users\jellis\Documents\GitHub\dotnet\Sample.Mvc\Dapper\SqlMapper.cs:1384 Dapper.SqlMapper.Execute(IDbConnection cnn, String sql, Object param, IDbTransaction transaction, Nullable1 commandTimeout, Nullable1 commandType) in c:\Users\jellis\Documents\GitHub\dotnet\Sample.Mvc\Dapper\SqlMapper.cs:511 SampleWeb.Controllers.BaseController.UpsertRouteHit(ActionDescriptor actionDesc, MiniProfiler profiler) in c:\Users\jellis\Documents\GitHub\dotnet\Sample.Mvc\Controllers\BaseController.cs:101 SampleWeb.Controllers.BaseController.OnActionExecuting(ActionExecutingContext filterContext) in c:\Users\jellis\Documents\GitHub\dotnet\Sample.Mvc\Controllers\BaseController.cs:55

Examining the sqlite file in question - /Sample.Mvc/App_Data/TestMiniProfiler.sqlite - shows that it is just an empty file.

So was this file supposed to be an actual sqlite db? Or is there some setup routine that it supposed to generate this file properly that for some reason is not running?

Visual Studio 2010 / vb.net - "StepStatic is ambiguous"

I upgraded my site to use MiniProfiler 3.0.10 beta 2 (in Visual Studio 2012), after committing it turned out that the current library is incompatible with Visual Studio 2010, possibly in combination with VB.net.

The Method signatures for StepStatic contain an optional ProfileLevel that will conflict with the one without the optional parameter, e.g:

MiniProfiler.StepStatic(name As String)
MiniProfiler.StepStatic(name As String, Optional level As ProfileLevel = Info)

The error thrown by Visual Studio is:

'StepStatic' is ambiguous because multiple kinds of members with this name exist in class 'StackExchange.Profiling.MiniProfiler'.

Shouldn`t the ProfileLevel be non-optional for this kind of usage?

For now i solved the problem by manually creating Timing objects.

Attached Screenshots for clarity, (note the missing methods in the objectbrowser):
visualstudio 2010

visualstudio 2010-objectbrowser

Can not view results-index - MiniProfiler.list is undefined

Feature to access the last 100 profiled requests via ~/mini-profiler-resources/results-index results in a javascript error that MiniProfiler.list is undefined.

Note that on application start Results_List_Authorize is set:

MiniProfiler.Settings.Results_List_Authorize = r => true;

StepIf and CustomTimingIf Extension Methods

Add new extension methods to MiniProfilerExtensions: StepIf and CustomTimingIf. Will each take a new argument decimal MinMsForSave.

When this is called, will create a new Step or CustomTiming. Results will only be saved if the step takes at least as much time as was given in the MinSaveMs argument. Use the includeChildrenWithMinSave argument (with StepIf) to set whether or not to use time spent in child profiles when making the determination about whether or not to keep the Timing.

Based on this question on SO.

Missing table column in SqlServerStorage

Hi guys,

I’m in the process of upgrading MiniProfiler from 2.1.0 to 3.1.1.140.

I am aware that there have been some nice refactoring in SqlServerStorage class from the persisting the MiniProfiler object in 5 tables to now only 3 tables.

I noticed that the modified [dbo].[MiniProfilers] table is missing the [Name] column.

Profiling without SqlServerStorage,
image

Profiling with SqlServerStorage,
image

Kind regards,

Mikael

Nuget Package

Hi, is there a reason why the nuget package is not updated since years while the development is going on quite well?
Thanks

Database name in Sql Dump

The current interface ISqlFormatter receives too less information in my opinion. I would like to get the database name and the type of the command as well. Is that somehow possible?

Why I need that? We're using a mix of stored procedures and queries and the default implementations of ISqlFormatter treat the command text as sql queries only. When I implement my own formatter, I have too less information to provide my own text.

Further I would need more information about the database parameter's direction for a proper output.

Shall I create a PR for that?

The new release 3.0.11 does not conform to semantic versioning standards

Using the apichange tool:
http://apichange.codeplex.com/wikipage?title=Diff

Compare from 3.0.10 against 3.0.11
MiniProfiler.dll has 21 changes
Added 1 public type/s
+ public class StackExchange.Profiling.SqlFormatters.VerboseSqlServerFormatter
public class StackExchange.Profiling.SqlTimingParameter
+ public string get_Direction()
+ public void set_Direction(String value)
+ public bool get_IsNullable()
+ public void set_IsNullable(Boolean value)
public class StackExchange.Profiling.Storage.DatabaseStorageBase
+ protected void .ctor(ConnectionStringSettings connectionStringSettings)
public class StackExchange.Profiling.Storage.SqlServerStorage
+ public void .ctor(ConnectionStringSettings connectionStringSettings)
public class StackExchange.Profiling.Data.ProfiledDbProviderFactory
+ public void InitProfiledDbProviderFactory(DbProviderFactory tail)
+ public void .ctor(DbProviderFactory tail)
- public void InitProfiledDbProviderFactory(IDbProfiler profiler,DbProviderFactory tail)
- public void .ctor(IDbProfiler profiler,DbProviderFactory tail)
public interface StackExchange.Profiling.SqlFormatters.ISqlFormatter
+ public string FormatSql(String commandText,List parameters,IDbCommand command)
- public string FormatSql(String commandText,List parameters)
public class StackExchange.Profiling.SqlFormatters.InlineFormatter
+ public virtual string FormatSql(String commandText,List parameters,IDbCommand command)
- public virtual string FormatSql(String commandText,List parameters)
public class StackExchange.Profiling.SqlFormatters.SqlServerFormatter
+ protected static readonly Dictionary<DbType,Func<SqlTimingParameter,string>> ParamTranslator
+ protected static readonly System.String[] DontQuote
+ public virtual string FormatSql(String commandText,List parameters,IDbCommand command)
+ protected void GenerateParamText(StringBuilder buffer,List parameters)
+ protected string PrepareValue(SqlTimingParameter parameter)
- public virtual string FormatSql(String commandText,List parameters)

From 1 assemblies were 0 types removed and 7 changed.

Some of those changes are on public interfaces that break compatibility with custom implementations of those interfaces.

Please consider changing the version to 4.0, as you've broken compatibility.

InlineFormatter corrupts SQL when a parameter is missing

In ref. to: StackExchange.Profiling.SqlFormatters.InlineFormatter

If two parameters share the same name, or a named parameter is not found within the SQL InlineFormatter will corrupt the SQL badly.

For example (note :x is used twice):

  SELECT * FROM whatever WHERE x = :x and y = :x

new Parameter("x", "X here!"), new Parameter("Y", "Y here!")

Sent through InlineFormatter.FormatSql() Produces the following output:

 selectY here Y here*Y here fromY here whateverY here whereY here xY here Y here=Y here xvalueY here andY here yY here Y here=Y here xvalueY here

This is because the second parameter matches nothing which causes RegX to replace everything.

This can be fixed by altering FormatSql() within InlineFormatter so that before the line:

       commandText = Regex.Replace(commandText, "(" + name + ")([^0-9A-z]|$)", m => value + m.Groups[2], RegexOptions.IgnoreCase);

You simply check if name is empty or null. Like this:

  if(!string.IsNullOrEmpty(name))
          commandText = Regex.Replace(commandText, "(" + name + ")([^0-9A-z]|$)", m => value + m.Groups[2], RegexOptions.IgnoreCase);

This produces the expected output:

 select * from whatever where x = X here and y = X here

Even if you feel that a user passing in a parameter which doesn't exist or the same parameter name twice is a "user issue," it still seems highly counter-intuitive for InlineFormatter to corrupt the SQL that is displayed in miniProfiler.

It should also be noted that in Oracle re-using a parameter name is legal (Oracle uses the order of the parameters rather than the names themselves).

However adding a single rationality check to see if var name = ParamPrefixes.IsMatch(p.Name) actually did match seems logical and cheap. I cannot think of any situation where name should have an empty value and the Regex.Replace() should still be executed.

Unable to define EFProfiledDbProviderServices class of type 'MySqlProviderServices'

EF6 with MySQL (MySql.Data 6.8.3). In an MVC 5.1 website. Visual Studio 2013. Packages: MiniProfiler 3.0.10-beta7 and MiniProfiler.EF6 3.0.10-beta4.

Error happens at MiniProfilerEF6.Initialize();

After posting this on miniprofiler community... It seems EFProfiledDbProviderServices class expects a public static Property or Field called "Instance" on the MySqlProviderServices class. But on MySqlProviderServices the "Instance" property is marked as internal. It works with SqlProviderServices as this exposes the "Instance" property as public.

So to profile EF6 with MySQL either the MySqlProviderServices class needs to expose the "Instance" property publicly, or MiniProfiler needs to be updated to look for non-public properties too. How do you think this issue should be resolved?

Miniprofiler in OWIN CookieAuthentication's OnValidateIdentity task

Hi!

Found a strange issue: Miniprofiler doesn't register steps when the step is executed in OWIN's CookieAuthentication's OnValidateIdentity Task.

Created an example, the actual StepStatic call is here: https://github.com/AkosLukacs/Autofac-OWIN-MVC/blob/master/AutofacOwinMvc/Startup.ConfigureAuth.cs#L28
Debug messages are written to Trace.

To see what's happening, run the project, just go to /, execution time should be 42+something milliseconds (ExampleMiddleware is waiting for 42ms).
Then go to /home/signin, that should 'sign you in', and redirect you to /home/auth. After that, you should see @OnValidateIdentity messages in Trace, and page execution time should be 42+42+something milliseconds. 42ms from the middleware, and 42ms from the Task.Delay in the OnValidateIdentity Task.

To 'log off', go to /Home/SignOut.

The total execution time is indeed increased, but the 'Step' itself does not show up in Miniprofiler.

Any idea? Am I doing something wrong? Some strange behavior/bug because of async tasks, or owin?

Side note: Actually this started from not seeing SQL calls executed in the OnValidateIdentity task.
My first guess was Autofac is somehow mis-configured. That was true, but Autofac's config is fixed now, but step (and sql calls) still doesn't show up in Miniprofiler results. You can mostly ignore ExampleService and ExampleMiddleware, left there for to see that it's working.

MongoDB Driver needs more exact documentation, or the interface needs to be filled in

The current implementation of the MongoDB driver only supports one method of querying and only one method for getting a collection. It also does not support the full LINQ interface on the MongoCursor. It would be a great help if there was actual documentation saying "this is the only way this class works". I had to dig around to make sure all the methods were actually implemented. This is the only format for querying mongo that's supported:

 var collection = db.GetCollection<MongoItem>("MongoItemCollection", new MongoCollectionSettings());
 foreach (var item in collection.FindAs<MongoItem>(queryById))
 {                
 }

This is extremely frustrating to have to find out digging through code because the only example on the documentation is to wrap the server and then it talks as if it's just going to work. It's not.

This also does not profile:

 var x = collection.FindAs<MongoItem>(queryById).First();

And I get this is because there is no LINQ provider. But how is someone supposed to know that?

Even the sample application does not profile correctly. This is the command that it runs to fetch a record:

 var oneRecord = Repository.FooCollection.FindOneAs<BsonDocument>(Query.GT("r", Random.NextDouble()));

This does not profile. Comment the whole controller out except for that one line, run it, and you'll see no profiling. This is becaue you are not using the code format explained above. So even the code samples aren't correctly showing how to write mongo data access using miniprofiler. The only code that will work with that statement is:

 BsonDocument oneRecord;
 foreach (var record in Repository.FooCollection.FindAs<BsonDocument>(Query.GT("r", Random.NextDouble()))) 
 {
      oneRecord = record;
 }

That, will profile, and only that.

I can't say this is an issue for miniprofiler, because I don't know if you care about profiling GET data queries against mongo. But it sure looks like it should work.

Fixing invalid X-MiniProfiler-Ids responses

Moved bug from: MiniProfiler/ui#5

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.


Code examples are located at the link referenced above. This is still an issue for us on our ASP.NET MVC 4 project.

Update Documentation and Nuget package to restrict access to ~/mini-profiler-resources/results

The current documentation on http://miniprofiler.com/ for .NET is out of date and raises a potential security issue in that by default, it allows anonymous users to be able to access mini profiler results at ~/mini-profiler-resources/results, showing the results of the last profiled request; these results may contain executed SQL, Mongo calls and other configured profile steps.

In addition, the current nuget package does not secure access to ~/mini-profiler-resources/results by default.

I propose updating the documentation and nuget package to add templated code into global.asax when installing the package. The templated code should be similar to that on Sam's blog post (see section "UI less profiling")

// Tell MiniProfiler if the current request can see the UI. 
void Application_Start(object sender, EventArgs e) 
{
   MiniProfiler.Settings.Results_Authorize = httpRequest => IsUserAllowedToSeeMiniProfilerUI(httpRequest);
}

private bool IsUserAllowedToSeeMiniProfilerUI(HttpRequest httpRequest)
{
    // TODO: Implement this to indicate who can access ~/mini-profiler-resources/results
 }

Version Mismatch (Assembly to Package)

It's just minor but there sneaked in a small bug while deploying:

<Reference Include="MiniProfiler, Version=3.0.11.0, Culture=neutral, PublicKeyToken=b44f9351044011a3, processorArchitecture=MSIL">
  <SpecificVersion>False</SpecificVersion>
  <HintPath>..\packages\MiniProfiler.3.1\lib\net40\MiniProfiler.dll</HintPath>

Maybe take it as a note if someone is raising an issue.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.