Timer trigger function app throws exception when Microsoft.Azure.Devices.Client is used

Pai, Umesh 6 Reputation points
2022-02-01T11:32:12.82+00:00

I have created a timer trigger azure function with just one liner to log.

I included the package Microsoft.Azure.Devices.Client into setting and when i try to run the function locally, it started throwing exception

170162-image.png

throw new InvalidOperationException("The host has not yet started.");

Here is the project settings:
170175-image.png

If i remove Microsoft.Azure.Devices.Client, it works fine. So any limitation of this package w.r.t azure timer trigger function apps.?

Azure Functions
Azure Functions
An Azure service that provides an event-driven serverless compute platform.
4,363 questions
{count} votes

1 answer

Sort by: Most helpful
  1. MughundhanRaveendran-MSFT 12,436 Reputation points
    2022-02-03T06:32:23.72+00:00

    @Pai, Umesh ,

    Thanks for reaching out to Q&A.

    I am able to reproduce this issue at my end as well. I get the below error

    A host error has occurred during startup operation '7160cf3e-b385-469a-9552-f55e323b4999'.
    [2022-02-03T06:12:46.845Z] System.Private.CoreLib: Could not load file or assembly 'Microsoft.Extensions.Logging.Abstractions, Version=5.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'. The system cannot find the file specified.
    Value cannot be null. (Parameter 'provider')

    I am running the Azure functions in .net core 3.1 and the Microsoft.Extensions.Logging.Abstractions is version 5. It appears that the installed version of Microsoft.Extensions.Logging.Abstractions was 5.0 while the project was in .NET Core 3.1.

    I upgraded the Azure functions to .net 5 isolated and added the Microsoft.Azure.Devices.Client package. It is working without any issues. Please try this and let me know the outcome.

    I hope this helps!

    Please 'Accept as answer' and ‘Upvote’ if it helped so that it can help others in the community looking for help on similar topics.