Made changes to DebugTraceWriter for portable

#2321
Made changes as per code review feedback

#2396