Consider this code:
It's causing (at least on xamarin) the traces to be written to a newline for each character (annoying).
You must implement the Write(char value) override for PCL, so need a way to Debug.Write(...) basically.
One ugly approach would be:
#if NETFX_CORE || PORTABLE
StringBuilder buffer = new StringBuilder();
public override void Write(char value)
if (buffer.ToString ().EndsWith (NewLine))
WriteLine (buffer.ToString ().Trim ());
Probably a better way...
@halter73 Giving this one to you.
@gustavo-armenta Can you reproduce this?
Made changes to DebugTraceWriter for portable
@Redth which window in Xamarin do you see the traces from the default DebugWriter? Also, I am assuming the problem you mentioned is to do with the traces that we output?
@abnanda1 in the Application Output window (on Xamarin.Android, at least)... Yes, I'm speaking about the traces that SignalR outputs... It looks like the pull request #2396 which @abnanda1 provided would solve this, according to my findings while debugging. It's similar to the approach I had proposed...
@Redth can you verify the fix?
@davidfowl confirmed, the trace now outputs correctly for portable (including Xamarin.Android).
@Redth that's great. I have a quick question - how exactly are you setting-up our DebugWriter to output to Application Output. For our other clients we modify the App.config to set that up but there isn't anything like that in Android and iOS clients. I also noticed that TextWriterTraceListener and DefaultTraceListener are not supported in portable or mono so you can't add the listeners programmatically.
@abnanda1 I'm not doing anything at all, it just happens as is by default...
@Redth that's interesting - I am not seeing the logs in the Application Output with our sample iOS app. Can you put-up a zip file containing your sample - I want to verify the thing once at our end as well.
@abnanda1 I was completely forgetting the fact that I'm running this using the JabbR.Client library. I'm guessing that it sets up the TraceWriter... Not too familiar with the internals of that, but sorry for leaving that out.
@abnanda1 why is this marked as blocked? @Redth verified the fix.
Marking this as done. @gustavo-armenta, @Redth verified that the fix worked.
tested using DebugTextWriter directly in a WinStore app