I am getting the error whenever i try to debug my code and i am not able to proceed.
AsyncMethodBuilder.cs Not Found
Background Info:
I have to compress a huge volume of docs and with minimal time effort. I have a compression library and i am able to do the compression synchronously. But to speed up things i would like to compress docs in parallel (no of docs compressing at a time is programmable) such that 1. I would utilize the CPU properly and get the work done in optimal time.
To achieve the above I followed the this link to create multiple tasks and wait on them to complete
Below is the code I have tried.
public static class CompressAllTechniques
{
public static void Main()
{
GoCallAPIAsync();
}
private static async void GoCallAPIAsync()
{
try
{
List<Task> TaskList = new List<Task>();
// For Sample testing I have taken 4 files and will iterate through them to check the timings
const string originalFile1 = @"Sample Data\source";
const string originalFile2 = @"Sample Data\source1";
const string originalFile3 = @"Sample Data\Original";
const string originalFile4 = @"Sample Data\Original1";
List<string> arr = new List<string>() { originalFile1, originalFile2, originalFile3, originalFile4 };
int noofThreads = 2; // No of tasks that has to run paralally
int IterationsCompleted = 0;
int TotalIterations = 10;
var temp = arr;
Console.WriteLine("\n\nProcess Started @ " + DateTime.Now);
for (int i = 0; i < TotalIterations; i++)
{
if (temp.Count == 0) temp = arr;
var sd = temp.Take(noofThreads);
foreach (var item in sd)
{
var LastTask = new Task(() => GoCompress(item, IterationsCompleted));
LastTask.Start();
TaskList.Add(LastTask);
}
temp = temp.Except(sd).ToList();
await Task.WhenAll(TaskList.ToArray());
TaskList.Clear();
}
Console.WriteLine("\n\nProcess Completed @ " + DateTime.Now);
Console.Read();
}
catch (Exception ex)
{
throw;
}
}
private static void GoCompress(string zdf, int dcnk)
{
// Compression Logic
}
}
When I try to debug the above code I got the following Exception in Visual Studio.
Locating source for 'f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs'. (No checksum.)
The file 'f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs' does not exist.
Looking in script documents for 'f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs'...
Looking in the projects for 'f:\dd\ndp\clr\src\BCL\system\runtime\compilerservices\AsyncMethodBuilder.cs'.
The file was not found in a project.