CInject adds more value to your existing applications by injecting runtime intelligence. You can use injectors provided by with CInject, or define your own injector.
This article will highlight some cases where you can directly use CInject
Existing application has no or very little logging
Your application is a 3-tier application and is designed using Dependency Injection and Inversion of Control patterns. Application switches the flow control too frequently and has no logging.
Use LogInjector to inject logs in your application. When you execute the application, LogInjector will create application logs of when a method was invoked and when it was completed. You can also customize or build your own LogInjector by implementing ICInject interface.
OnInvoke method provides you a lot of information such as,
- Executing method and its properties and signature - Complete reflection object is provided to OnInvoke method
- Arguments passed to the injected method - You can use this to debug what was passed to the method. If the argument is an object (not native type), you can use ObjectSearch to find out any value of any property
- Executing assembly - Useful if you want to load assembly later or want to perform some additional tasks on the assembly
Application is performing slower than I expected
Your application is performing slower than you expected and would want to find out which method is taking the most time. However, all third-party tools are paid and expensive.
 INFO Sleep executed in 1201.8618 mSec  INFO Add executed in 1438.8754 mSec  INFO Subtract executed in 0 mSec  INFO GetName executed in 0 mSec  INFO GetTypeName executed in 0 mSec  INFO GetTypeName executed in 0 mSec  INFO Sleep executed in 1200.0686 mSec  INFO GetRefValue executed in 1200.0686 mSec  INFO GetOutValue executed in 0 mSec  INFO Create executed in 0 mSec  INFO GetArrayCount executed in 0 mSec  INFO AddOptional executed in 0 mSec  INFO AddOptional executed in 0 mSec  INFO DelegateCalled executed in 0 mSec  INFO CallDelegate executed in 1.0001 mSec
Don't know what gets passed as arguments to few methods
Method btnChangeValue_Click Argument #0 :Text= Print the Value in label Method btnChangeValue_Click Argument #0 :Name= btnChangeValue Method ChangeValue Argument #0 :Text= a Method ChangeValue Argument #0 :Name= txtInputValue