locked
Adding NFC DeviceArrived hander on WP 8.1 generates crash RRS feed

  • Question

  • I've recently started seeing crashes on 8.1 devices with our NFC code.

    Here's the stack trace we get:

    Frame    Image                             Function                                                                                                                                               Offset        
    0        Windows.ni.winmd                  Windows.Networking.Proximity.ProximityDevice.add_DeviceArrived                                                                                         0x00000001    
    1        mscorlib.ni.dll                   System.Func_2[[System.__Canon,_mscorlib],[System.Runtime.InteropServices.WindowsRuntime.EventRegistrationToken,_mscorlib]].Invoke                      0x00000001    
    2        mscorlib.ni.dll                   System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeMarshal+NativeOrStaticEventRegistrationImpl.AddEventHandler[[System.__Canon,_mscorlib]]    0x00000036    
    3        mscorlib.ni.dll                   System.Runtime.InteropServices.WindowsRuntime.WindowsRuntimeMarshal.AddEventHandler[[System.__Canon,_mscorlib]]                                        0x00000060    

    This is in response to our code:

    private NFCManager()
    {
       _nfcdev = ProximityDevice.GetDefault();
       if (_nfcdev != null)
       {
          _nfcdev.DeviceArrived += _nfc_DeviceArrived
          // ...
       }
    }
    

    Any idea why this is now faulting?

    The actual error we're getting from the exception (from our own reporting) is:

    Exception at 9/26/2014 11:24:01 AM
    System.Exception

    The device does not recognize the command. (Exception from HRESULT:
    0x80070016)

    Also, the ability to read the crash dumps is appalling.  Trying to open the stack trace in OneDrive gives a terrible experience.

    And there's no indication of what type of device caused the crash.


    Anthony Wieser | Wieser Software Ltd | www.wieser-software.com

    Friday, November 7, 2014 5:31 PM

All replies

  • see this thread:

    Problem in Invoking Event Handler in Visual Studio


    在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。

    Sunday, November 9, 2014 5:04 AM
  • Not the answer, as the question is about hooking up the handler, not servicing the callback.


    Anthony Wieser | Wieser Software Ltd | www.wieser-software.com

    Friday, November 21, 2014 8:09 AM
  • Have you ever try that code, and still crash ?

    在現實生活中,你和誰在一起的確很重要,甚至能改變你的成長軌跡,決定你的人生成敗。 和什麼樣的人在一起,就會有什麼樣的人生。 和勤奮的人在一起,你不會懶惰; 和積極的人在一起,你不會消沈; 與智者同行,你會不同凡響; 與高人為伍,你能登上巔峰。

    Friday, November 21, 2014 8:36 AM
  • Let's see:

    Your code begins:

     proximitydevice = ProximityDevice.GetDefault();
                if (proximitydevice != null)
                {
                    proximitydevice.DeviceArrived += proximitydevice_DeviceArrived;

    That looks pretty identical to the code I listed immediately above, so yes, I'd say I've tried that code.

    Remember, I can't reproduce this crash.  It's a crash report from an app in store on some user's device.


    Anthony Wieser | Wieser Software Ltd | www.wieser-software.com


    Friday, November 21, 2014 8:59 AM