0

I have an Azure time trigger function developed in Azure portal which will trigger once in a day. The triggering function was working fine yesterday, but suddenly today function is returning the below error while running the function.

2019-08-26T05:10:55.509 [Error] Function compilation error
2019-08-26T05:10:55.509 [Error] error CS0041: Unexpected error writing debug information -- 'The version of Windows PDB writer is older than required: 'diasymreader.dll''
2019-08-26T05:10:55.539 [Error] Exception while executing function: Functions.TimerTriggerCSharp1. Microsoft.Azure.WebJobs.Script: Script compilation failed.
2019-08-26T05:10:55.586 [Error] Function completed (Failure, Id=361874a9-10d7-4fc2-9a53-ec17f7a65a78, Duration=100ms)

Below is the project.json file which I have created.

{
  "frameworks": {
    "net46":{
      "dependencies": {
        "Microsoft.Azure.DocumentDB": "2.0.0"
      }
    }
   }
}

Below is the .csx file

#r "Microsoft.Azure.Documents.Client"

    using System;
    using Microsoft.Azure.Documents;
    using Microsoft.Azure.Documents.Client;
    using Microsoft.Azure.WebJobs.Host;
    using Newtonsoft.Json;

    public static async Task Run(TimerInfo myTimer,  IEnumerable<dynamic> 
    inputDocument, TraceWriter log)
    {
    log.Info($"C# Timer trigger function started at: {DateTime.Now}");

    // Get the date 6 months before from Current Time in IST and convert to Epoch value. 
    TimeZoneInfo INDIAN_ZONE = TimeZoneInfo.FindSystemTimeZoneById("India 
    Standard Time");
    DateTime indianTime =  
    TimeZoneInfo.ConvertTimeFromUtc(DateTime.UtcNow.AddDays(-180), 
    INDIAN_ZONE);


    long epochTime = (long)(indianTime - new DateTime(1970, 1, 
    1)).TotalSeconds;

    DocumentClient client;
    string endpoint = "https://***cosmosdb.documents.azure.com:443/";
    string key = "****";
    client = new DocumentClient(new Uri(endpoint), key);

    foreach (var doc in inputDocument)
        {
            string partKey = doc.NUM;
            StoredProcedureResponse<bool> sprocResponse = await 
    client.ExecuteStoredProcedureAsync<bool>(

   "/dbs/DB_NAME/colls/COLLECTION_NAME/sprocs/STORED PROC_NAME/",new 
    RequestOptions { PartitionKey = new PartitionKey(partKey) });

            log.Info($"Cosmos DB is updated at: {DateTime.Now}");
        }
    }

Since it was working fine last day, What might be the reason for a sudden failure with this error? How to get this solved ? Trigger Function is developed in Azure Portal.

Antony
  • 970
  • 3
  • 20
  • 46
  • Did you try restarting the function app as well as the app service plan ? – HariHaran Aug 26 '19 at 06:00
  • Yes I tried and It is working after restarting the function App. But the function is time trigger function and if it throws the same error will that affect the function execution?. – Antony Aug 27 '19 at 09:40

1 Answers1

0

But the function is time trigger function and if it throws the same error will that affect the function execution?.

Yes, it will affect the function execution, no matter timer trigger or queue trigger. As the log said, Function completed (Failure, which means the function execute failed.

Leon Yue
  • 15,693
  • 1
  • 11
  • 23
  • 1
    So what might be the reason for this PDB writer error which cause failure of compilation and is there any workaround so that we can avoid this failure? – Antony Aug 29 '19 at 03:58