iot-core-azure-dm-client icon indicating copy to clipboard operation
iot-core-azure-dm-client copied to clipboard

DM Hello World Build Errors

Open scout208 opened this issue 6 years ago • 2 comments

I'm getting two errors when trying to build after following the walkthrough DM Hello World Application - Coding.

The two errors are

error CS0539: 'AppDeviceManagementRequestHandler.IsSystemRebootAllowed()' in explicit interface 
declaration is not a member of interface
error CS7069: Reference to type 'Task<>' claims it is defined in 'System.Runtime', but it could not be 
found

Both of the errors appear to be stemmed around this class:

class AppDeviceManagementRequestHandler : IDeviceManagementRequestHandler
{
    MainPage mainPage;

    public AppDeviceManagementRequestHandler(MainPage mainPage)
    {
        this.mainPage = mainPage;
    }

    // Answer the question "is it OK to reboot the device"
    async Task<bool> IDeviceManagementRequestHandler.IsSystemRebootAllowed()
    {
        return true;
    }
}

scout208 avatar Nov 14 '18 17:11 scout208

Updating the Min version of my solution to Build 16299 and upgrading the Microsoft.Azure.Devices.Client nuget package version from 1.4.0 to 1.7.0 fixed most of the errors.

Now there's just on error left on this line:

IDeviceTwin deviceTwin = new AzureIoTHubDeviceTwinProxy(newDeviceClient, ResetConnectionAsync, Logger.Log);

The error:

error CS1503: Argument 2: cannot convert from 'method group' to 'EventWaitHandle'

scout208 avatar Nov 14 '18 20:11 scout208

I also had this issue but after looking at the samples I see that they actually use a EventWaitHandle which fixes this build error -

 private EventWaitHandle _iotHubOfflineEvent;
 IDeviceTwin deviceTwin = new AzureIoTHubDeviceTwinProxy(_deviceClient, _iotHubOfflineEvent, Logger.Log);

I guess the walk though is outdated.

gavjeffrey avatar Dec 10 '18 06:12 gavjeffrey