Comments (16)
What were you doing when you got this message? Are you saving results to Sql?
from dotnet.
I'm starting my web application and than It breaks with that exception when its still loading the browser.
I'm guessing that miniprofiler expects a column createdOn, while there isn't any.
from dotnet.
CreatedOn
does not appear in the MiniProfiler code base.
My guess is that your Entity Framework data context has a CreatedOn
column in some table and your database does not, and the MiniProfilerEF.Initialize()
function is causing an error to occur because of this.
Do you have CreatedOn
anywhere in your data context?
from dotnet.
CreatedOn
used to be a column in version 4.xx (or something) in EF. As of version 5 that was no longer the case. I'm at 6 and there is no such column in any of my models or the migrationhistory table.
from dotnet.
Well, it's coming from somewhere in your code (it definitely isn't from MiniProfiler).
from dotnet.
Check the first comment on this post: http://stackoverflow.com/questions/11979026/entity-framework-5-expects-createdon-column-from-migrationhistory-table
Do you have access to the link in that first comment? It's either deleted or private. But related to this issue.
from dotnet.
It points here
from dotnet.
I'm experiencing exactly the same problem (.ef6 3.0.10-beta5, .net 4.0)
It happens when initializing my dbcontext in Application_Start().
If I remove MiniProfilerEF6.Initialize(), everything works fine. If I add the column CreatedOn to the __MigrationHistory table, it works once. Next time the column has been removed by EF and the exception throws again...
from dotnet.
@oleneveu, yellis is pretty hardheaded, I don't think he will look into it. He's very convinced it's our code. Also, he closes issues instantly.
Try this post on SO: http://stackoverflow.com/questions/23587321/miniprofiler-breaks-on-missing-createdon-column
from dotnet.
Can either of you give code (preferably a full solution zipped or pushed to a rep - even better if you can reproduce this in a fork of Sample.Mvc) that can be used to replicate this?
I believe you that it is happening but cannot reproduce it.
from dotnet.
I have provided some information on the SO post. I will try to provide a project to reproduce the problem if I have enough time...
from dotnet.
To clarify - is this only happening when you run in VS in debug mode? Does it show up in non-debug mode or on prod?
All of the solutions that I have seen revolve around either adding a CreatedOn
column to __MigrationHistory
, turning off change tracking or not throwing this exception in the debugger. Well how about we just swallow this exception in MiniProfilerEF6.Initialize()
- the same way that we are doing right now for a similar error with column "ContextKey"?
This error itself seems to be pretty innocuous and is indicative of some weird leftover issue from EF 4.3 >> EF 5 that is triggered by the way we are tapping into EF6 here, so just ignoring the error doesn't seem like it will cause any harm.
Thoughts?
from dotnet.
I can provide a sample project to reproduce the problem. You can download the zip here:
http://peuplier.i234.me:80/fbsharing/1NRKeqDK
I have removed all binaries, you will have to restore nuget packages.
It seems that EF migrations have to be enabled for the problem to occur. This sample uses SqlCE 4, it might also be related to it...
The break occurs in Application_Start() (see the comment).
from dotnet.
You are right, this is not a real error but just a break that occurs for a reason that I could not find. I have spent some time searching for the code that could be in cause (System.Diagnostics.Debugger.Break();
?) without success.
When running outside of the debugger, everything works fine...
from dotnet.
Ok, I am able to replicate it. This does correspond to the section of code that @oleneveu posted on SO. The EF code here is designed to try out a legacy migration method, and if it catches an error it doesn't do anything with it (the whole purpose of doing this is to see if a CreatedOn column exists, and if so, to drop it first). As others have said, you can avoid this by manually creating a CreatedOn
column but this will be dropped every time, so that is not so practical.
The issue itself is within the EntityFramework code, where (I believe) they are catching an EntityException
when trying out this code. When this is accessed through EntityFramework without MiniProfiler, it catches the EntityException, because the __MigrationHistory
table is being accessed through Entity Framework. However, when MP intercepts this command and runs it through a ProfiledDbCommand, it throws a DbException when it fails, not an EntityException, and if you are set to catch these (as you are by default) in debug mode, then you know what happens.
Potential solutions:
- Submit a PR to EntityFramework to add
catch (DbException) {}
to this section of code - Ignore the Exception using the solution given by @oleneveu in his SO answer.
- Don't use EF Migrations
I just spent some time trying to trap and catch the exception in different ways within the MP.EF6 code, and each time the user-unhandled exception from EntityFramework was still caught and thrown by Visual Studio (until doing option 2 above).
At this point, since it is a debug-only issue and I do not have a way to prevent it from happening in EF6 using our method of initializing MiniProfiler for EF6, I do not see any code changes happening in the MP.EF6 code to address this issue, and the potential solutions above are my recommendations for how to proceed if this issue is occurring for you.
from dotnet.
I think that the problem may be related to the fact that the PDB files are included in the NuGet packages. I have noticed that if I remove the MiniProfiler PDB files, the break does not occurs anymore.
I have edited my SO answer to provide another workaround.
from dotnet.
Related Issues (20)
- How does it compare to OpenTelemetry?
- Profiler is getting command before DbInterceptor HOT 2
- EF Core SQL Queries Missing Quotes on Values
- How to profile StackExchange.Redis?
- Outdated documentation. MiniProfiler.current doesn't exist. HOT 2
- results by id is causing out of memory on the browser
- Timing.cs does not implement IDisposable by the pattern HOT 1
- google浏览器source不显示index-mini-profiler.html HOT 1
- Setting PopupDecimalPlaces does not have any effect
- polling use first instead of last HOT 1
- Profiling EF Core broken by ConfigureAwait(false) HOT 4
- 部署到服务器后swagger没有显示
- ClockOverride HOT 2
- MiniPorfiler Keep repeating the requests HOT 10
- mini-profiler-resources/includes.js?v= 404 not found error on v3.2.0 HOT 1
- mongodb storage error
- Null reference with parallel queries HOT 2
- includes.min.js is served with the incorrect mime type of text/html
- RobiniaDocs API Explorer
- SQL Profiling: Network Time not assigned to SQL cost/time HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from dotnet.