If tracing is enabled and DefaultHttpControllerSelector.GetControllerMapping() is called before the first request has been processed, the MessageHandler pipeline will be corrupted.
The TraceManager.Initialize() code is idempotent for MessageHandlers only after the pipeline has been initialized at the first request. If called before the pipeline has been initialized, it will redundantly wrap MessageHandlerTracer's around other MessageHandlerTracers.
The net result of this is a corrupt pipeline of MessageHandlers that will cause stack overflow at first request.
The TraceManager.Initialize() needs to protect itself when it finds MessageHandlerTracer's already installed in HttpConfiguration.MessageHandlers
Comments: TraceManager.Initialize() is made idempotent even before the pipeline is initialized. https://aspnetwebstack.codeplex.com/SourceControl/changeset/556493386c463f0e831298c65784e545b89ff287
The TraceManager.Initialize() code is idempotent for MessageHandlers only after the pipeline has been initialized at the first request. If called before the pipeline has been initialized, it will redundantly wrap MessageHandlerTracer's around other MessageHandlerTracers.
The net result of this is a corrupt pipeline of MessageHandlers that will cause stack overflow at first request.
The TraceManager.Initialize() needs to protect itself when it finds MessageHandlerTracer's already installed in HttpConfiguration.MessageHandlers
Comments: TraceManager.Initialize() is made idempotent even before the pipeline is initialized. https://aspnetwebstack.codeplex.com/SourceControl/changeset/556493386c463f0e831298c65784e545b89ff287