bugs://80062 got closed with status fixed.
Thanks Carlo.
I wonât be back in the office until Monday but Iâll check tomorrowâs build for sure.
Cheers.
I have tested this and it seems your fixes have enabled me to get a little further.
I am getting another âsilentâ crash on a line that shouldnât crash, however:
func GetGattService(serviceUuid: RemObjects.Elements.System.Guid) -> GattDeviceService? {
var service: UnsafePointer<__x_ABI_CWindows_CDevices_CBluetooth_CGenericAttributeProfile_CIGattDeviceService>
guard (*(*object).lpVtbl).GetGattService(object, serviceUuid, &service) == S_OK else {
return nil
}
return GattDeviceService(object: service)
}
The silent crash occurs on the first line of the function (the var service line)âŚ
That usually means it went wrong before that; how do I see this? (I figure I need a bluetooth id but will just any do?) The last bug was a compiler bug, something was cdecl isntead of stdcall.
You need a valid Bluetooth LE identifier and a valid service ID for that device. That wouldnât be too practical on your end. Is it possible this is just a failure with the Guid parsing call? It gets optimized out by the debugger so I canât really tell you if it parsed properly.
The calling code was the following:
public static let DeviceInformationService = "0000180a-0000-1000-8000-00805f9b34fb"
if let deviceInformationService = device.GetGattService(serviceUuid: RemObjects.Elements.System.Guid.Parse(DeviceInformationService)) {
// ...
}
If I change the GettGattService function so it doesnât do anything (aside from returning nil), I donât get the silent crash:
func GetGattService(serviceUuid: RemObjects.Elements.System.Guid) -> GattDeviceService? {
var service: UnsafePointer<__x_ABI_CWindows_CDevices_CBluetooth_CGenericAttributeProfile_CIGattDeviceService>
return nil
//guard (*(*object).lpVtbl).GetGattService(object, serviceUuid, &service) == S_OK else {
//return nil
//}
//return GattDeviceService(object: service)
}
The issue seems to be the guard line.
EDIT: Actually, scratch that. I was misusing the AddRef method and assumed its return value was a pointer to the object (itâs actually a reference count). Iâll fix my code and see how it behaves afterwards.
EDIT 2: I am getting a 0x80004002 HRESULT from GetGattService. Suspecting something is afoul with the Guid to GUID cast. Will investigate after lunch.
Either way Iâm going to look at the âlost exceptionsâ, I didnât notice that last time I tested your testcase.
Any update from your end? (Will investigate after lunch.)
Could this be of any helpful for Island?
https://developer.microsoft.com/en-us/events/build/content/effective-cppwinrt-for-uwp-and-win32-pptx
Apologies. My spouseâs mother passed away Monday night and I missed work. I have also been stuck with a pinched nerve for over a week, which has affected my arm and made typing quite painful. Things are improving slowly and I should be able to check things out this PM at the office (power outage this AM).
My condolences, sorry to hear that. No rush, I was just making sure that we werenât both waiting for eachothers feedback.
Thank you.
We just got power back at the office and I checked the return code:
GetGattService returns 0x80070490 (-2147023728)
The only match I found for this error code is E_PROP_ID_UNSUPPORTED in vfwmsgs.h
This is puzzling.
EDIT: Iâm wondering why the 2nd param to GetGattService presents itself as a straight up GUID, as opposed to other related functions who show it as an UnsafePointer.
just FYI, carlo is off until monday due to holidays, so he might not be able to get back to you until then.
I think I know whatâs going on here:
HRESULT ( STDMETHODCALLTYPE *GetGattService )(
__RPC__in __x_ABI_CWindows_CDevices_CBluetooth_CIBluetoothLEDevice * This,
/* [in] */ GUID serviceUuid,
/* [out][retval] */ __RPC__deref_out_opt __x_ABI_CWindows_CDevices_CBluetooth_CGenericAttributeProfile_CIGattDeviceService **service);
Note how GUID is in, but really should be passed by ref. Iâll see what I can do there on the compiler end.
was bugs://80165: pass struct by val on island/win32/i386
fixed for the next build.