Search code examples
azure-functionsazure-web-app-servicedotnet-clitfs-aggregator

Azure function throw exception to modify azure custom field on dashborad


I created a function to auto calculate custom log hour from Azure board task. I'm following the link below:

https://tfsaggregator.github.io/docs/v3/

Using the above link some other developer achieve successfully but after 1 years PAT expired and function working completely stopped. Now I again followed the same steps to execute it and I added new rule using new PAT. But while I'm changing log hours I've got the following exception which I do not understand:

2022-05-24 13:30:55.026
Executing 'Functions.AutoCal' (Reason='This function was programmatically called via the host APIs.', Id=4650-4f75-9324-5823890a50b7)
Information
2022-05-24 13:30:55.161
Error
2022-05-24 13:30:55.161
Function compilation error
Error
2022-05-24 13:30:55.225
run.csx(14,23): error CS1705: Assembly 'aggregator-function' with identity 'aggregator-function, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version than referenced assembly 'Microsoft.Extensions.Logging.Abstractions' with identity 'Microsoft.Extensions.Logging.Abstractions, Version=3.1.23.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
Error
2022-05-24 13:30:55.297
run.csx(15,27): error CS1705: Assembly 'aggregator-webshared' with identity 'aggregator-webshared, Version=1.2.0.0, Culture=neutral, PublicKeyToken=null' uses 'Microsoft.Extensions.Logging.Abstractions, Version=6.0.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' which has a higher version than referenced assembly 'Microsoft.Extensions.Logging.Abstractions' with identity 'Microsoft.Extensions.Logging.Abstractions, Version=3.1.23.0, Culture=neutral, PublicKeyToken=adb9793829ddae60'
Error
2022-05-24 13:30:55.297
run.csx(16,24): warning CS1701: Assuming assembly reference 'Microsoft.AspNetCore.Mvc.Abstractions, Version=2.2.0.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' used by 'aggregator-function' matches identity 'Microsoft.AspNetCore.Mvc.Abstractions, Version=3.1.23.0, Culture=neutral, PublicKeyToken=adb9793829ddae60' of 'Microsoft.AspNetCore.Mvc.Abstractions', you may need to supply runtime policy
Warning
2022-05-24 13:30:55.367
Script compilation failed.
Error
2022-05-24 13:30:55.367
Executed 'Functions.AutoCal' (Failed, Id=4650-4f75-9324-5823890a50b7, Duration=358ms)
Error
2022-05-24 13:30:55.371
Script compilation failed.

Solution

  • I resolved my issue. We need as follows,

    Dotnet runtime version 3.1 or recommended from Aggregator documentation. The latest version of Aggregator exe.

    Note: .rule file is in the javascript, so it will not get impacted by any above version changes. So always use the latest version of Aggregator and recommended dotnet runtime version.

    Best alternative solution is Microsoft flow, https://www.dombat.co.uk/using-microsoft-flow-to-fill-calculated-fields-in-azure-devops/

    https://www.youtube.com/watch?v=SK86TLZQw9A

    Above solution provide calculated value without refreshing page.