What is Ozcode?
Ozcode is a must have Visual Studio Extension which cuts down on debugging time and increases productivity by detecting and isolating bugs, making them easy to fix.
Ozcode turns C# debugging into a simple, efficient, and even fun experience!
How is the Ozcode debugger different from the Visual Studio debugger?
Ozcode integrates with the Visual Studio debugger, and expands on its functionality. Among other features, Ozcode predicts the future of a function code execution and provides insights that enable fast problems solving. Ozcode allows to search for properties, compare objects, evaluate expressions and create tracepoints - all leading to a fast and productive debugging session.
What versions of Visual Studio does Ozcode support?
Visual Studio 2015, 2017 and 2019 (including community editions)
Express editions are not supported.
I LOVE ReSharper! How is Ozcode different, and do they work together?
Ozcode does to debugging what ReSharper does to coding, and they work seamlessly together. Studies have shown that developers spend about 50% of their time on debugging. Ozcode significantly reduces this time, and makes sure developers remain focused on development – what they do best.
Main Features
Predict the Future
In regular debugging, once a breakpoint hits, we are able to see the state of the program as it is now. We can evaluate any expression and get its value as it is when the program hits our breakpoint. Time Travel Debugging in Ozcode changes the game and allows you to Predict the Future.
While standing on any breakpoint, Ozcode will run through the rest of the method and evaluate all the lines of code in the future. You will be able to see the result of the prediction with a Heads-up-display (HUD).
The evaluation is made using VIL, which is the same mechanism used in the Immediate window and Watch window.
Unlike the Immediate Window, Ozcode evaluation of the future is in no-side-effects mode, so the program state is not changed.
The evaluation ends when reaching the end of the current method or when encountering Native Code. Native code can’t be evaluated in no-side-effects mode, so the prediction ends there. The scope of the prediction is represented with a vertical purple line:
The prediction is executed asynchronously, so it doesn’t affect Visual Studio performance. It’s always executed, but for convenience the predict HUD is turned off initially. To see the prediction HUD, simply click on the ‘Play’ button:
Time-Travel DataTip
The regular DataTip (and Quick-Watch) of Visual Studio will show you the value of the expression at the time of the breakpoint. Not so in Predict mode. The DataTip will show the value of the expression at the time of the evaluated line of code:
Editing the Future
You can edit your code while on a breakpoint, and the future prediction will change as you go:
This utilizes Visual Studio’s Edit and Continue feature. The result is that you can see the result of your changes live.
Time Travel Loops
With loops, displaying the future is not straightforward. Each iteration will have different values inside.
While time travel debugging, OzCode will display a small adornment near each loop. The adornment shows the number of iterations. Clicking on it will open a data-tip that shows the value of the iterated variable at each iteration:
Initially, OzCode always displays the body of the last iteration. You can switch between iterations by opening that data-tip and clicking on any iteration. When chosen, the HUD will show the values during the chosen iteration.
Note that the iterations are 1-based index.
Time Travel Conditionals
When in a loop, if/else and switch statements are usually interesting for debugging. OzCode presents visually which if statements returned True and False. The same goes for switch and case statements.
An adornment appears near each such conditional statement, showing how much iterations met the condition. Clicking on the adornment will open a data-tip, that allows to navigate to the relevant iterations.
LINQ Debugging
LINQ is awesome. It allows us to write powerful, succinct, and expressive code that’s a pleasure to read and maintain. The only problem is that using LINQ means sacrificing the debuggability of your code for its readability. If you F10 over a line of code that's using LINQ - you've just performed a whole bunch of complicated logic, but you get absolutely no insight into what actually happened. When debugging LINQ, using breakpoints and manual stepping can be a futile waste of time. OzCode's groundbreaking LINQ debugging visualizations allows you to see exactly how the different items passed through the LINQ pipeline, and see the return value of each and every lambda expression, all while leveraging powerful Ozcode tools such as Reveal and Search.
Numeric Indicator
During debugging, when the execution point (the yellow line) reaches a LINQ query, an indicator appears next to each LINQ operator, denoting how many items it produced.
These indicators show you at-a-glance how many items were consumed by each operator, and how many were produced, helping you decide which operator to focus on.
LINQ DataTip
Clicking on one of the numeric indicators puts OzCode into LINQ Debugging Mode, and opens the LINQ DataTip window which shows the items the given operator produced. You can press the "before/after" buttons in the DataTip to quickly switch between the items that were produced and the ones consumed by that operator.
Clicking on one of the items will update the Head-Up Display to reflect what each lambda returned as that particular item passed through the LINQ pipeline. Another option is to use the mouse wheel while hovering over the numeric annotation to quickly scroll through the items, seeing their values change instantly in the debugged code.
LINQ Analysis Window
The detailed analysis tool window can be opened from the DataTip window, or by clicking on the lambda icon to the left of the debugged query:
You can use Search and Reveal to find objects of interest, navigate between the LINQ pipeline using the operator breadcrumbs, and take advantage of the animation to visualize the flow of the LINQ query:
Understanding Exceptions in LINQ queries
One of the hardest bugs to tackle is when an exception is thrown from deep within a complicated LINQ query - this is almost impossible to debug. Ozcode will warn you about such an exception before it is even thrown by highlighting the LINQ Numeric Indicator in red, letting you drill down using the LINQ DataTip or LINQ Analysis Window to find out exactly which item caused that exception!
Fluent and Query Syntax Support
When using LINQ to query, filter and transform collections, a developer has a choice between two flavors - the lambda-based fluent API, or the SQL-like query expressions.
The choice of which syntax to use depends on personal preference, as well as the nature of the problem. The fluent syntax is more terse, and tends to be preferable when the query is simple. However, some more complicated queries are much more easily expressed with the query syntax, which allows you to leverage the 'let' keyword and multiple from
clauses to work with complicated data.
Ozcode fully supports both flavors of LINQ. When you use the query syntax, OzCode will visually highlight which items came from which from
clause, what values were calculated by the let
expression for each item, and more!
Export
Export allows you to save a textual representation of an object instance to a file or to the clipboard, to be used after the debugging session has ended.
With Export, a developer can "grab" objects and save them as either JSON, XML or even as a C# code that can be used to create Unit Tests with the values of the last debug run.
Once the exported instance is saved (or copied to the clipboard), it can be used to reproduce the instance state, analyzed or compared using external diff tools.
For the JSON output, Ozcode uses the industry-standard Newtonsoft Json.NET serializer, which makes it super easy to deserialize and work with the result.
Head-Up Display
Investigate
Debugging complex expressions is never easy. How do you see what was returned by a method call? What did each boolean condition evaluate to in a long convoluted if statement? Without simplifying the code or adding variables to store individual results, answering these questions is difficult. With Ozcode’s powerful “Simplify” visualization, you can instantly figure out exactly what is happening in your code! When stepping over an expression, a red/green color coding will tell you exactly which expressions returned false/true, respectively. The red or green indicate the result of the entire expression.
Simply click the Simplify button and the expression will be visualized instantly, giving you the option to drill down and see individual expression results.
Explore History
The nicest thing about Simplify is that you can see a historical view of your code’s execution. Each time you Step Over (F10) a line of code, a new Simplify button will appear, allowing you to look into the past! No longer will you have to restart debugging if you’ve Stepped Over too far!
Simplify Time Travel Keyboard Shortcuts
If you’re a keyboard person, we’ve made some useful shortcuts for you to time travel without lifting your palms: Hit + to visualize the current line and then use + to visualize the current line or + to navigate between the different lines of code.You can also hold down the key while debugging and then tap a digit - to directly pick the statement to visualize.
Magic Glance
The Magic Glance, which can be toggled by clicking the Toolbar icon (or by pressing the + + shortcut), gives you amazing insight into your code by showing you a summary of each line of code you stepped through.
Breakpoints
Conditional Breakpoints
Conditional Breakpoints can make debugging so much more productive, but without Ozcode, using them feels like a chore. Ozcode makes adding a Conditional Breakpoint super easy! In just a single click, OzCode will set up a Conditional Breakpoint based on a specific property value, and pre-fill the predicate for you.
Want to add more predicates to the breakpoint? Take a shortcut! Simply hover over the relevant variable, and click the “Add Condition” button.
When Set... Break
The toughest bugs to figure out are those that involve mutating state. What do you do if at some point during the program’s execution, the state of some objects becomes invalid, but you have no idea exactly when and where it got that way? While inspecting values in the debugger, when you spot a problematic property value, use the Magic Wand and choose “When Set -> Break”. The next time the property value is changed, Ozcode will break into the debugger and allow you to inspect the state of the program and figure exactly how that problematic value got there in the first place! These Setter Breakpoints work on both regular properties and auto-properties, and you can even add a Setter Breakpoint on properties you don’t have the source code to!
Exceptions
Exceptions Trail
Without OzCode, investigating an exception is a dreary task - navigating through a trail of inner exceptions, scrolling through lengthy callstacks, and squinting through the exception’s associated data to try to make sense of the error. With Ozcode, all the relevant information about the exception is presented in a handy tool-window. You can navigate through each inner-exception with a super- convenient breadcrumb control, and even launch a Google or stackoverflow search right from within Visual Studio!
Predicting Exceptions
Ozcode’s Predict will alert you of an exception that’s about to happen. But that’s not all – if, for instance, Ozcode detects an imminent NullReferenceException, you’ll see a red highlight showing exactly what expression is going to cause the exception!
Ozcode’s predictive exception analysis makes it super-easy to fix an exception before it even happens, with the powerful of Edit & Continue!
Trace
When you’re debugging a tough problem, especially in debugging legacy code or a heavily multi-threaded scenario, stepping through the code to figure out what the system is doing feels like trying to juggle 12 balls in your head at once. With Ozcode, when things get hairy, you can easily add dynamic logging on-the-fly at key points during the program’s execution, and then view the output using the fully featured integrated log-viewer that Ozcode bakes into Visual Studio. No longer do you need to stop debugging, add logging code and then rebuild each time you want to add a simple trace!
Simply use the “Create Tracepoint” command on the value you want to trace. A Tracepoint is just like a Breakpoint, except that instead of breaking the program’s execution, it writes a trace message.
Then, add whatever bits of information you think might be related to the bug with the “Add To Tracepoint” button:
Finally, watch the trace messages come into the Tracepoints Viewer:
Quick Attach
In many projects you can’t start a debugging session by just hitting F5. Instead, you have to use the “Attach to Process” option, find the correct process in the long list of processes, and finally connect to it. Later on, when you restart your debugging session, you have to do it all over again. And again. And again.
With QuickAttach, OzCode makes the routine of attaching to a process super-fast. The QuickAttach window shows you the list of processes you attached to most recently. By clicking the Pin button, you can attach a shortcut key to that process:
And that’s it. From now on, whenever we want to attach to ‘w3wp.exe’, we’ll just hit + + , and that’s it
If the process you want to attach to is not in the “Recently Attached” list, you can always search for it, and even see a preview of what its UI looks like:
Search
When debugging objects and collections, you are often looking for a specific property or field, or a value held within a property or field. Unfortunately, this usually involves either a lot of clicking and scrolling, or writing custom debug-specific code. Finding items even in simple structures is not easy, not to mention doing so in a complex object graph. With our “Search” feature, this is no longer the case. Quickly and effortlessly search member names and values, no matter the size of the collection or complexity of the object graph!
Compare
When you want to compare files, you use a diff application to spot the differences. Unfortunately, when you need to compare two (or more) objects, you have to trust your eyes and memory. With our Compare feature, you can now spend less time squinting, and let Ozcode Compare objects and collections with a simple click! The results are displayed in a side-by-side view that helps you investigate the differences and the similarities between the two objects.
Once an object is selected for comparison, Ozcode will highlight all other local variables and fields that are comparable to the selected instance (meaning they are the same type or derive from the same type).
Compare items in a collection
What if you need to spot the difference between two or more items in the same collection? Ozcode's Compare makes comparing multiple items simple and fast. Comparing several items in the same collection is easy and the results are shown side by side.
Using external diff tool
When comparing two long strings - such as two XML or Json documents, Compare will automatically launch your favorite Diff tool, making it super easy to spot the difference between the two.
You can configure Compare to use either Visual Studio's native diff tool, or an external diff tool, under Ozcode->Options.
Currently supported options include Beyond Compare (v3 or v4), KDiff, WinMerge, Araxis Merge, and Tortoise.
Compare snapshots
The hardest bugs to solve are the ones that involve mysterious side effects. Consider a long and complicated method which takes an object and performs various mutations on it. Would you be able to tell what has actually changed?
For a class with many members, which might also contain a few members themselves, finding the differences is difficult. With Compare you can now save an object’s state and later compare the object, during debugging, to its original saved state. After the function executes, you can choose the Compare to Snapshot option to see the differences.
When you save a snapshot of a given object, it will now persist across debugging sessions! You can save a snapshot of an object, stop your debugging session or even close Visual Studio, and then come back the next day and compare a live object to the snapshot you had saved!
Reveal
Objects can have many properties, but when debugging, not all of them are useful to you. You’re usually interested only in a selected few. For a Customer class, it might be the ID and Username properties, for a Point in 3D space, it might be the X, Y, and Z fields. With our “Reveal” feature, you can finally focus on the data that actually matters. Star the properties you are interested in and they will appear right next to the object. If you have, for example, a collection of Customer objects and you are mostly concerned with their first and last names, simply star the FirstName and Surname properties and immediately all the objects in the collection show these properties next to them. Your choices will be persisted across debugging session and across different Visual Studio solution files.
Custom Expressions
When debugging, sometimes the information you need is not contained in the fields and properties of an object; rather, it’s a calculation or an expression that is based on your object. You might find yourself wishing you had a different set of properties just for this specific debugging session.
For example, when you’re looking at a Player object in your game, you might like to see the distance from the nearest enemy without having to add such a property to its interface.
With our Custom Expression feature, you can create multiple custom expressions on any object type, which will be displayed just like any other member of that type. You can even star the ones that interest you the most.
For example, if a Customer class has a salary history among its properties, but what you really need to see in order to fix a bug is the customer’s due taxes for a certain year, simply use the “Add Custom Expression” option on the Customer variable, and write the expression that you’d like to see. The expression will be displayed as a property of the Customer class, containing the value of the expression.
Filter Collections
Filtering a collection in code is relatively easy and there are plenty of ways to do it. But how do you filter while debugging? For example, you have a collection of Customer objects and you’d like to filter the ones that are older than 35 years. Visual Studio’s immediate window and watch windows don’t support lambdas. With our Filter Collections feature, you can apply a filter expression to any collection. To solve the customer problem, choose the collection of customers and set its filter to: DateTime.Today.Year – [obj].Birthday.Year > 35, press Enter and see the results right away. Once a collection is filtered, all the other features work on the filtered results as well.
Quick Actions
Ozcode’s Quick Actions offer you the most relevant actions, depending on your current context. Want to add a breakpoint to every method in the class? Trace every entry to a particular method? Quickly run forward to a particular line of code? Hit Alt+Shift+D to open up the Quick Actions menu or click the Magic Wand, and do some magic!
Show All Instances
Ozcode makes it trivial to find specific objects in memory that you want to explore. Just open “Show All Instances of Type” and you’ll be able to see every object of that type that’s currently in memory. Why is that object still in memory? Are there any objects that contain this value? Ozcode’s exciting new exploration tool effortlessly and instantly answers these questions and more.