Reputation: 6625
I'm developing a Cortana App (Windows App C#) and I'm using the following commands to print debug information:
System.Diagnostics.Debug.WriteLine("voiceCommandName: " + voiceCommandName);
System.Diagnostics.Debug.WriteLine("textSpoken: " + textSpoken);
My question is: where should I look for these texts/debug output when I use cortana to launch my app?
Upvotes: 4
Views: 186
Reputation: 824
The trace listener is a possibility, but you can also configure Visual Studio to wait for your app to start and attach to it automatically:
VS will build, deploy, and then wait. When you use Cortana to activate your application, VS will automatically connect to your code, and can break in immediately for breakpoints, or capture output sent to the debug output, etc.
This also works for code running as part of Cortana's background task. Cortana's set up to notice if a debugger is attached and won't time out your tasks prematurely, too.
Upvotes: 2
Reputation: 419
Usually one needs to configure a trace listener in the app config file in order to get the trace/debug output. Doesn't this work when you use cortana? Try to configure a file as trace listener - TextWriterTraceListener.
https://msdn.microsoft.com/en-us/library/system.diagnostics.textwritertracelistener(v=vs.110).aspx
To add a trace listener, edit the configuration file that corresponds to the name of your application. Within this file, you can add a listener, set its type and set its parameter, remove a listener, or clear all the listeners previously set by the application. The configuration file should be formatted like the following example.
<configuration>
<system.diagnostics>
<trace autoflush="false" indentsize="4">
<listeners>
<add name="myListener"
type="System.Diagnostics.TextWriterTraceListener"
initializeData="TextWriterOutput.log" />
<remove name="Default" />
</listeners>
</trace>
</system.diagnostics>
</configuration>
Upvotes: 3