Bug Fixing is one of the major tasks in Software Development Lifecycle. At testing stage, responsibility of the software developer is not only to fix bugs, but also to do the proper documentation for the fixes. Companies will purchase any popular Defect Tracking Products available in the market to manage Entering, Fixing and Reviewing of the defects. The testers will record the defects found by them, into those Defect Tracking Systems and the developers will fix it and update the Defect Tracking Database with ample Fix details. There are lots of benefits through using a Defect Tracking System. One important factor is that we can implement certain workflow into the system. Also, the bugs can be listed in a specific-centralized place that can be accessed by any members in the project team, and the defects taken care of.
But, think about tracking a bug in a later stage? Consider a situation that, your team had developed an application, tested it, fixed defects reported, and finally released to the customer. What will you do in a later stage, when any of the bugs fixed were not in the right way or created some troubles. The history of the fixed bugs can be taken from the Defect Tracking System but it will give you difficulty in searching those issues in the Source Code or you have to take the history of the check-ins of the source codes from the Source Control System to trace or track the problems. This will make it more time consuming and may give more troubles if you are in a hurry to detach the issues.
How will it be useful for you if you are able to find the bug descriptions within the delivered binary files? I hope it will make your work easier to track the bug fixes you have done in the earlier period, in the delivered binary files.
A solution to track bugs in binary files
Here is a solution to track such bugs within the assembly files, of a project that is developed using C#. Normally for the bug fixes, we will add comments in the code regarding the fix done for that. Instead of giving comments or in addition to giving comments, you can exercise a specific methodology for bug fixes, to quick-track at a later stage in the binary files.
Microsoft .NET provides two functionalities in C# – Attributes and Reflection.
Attributes provide a powerful method to associate declarative information with C# code (types, methods, properties, and so forth). Once associated with a program entity, the attribute can be queried at run time and used in any number of ways.
Reflection is runtime type discovery. That is, using reflection services you are able to load an assembly at runtime and find the classes, methods, properties etc. In addition to finding the types in the assembly, you can also dynamically invoke (late binding) those types.
If you are a beginner to C#, please have an idea about attributes and reflection in C#, before going through the applications provided with this article.
Overview of the applications
Download the application from the link provided.
The download will contain 3 projects:
- Solution1 – BugFixAttribute: A Class Library application, which defines the
BugFixAttribute. This solution contains a class
BugFixAttribute, which is inherited from
Attribute. The attribute contains members
FixDescription. Using properties the values of these members are exposed.
- Solution2 – TrackBugChanges: A Windows Application, to display the bug details (as attributes) available in a C# assembly file. In this application, you have to give an assembly name (for example, the executable file of Solution3). This application will explore the binary and will show all the bug fixes done on that assembly with class name and method name.
- Solution3 – DoBugFix: A sample console application, that has bug fix attributes implemented in it. This application will give you an idea about how to use the
In Solution2 and Solution3, the Class Library
BugFixAttribute is referred.
Since it is a small application provided with this article, there is no need of explanation of code here. Required comments are added into the class files accordingly.