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.