DCSIMG
Debug - IHateSpaghetti {code}

IHateSpaghetti {code}

VSX, DSL and Beyond by Eyal Lantzman

Syndication

Coding / Architecture

Extensibility /DSL

Projects

Articles

Browse by Tags

All Tags » Debug (RSS)
System.Net traces
Found this useful post you might want to know how to add tracing information for System.Net namespace: <configuration>     <system.diagnostics>         <trace autoflush="true" />                 <sources>                 <source name="System.Net">                        ...

Posted by Eyal | with no comments

GDI vs GDI+ text rendering and measuring
I was investigate a GDI/GDI+ related bug the other day and I found out that GDI+ doesn’t render RTL text very well. In order to render it correctly you need to render it using GDI. GDI+ Text rendering This is done by Graphics.DrawString(…) / Graphics.MeasureString(..) GDI Text rendering This is done by TextRenderer.DrawText(..) / TextRenderer.MeasureText(…) The interesting thing about GDI text measuring is that it sometimes the measured size might be larger than the maximum size so be aware of that...

Posted by Eyal | with no comments

Handling Corrupted State Exceptions is not supported by default by CLR 4.0
In the February MSDN Magazine there's a very interesting article about CSE and what is changed in CLR 4.0. It seems that the code below would wrap corrupted state exceptions thrown by the OS (such as Access Violation) and thus leaving the application non stable state when you not fixing the CSE. 1: public void SomeFunction() 2: { 3: try 4: { 5: //Do something 6: } 7: catch (Exception ex) 8: { 9: throw WrapException(ex); 10: } 11: } So they CLR guys made some changes and thus no more CSE exception...

Posted by Eyal | 2 comment(s)

Code Contracts
In .NET 4.0 there's a new addition – System.Diagnostics.Contracts AKA Code contracts   Code Contracts provide a language-agnostic way to express coding assumptions in .NET programs. The contracts take the form of pre-conditions, post-conditions, and object invariants. Contracts act as checked documentation of your external and internal APIs. The contracts are used to improve testing via runtime checking, enable static contract verification, and documentation generation. Code Contracts bring...

Posted by Eyal | with no comments

Azure storage viewer
If your playing with Azure you will probably wondering "how can I see whats currently in the storage?" When at this point Azure storage viewer comes to the rescue... Check out this post for more info.

Posted by Eyal | 1 comment(s)

Debugging in MSBuild
There's a nice switch in MSBuild : /verbosity: level The available verbosity levels are q[uiet] , m[inimal] , n[ormal] , d[etailed] , and diag[nostic] . /v is also acceptable. For example: msbuild /v:diag This way there's a lot of extra info that is generated for you and hopefully should help your debugging. However there's another way - you can create a task that will just output the stuff you wan't to debug. I used it when I had to check why our custom code analysis wasn't working...

Posted by Eyal | with no comments

תגים:, ,

.Net Deadlock Detector - cool tool for your toolkit
I found a great tool that detects deadlocks using debugging tools for windows very interesting approach! The tool does not require to have the code re-compiled in any way or form, with any external dependencies, nor reference any external library or have you modify your code to use any special type of locks inside your code It works on release builds with no PDB files It works on running processes or previously captured memory dumps It detects deadlocks across multiple threads and returns detailed...

Posted by Eyal | with no comments

AOP - Aspect-oriented programming
AOP in supposed to aid programmers in the separation of concerns, specifically cross-cutting concerns . The base class behavior is modified by aspect class that applies advice (additional behavior) at various join points (points in the base class) based on query or quantification called pointcut . To be more specific it allows a simple class ( POCO ) to have additional behavior that can be added declarative (not in the base class but in some external definition - from software engineering perspectives...

Posted by Eyal | 3 comment(s)

PUnit – Parallel unit testing in making
Unit testing nowadays focuses on simple units that (hopefully), when tested together, will make your code (if done thoroughly) more robust, clean and basically better. How every all of this doesn't guaranteed in multi thread environment. Locks, unsynchronized behavior, and general unexplained behavior is common when dealing with multi threaded environment. Specially since PLinq and the multiple core availability those problems will acute further. So I though of a testing framework that will enable...

Posted by Eyal | 7 comment(s)

Losing sessions? AppDomain restarts? Here's the solution
Some web developers don't aware that some anti viruses by scanning the web.config file (or other asp.net watched files) initiates AppDomain restarts and as a result the performance problems (cache is reset as well, naturally), various crashes and "unexplained" behavior. The solution is simple – exclude asp.net hosted directory from the AV scans, however in order to detect this issue or analyze the severity and recurrence of the problem you'll need to write some very neat code –...

Posted by Eyal | 1 comment(s)

Debugging with .NET Source Code, Step by Step
I needed a "deep debug" (including the managed code) and found a great step by step guide by Shawn Bruke about the way to achieve this. Here is the guide .

Posted by Eyal | with no comments