1

I normally run my project with the following debugging option set to true (ticked);

Tools -> Options -> Debugging -> General -> Enable Just My Code (Managed only)

Today, I was trying to figure something out and I unticked it. Then when I executed, I saw lots and lots of exceptions. They look like this;

Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.SqlServer.dll Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.dll Exception thrown: 'System.Data.Entity.Core.EntityCommandExecutionException' in EntityFramework.SqlServer.dll Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll Exception thrown: 'System.IO.FileNotFoundException' in mscorlib.dll

I don't believe that is normal and I suspect this is just cause for panic! I have felt like my project has been running slow for a while but not knowing for sure...

What would be the best course of action to figure out what is causing these exceptions?

Obbles
  • 533
  • 3
  • 17
  • 2
    the best course of action would probably be to start researching what some of the more obvious exceptions being thrown are – Nova Ardent Jul 04 '18 at 12:15
  • this might be of help? https://stackoverflow.com/questions/9729691/an-unhandled-exception-of-type-system-io-filenotfoundexception-occurred-in-unk – Fuzzybear Jul 04 '18 at 12:16
  • 1
    It is not a cause for panic. If it isn't bubbling out into your code it can be safely ignored. – mjwills Jul 04 '18 at 12:18
  • 1
    These are thrown exceptions that have been caught and dealt with by the codebase that they reside in. i.e. They are anticipated and correctly dealt with. If there's a need for you to know about them, then, as @mjwills has stated, they will bubble up to your code. No need for alarm. – spender Jul 04 '18 at 12:20
  • If your project is "running slow", stop guessing and start measuring. There are profiling tools for memory and execution time that will pinpoint the pain points. – spender Jul 04 '18 at 12:23
  • Thanks guys, I must admit I still feel a little skeptical about it not being a problem, but will go with it. Main uneasyness I feel is because I have never seen them before and I feel like those libraries shouldn't be having exceptions, mainly because I presume Microsoft are way better at this than me :) As you guys say tho, if it was a problem it would bubble up. – Obbles Jul 04 '18 at 12:34
  • True spender. No point guessing. I have much to learn. Profiling being one of them. – Obbles Jul 04 '18 at 12:35
  • Those libraries should ideally indeed not throw exceptions on every run, even if they're caught (it makes debugging harder), but sometimes it's the best you can do as opposed to checking in advance, and often Microsoft isn't actually doing the best it can do (even MS developers are only human). In the particular case of `FileNotFoundException`, checking if a file exists is typically omitted because you have to be prepared for the exception anyway (concurrency and all that). Whether redundant checks are worth it for a better debugging experience is debatable. – Jeroen Mostert Jul 04 '18 at 12:42
  • I'm pretty skeptical as well. It is not unusual for framework code to swallow exceptions, but that is always done to speed-up code. Sometimes try/catch is cheaper than prevention. Seeing a lot of them, meh, they are well aware that a lot of them is expensive. It is pretty routine to automatically put dbase query code in a try {} block, whether the catch clauses do a good enough job is not obvious. Force the debugger to stop when such an exception is thrown with Debug > Windows > Exception Settings, tick the checkbox for CLR exceptions. Look at the stack trace when it stops. – Hans Passant Jul 04 '18 at 14:01
  • Thanks Hans. I am trying that just now. My first Exception says System.Data.SqlClient.SqlException: 'Invalid column name 'CreatedOn'.' ....I get a bunch of those....the next few ones stops on errors in my code now....For example; [NotMapped] public virtual DateTime OffAsUtcTime => SuspendTime.Value; Was creating this exception: System.InvalidOperationException: 'Nullable object must have a value.' So I'm getting somewhere. Thank you for your wisdom. – Obbles Jul 04 '18 at 15:22
  • https://stackoverflow.com/questions/19646659/createdon-column-in-entity-framework-6 <-- For reference this is an explanation of my CreatedOn issue .... – Obbles Jul 04 '18 at 15:27

0 Answers0