<legend id='csqtY'><style id='csqtY'><dir id='csqtY'><q id='csqtY'></q></dir></style></legend>
  1. <i id='csqtY'><tr id='csqtY'><dt id='csqtY'><q id='csqtY'><span id='csqtY'><b id='csqtY'><form id='csqtY'><ins id='csqtY'></ins><ul id='csqtY'></ul><sub id='csqtY'></sub></form><legend id='csqtY'></legend><bdo id='csqtY'><pre id='csqtY'><center id='csqtY'></center></pre></bdo></b><th id='csqtY'></th></span></q></dt></tr></i><div id='csqtY'><tfoot id='csqtY'></tfoot><dl id='csqtY'><fieldset id='csqtY'></fieldset></dl></div>

      <tfoot id='csqtY'></tfoot>

    1. <small id='csqtY'></small><noframes id='csqtY'>

        <bdo id='csqtY'></bdo><ul id='csqtY'></ul>

      FromBluetoothAddressAsync 永远不会在 WPF 应用程序中的 Windows 10 Creato

      时间:2023-09-15
    2. <legend id='3TRDj'><style id='3TRDj'><dir id='3TRDj'><q id='3TRDj'></q></dir></style></legend>
    3. <tfoot id='3TRDj'></tfoot>

            <small id='3TRDj'></small><noframes id='3TRDj'>

              <tbody id='3TRDj'></tbody>
          1. <i id='3TRDj'><tr id='3TRDj'><dt id='3TRDj'><q id='3TRDj'><span id='3TRDj'><b id='3TRDj'><form id='3TRDj'><ins id='3TRDj'></ins><ul id='3TRDj'></ul><sub id='3TRDj'></sub></form><legend id='3TRDj'></legend><bdo id='3TRDj'><pre id='3TRDj'><center id='3TRDj'></center></pre></bdo></b><th id='3TRDj'></th></span></q></dt></tr></i><div id='3TRDj'><tfoot id='3TRDj'></tfoot><dl id='3TRDj'><fieldset id='3TRDj'></fieldset></dl></div>
                <bdo id='3TRDj'></bdo><ul id='3TRDj'></ul>
                本文介绍了FromBluetoothAddressAsync 永远不会在 WPF 应用程序中的 Windows 10 Creators Update 上返回的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                问题描述

                我升级到 Windows 10 版本 1703 build 15063 (Creators Update) 正式版.当我在 WPF 桌面应用程序中运行以下代码时,BluetoothLEDevice.FromBluetoothAddressAsync 永远不会返回.

                I upgraded to Windows 10, version 1703 build 15063 (Creators Update) official release. When I run the following code in a WPF desktop application, BluetoothLEDevice.FromBluetoothAddressAsync never returns.

                此代码在我的 Windows 10 更新之前运行良好(即之前的 1607 build 14393).如果在新的 Win 10 1703 中作为 UWP 运行,此代码也可以正常工作.

                This code worked on fine before my Windows 10 update (i.e. the previous 1607 build 14393). This code also works fine if it is running as a UWP in the new Win 10 1703.

                BluetoothLEAdvertisementWatcher BleWatcher = null;
                
                private void Button_Click(object sender, RoutedEventArgs e)
                {
                     BleWatcher = new BluetoothLEAdvertisementWatcher
                     {
                          ScanningMode = BluetoothLEScanningMode.Active
                     };
                     BleWatcher.Received += Watcher_Received;
                     BleWatcher.Start();
                }
                
                private async void Watcher_Received(BluetoothLEAdvertisementWatcher sender, 
                                                    BluetoothLEAdvertisementReceivedEventArgs args)
                {
                         var device = await BluetoothLEDevice.FromBluetoothAddressAsync(args.BluetoothAddress);
                         // never continues beyond this point above with my BTLE devices that previously worked 
                }
                

                我按照此处的说明 https://stackoverflow.com/a/37335251/3187714 设置了我的 WPF 桌面应用程序使用 UWP API.

                I followed the instructions here https://stackoverflow.com/a/37335251/3187714 to setup my WPF desktop app to use the UWP APIs.

                问题更严重,因为当客户开始升级到 Win 10 1703 时,我现有的 WPF 应用程序将被破坏,因为我现有的 exe 不再工作.

                The problem is even worse because my existing WPF application will be broken when customers start upgrading to Win 10 1703 because my existing exe no longer works.

                是否有其他人在(非 UWP)桌面 exe 中使用 Windows 10 1703 更新遇到此问题?

                Is anyone else experiencing this problem with the Windows 10 1703 update in a (Non UWP) desktop exe?

                经过进一步的实验,我确实发现如果我在 FromBluetoothAddressAsync 调用中添加了可选的 BluetoothAddressType.Public 2nd 参数,则函数返回,但返回的设备为 null.

                After further experiments, I did find if I added the optional BluetoothAddressType.Public 2nd argument to the FromBluetoothAddressAsync call, the function returned, but the device returned was null.

                var device = await BluetoothLEDevice.FromBluetoothAddressAsync(args.BluetoothAddress, BluetoothAddressType.Public);
                

                推荐答案

                看起来 15063 中围绕蓝牙 API 的安全功能中存在一个错误,导致此问题(我也看到了同样的情况).看看这个帖子:

                It looks like there's a bug in the Security functions around the Bluetooth APIs in 15063 that's causing this (I'm seeing the same thing). Check out this thread:

                https://social.msdn.microsoft.com/Forums/en-US/58da3fdb-a0e1-4161-8af3-778b6839f4e1/bluetooth-bluetoothledevicefromidasync-does-not-complete-on-10015063?forum=wdk#ef927009-676c-47bb-8201-8a80d2323a7f

                tl;dr 对于 C++ 应用程序,它们提供了一个 CoInitializeSecurity 函数来调用.对于其他所有人,他们似乎建议创建一个 AppId在注册表中,因为 P/Invoke 并不好玩.

                tl;dr For C++ applications, they provide a CoInitializeSecurity function to call. For everyone else, it looks like they're recommending creating an AppId in the registry, since P/Invoke isn't much fun.

                奇怪的是,目前通过 noble-uwp 对我来说一切正常,它使用 C++ 绑定到 UWP 函数以通过 node.js 访问.我只是通过 C# 遇到了问题,并且根据我是在 UWP 还是 WPF/Console/Desktop 应用程序中,事情会在不同的点上失败.

                Weirdly enough, things are working fine for me at the moment through noble-uwp, which uses C++ bindings to UWP functions for access via node.js. It's only via C# that I'm having issues, and things fail at different points depending on whether I'm in a UWP or WPF/Console/Desktop application.

                按照论坛帖子中的说明将 AppId 添加到注册表后,我又开始工作了.

                After adding the AppId to the registry as outlined in the forum post, things worked for me again.

                这篇关于FromBluetoothAddressAsync 永远不会在 WPF 应用程序中的 Windows 10 Creators Update 上返回的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                上一篇:Win10中的EnumWindows函数只枚举桌面应用 下一篇:ContactManager.RequestStoreAsync() 抛出 System.UnauthorizedAcc

                相关文章

                <small id='fXIT8'></small><noframes id='fXIT8'>

              • <tfoot id='fXIT8'></tfoot>
                <i id='fXIT8'><tr id='fXIT8'><dt id='fXIT8'><q id='fXIT8'><span id='fXIT8'><b id='fXIT8'><form id='fXIT8'><ins id='fXIT8'></ins><ul id='fXIT8'></ul><sub id='fXIT8'></sub></form><legend id='fXIT8'></legend><bdo id='fXIT8'><pre id='fXIT8'><center id='fXIT8'></center></pre></bdo></b><th id='fXIT8'></th></span></q></dt></tr></i><div id='fXIT8'><tfoot id='fXIT8'></tfoot><dl id='fXIT8'><fieldset id='fXIT8'></fieldset></dl></div>

                  <bdo id='fXIT8'></bdo><ul id='fXIT8'></ul>
                1. <legend id='fXIT8'><style id='fXIT8'><dir id='fXIT8'><q id='fXIT8'></q></dir></style></legend>