Debug.writeline无法在WinCE 6 .NET 3.5上通过调试UART工作 [英] Debug.writeline not working through debug UART on WinCE 6 .NET 3.5

查看:92
本文介绍了Debug.writeline无法在WinCE 6 .NET 3.5上通过调试UART工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在Windows CE 6下,R3刚刚将我的C#应用​​程序从.NET 2.0升级到.NET 3.5。 这是一个没有GUI的Windows应用程序。 在.NET 2.0下,debug.writeline()会将文本转储到设备的调试UART,没有任何问题。 在.NET 3.5下,UART上没有任何内容。 使用console.writeline()会在设备的屏幕上生成一个控制台,但这不是所需的效果。 试图弄清楚如何保留旧功能。

Under Windows CE 6, R3, have just upgraded my C# application from .NET 2.0 to .NET 3.5.  This is a windows application with no GUI.  Under .NET 2.0, debug.writeline() would dump text to the devices's debug UART with no problem.  Under .NET 3.5, there is nothing that is seen over the UART.  Using console.writeline() spawns a console on the device's screen, but this is not the desired effect.  Trying to figure out how to keep the old functionality.

在项目属性中定义了DEBUG和TRACE。 只有在线帮助,我才能找到有关转储到文件控制台的说明。 我也不想,但系统的UART。 这可能是我需要改变的非常简单的事情,但已经花了大约一天的时间来寻找。 非常感谢任何建议。 谢谢,

Have DEBUG and TRACE defined in the project properties.  Only online help I can find talks about dumping to the console of file.  I don't want either, but the system's UART.  There is probably something really simple that I need to change, but have spent about a day already looking.  Any suggestions are greatly appreciated.  Thanks,

尼克

推荐答案

嗨尼克

我在基于CE 6.0 R2的设备上看到的相同。

为了解决这个问题,我编写了自己的TraceListener,写入调试串行端口。简约实现可能如下所示:

I'm seeing the same on my CE 6.0 R2 based devices.
To solve this, I wrote my own TraceListener that writes to the Debug Serial Port. The milimalistic implementation may look like this:

public class MyTraceListener: DefaultTraceListener
{
	[DllImport ("coredll.dll")]
	private static extern void OutputDebugString (string message);
		
	public override void Write (string message)
	{		
		OutputDebugString (message);
	}
}

在应用程序启动时,注册跟踪侦听器:

At application start, register the trace listener:

Debug.Listeners.Add (new MyTraceListener ());



Michael

Michael

 


这篇关于Debug.writeline无法在WinCE 6 .NET 3.5上通过调试UART工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆