Tag: debugging

  • View Raw SQL in EF Core – Simple Option

    Hi everyone, I’ve been looking for a simple way of viewing the raw output of sql in my local environment without having to make code changes and came across the following config setup: { “Logging”: { “LogLevel”: { “Default”: “Debug”, “System”: “Information”, “Microsoft”: “Information” } } This will show the sql statements in your output…

  • Exit Raspberry Pi Camera Preview

    Hey everyone, I ran into a bit of a weird issue with a raspberry pi camera preview today. After starting the preview I hit an uncaught exception which meant that exitPreview was never called. To get around this use the terminal hotkey and kill the python process. Note that while you won’t be able to…

  • Unescape String in Watch Window – Visual Studio

    Hey everyone, Just a quick post on how to remove the escape characters from a string in the watch window. All you’ve got to do is append “,nq” (short for no quotes) to the watch variable name. MyLongString becomes MyLongString,nq This removes all of the quotes and line breaks. Pretty handy for when you’ve got…

  • View Generated SQL in Entity Framework (EF)

    Hey everyone, Just a quick post on how to view the generated sql in entity framework. To start with, just add the following line to your db context constructor: public class TestDbContext : DbContext { public TestDbContext() : base(“name=TestDbContext”) { this.Database.Log = s => System.Diagnostics.Debug.WriteLine(s); //This line } … With this line added, you should…

  • How to Get a JavaScript Stack Trace – Chrome Console

    Hey everyone, Just a quick post on something useful I came across today. In JavaScript you can access the stack trace via console using the following command (ctrl + shift + j): console.trace() In Chrome, this will let you navigate to each relevant call by clicking the line number in the console window. I’ve found…

  • Debugging with Exceptions – Ruby on Rails

    Ran into a bit of trouble with a model today, after a bit of a google I came across this technique which helped me solve it: #Raise exception on object.inspect raise Object.inspect #Example 1 raise order.inspect #Example 2 raise [sub_orders.count].inspect This simply allows you display variable values as an exception. By placing a few of…

Create a website or blog at WordPress.com