Examining the Injected Attribute Code

Although using attributes has many advantages, there is a major disadvantage. Because attributes inject source code into your application during the build process, there may be a time when you need to examine the injected code to see what is going on and possibly even debug into it. Fortunately, Visual Studio .NET gives you two ways to do this.

The first and easiest way to inspect the final source code is to enable the /Fx compiler switch. Using the Solution Explorer, right-click the ATLAttributes project and select Properties. Under the Configuration Properties item on the left, select C/C++, Output Files. Change the Expand Attributed Source setting on the right side from No to Yes /Fx and close the dialog ...

Get Sams Teach Yourself Visual C++® .NET in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.