C# WinRT'的调试;s的后台网络
我做了一个项目,使用tcp套接字连接(自己的封闭协议),添加了网络触发API的后台连接,如所述(从第17页开始)-StreamSocket控制通道注册块,以及IBackgroundTask类,每次套接字接收到某个内容时都应该触发该类 已尝试在后台任务中调试代码,但没有任何用处:C# WinRT'的调试;s的后台网络,c#,debugging,sockets,background,windows-runtime,C#,Debugging,Sockets,Background,Windows Runtime,我做了一个项目,使用tcp套接字连接(自己的封闭协议),添加了网络触发API的后台连接,如所述(从第17页开始)-StreamSocket控制通道注册块,以及IBackgroundTask类,每次套接字接收到某个内容时都应该触发该类 已尝试在后台任务中调试代码,但没有任何用处: 用手势关闭可视应用程序 锁定屏幕 试图加载其他一些繁重的应用程序,以使windows挂起我的应用程序 所有这些都没有帮助我在套接字消息期间运行(和调试)后台任务。我做错了什么?我是否必须使用单独的可挂起设备(如Win
- 用手势关闭可视应用程序
- 锁定屏幕
- 试图加载其他一些繁重的应用程序,以使windows挂起我的应用程序
所有这些都没有帮助我在套接字消息期间运行(和调试)后台任务。我做错了什么?我是否必须使用单独的可挂起设备(如WinRT平板电脑)才能正常工作?默认情况下,引用的项目不会添加到主项目中。这并不像看上去的那么明显,这就是为什么我花了将近一周的时间来发现这一点。所以线索是:检查参考项目的可访问性 Upd: 正如我在开发过程中发现的,还有一些事情要处理。其中一些问题没有必要那么清楚。以下是我所做工作的清单:
ps-如果项目被挂起,请注意调用UI线程(尤其是等待的东西)-它们在应用程序运行之前不会运行,并将等待。默认情况下,引用的项目不会添加到主项目中。这并不像看上去的那么明显,这就是为什么我花了将近一周的时间来发现这一点。所以线索是:检查参考项目的可访问性 Upd: 正如我在开发过程中发现的,还有一些事情要处理。其中一些问题没有必要那么清楚。以下是我所做工作的清单:
ps-如果项目被暂停,请注意调用UI线程(尤其是等待的东西)-在应用程序运行之前,它们不会运行,并且会等待。请详细说明如何“检查参考项目的可访问性”?因为我现在也有同样的问题。你能详细说明一下如何“检查参考项目的可访问性”吗?因为我现在也有同样的问题。
// IMPORTANT: When using winRT based transports such as StreamWebSocket with the ControlChannelTrigger,
// we have to use the raw async pattern for handling reads instead of the await model.
// Using the raw async pattern allows Windows to synchronize the PushNotification task's
// IBackgroundTask::Run method with the return of the receive completion callback.
// The Run method is invoked after the completion callback returns. This ensures that the app has
// received the data/errors before the Run method is invoked.
// It is important to note that the app has to post another read before it returns control from the completion callback.
// It is also important to note that the DataReader is not directly used with the
// StreamWebSocket transport since that breaks the synchronization described above.
// It is not supported to use DataReader's LoadAsync method directly on top of the transport. Instead,
// the IBuffer returned by the transport's ReadAsync method can be later passed to DataReader::FromBuffer()
// for further processing.