使用.NET Native工具链编译的[UWP]应用程序与蓝牙LE通信的行为不同
您好!
我们正在开发一个UWP应用程序以上传到Windows应用商店。我们与能够进行USB或蓝牙通信的设备进行通信,并且我们正在实施一项功能,允许用户在过期时更新固件。
We're developing a UWP app to upload to the Windows Store. We communicate with a device that's capable of both USB or Bluetooth communications, and we're implementing a feature that allows users to update their firmware if it is out of date.
在调试期间,所有内容工作得很好。但是,在编译.NET Native工具链时,蓝牙LE通信的行为略有不同。我的猜测是通过蓝牙传输消息时延迟增加。我花了几个小时通过代码查找
来尝试解决任何问题,然后尝试尽可能多地复制调试版本以使其工作。我取消选中"优化代码",没有效果。最后,它取消选中"使用.NET Native工具链编译"。使用它的Build选项中的
。其他一切都是相同的(除了"定义DEBUG常数"),所以罪魁祸首在于这个主要区别。
During debug, everything worked perfectly. However, when compiling for the .NET Native tool chain, Bluetooth LE communications behave slightly differently. My guess is there's increased lag when transmitting messages over Bluetooth. I spent hours looking through code to try to fix any issues, then tried to replicate the debug build as much as possible in order to get it to work. I unchecked "Optimize code," which had no effect. Then finally, it was unchecking "Compile with .NET Native tool chain" in the Build options that got it to work. Everything else was the same (except "Define DEBUG constant"), so the culprit lies within this major difference.
是否有任何蓝牙库中的依赖程序集在使用.NET Native工具链进行编译时会以某种方式进行优化?是否可以在不编译.NET Native工具链的情况下提交我们的应用程序?
Would there be any dependent assemblies in the Bluetooth libraries that somehow get optimized out during compilation with the .NET Native tool chain? Would it be possible to submit our application without compiling for the .NET Native tool chain?
嗨 tyoung17,
Hi tyoung17,
>>是否可以在不编译.NET Native工具链的情况下提交我们的应用程序?
>>Would it be possible to submit our application without compiling for the .NET Native tool chain?
不,如果要将应用程序提交到商店,则需要为.NET Native工具链编译应用程序。对于Windows 10的Windows应用程序,您将应用程序包(.appx文件)中的.NET本机代码编译二进制文件上载到Windows应用商店。请参阅 在
打包之前应用 部分 检查.NET原生兼容性(适用于VB和C#应用)。
No, the app needs to be compiled for .NET Native tool chain if you want to submit it to the store. For Windows apps for Windows 10, you upload .NET Native Code Compilation binaries in app packages (.appx files) to the Windows Store. See the Before packaging your app part that Check .NET Native compatibility (for VB and C# apps).
此外,本地原生编译通过"释放"配置将使您能够在与客户体验类似的环境中测试您的应用程序。
在进行开发时定期测试这一点非常重要。请参阅博客: .NET
Native - 对于通用Windows平台(UWP)开发人员意味着什么。
Besides, local native compilation via the "Release" configuration will enable testing your application in an environment that is similar to what your customers will experience. It is important to test this on a regular basis as you proceed with development. See the blog: .NET Native – What it means for Universal Windows Platform (UWP) developers.
对于您的这个问题使用.NET Native工具链编译的行为与蓝牙LE通信的行为不同,你能给我们更多关于它的细节或给我们一些代码来帮助我们重现它吗?
For your this issue that compiled with .NET Native tool chain behaves differently with Bluetooth LE communications, could you give us more details about it or give us some code to help us reproduce it?
蓝牙WinRT库已经是原生的。 编译.Net native不会影响它们。差异在应用程序代码中的某处,而不是蓝牙库。
The Bluetooth WinRT libraries are already native. Compiling .Net native won't affect them. The difference is somewhere in the app code not the Bluetooth library.
此外,h ere是公共论坛,如果你有一些私密的代码,你不能提供给我们或你的这个问题更紧急,你可以 使用
你的开发者帐户通过访问 此处 。
您将获得1:1的支持。请注意,如果是微软的问题,您的支持票将是免费的。
Besides, here is the public forum, if you have some code that is private and you can not provide to us or your this issue is more urgent, you can use your developer account to open a support case by visiting here. You will get 1:1 support on that. Please kindly note that your support ticket will be free if it is Microsoft's issue.
最好的问候,
Breeze