What is the performance impact of tracing in C# and ASP.NET?

Yes it will have a performance impact whenever the TRACE conditional compilation constant is defined during build. Doing anything has some type of impact :)

As to whether or not this has a significant impact on an application. It's highly unlikely that it would as Trace is designed to be run and is run in many production applications. Only an abuse of the feature should lead to a noticable performance difference.

But as always, don't trust me, trust the profiler.

I don't have the reputation points for comments yet but I wanted to make a quick statement about Jonathan's answer. The numbers I have seen seem to show that it doesn't make sense to use stringbuilder for just a handful of string concatenations. The overhead of creating the stringbuilder object outweighs the concatenation speed benefit.

Trace messages can go to a lot of different places. You can add (or remove) TraceListeners for the Console, VisualStudio debug Window, Files, or the Event Log to name a few. You can even build your own.

Also, you can configure Trace to not do anything when compiled for Release.

Thus, the performance impact of using Trace can vary wildly, all the way from zero to completely bogging down your app, depending on what listeners are active. Most listeners, though, have about the impact you'd expect. It takes about so much work to write to a file, or database, or the console, and Trace doesn't add that much overhead relative to those I/O-bound activities.

Performance impact aside, though, I'm staring in absolute horror at the idea of tracing password values. That's something you definitely must NOT do.