Fixes U4-2354 MiniProfiler - Show SQL parameter values and more stacktrace info

Refactored duplicate code