make replace assembly case a bit more robust to avoid errors like "The process cannot access the file 'D:\Temp\cloudbuild\temp\ApiDataUploaderTests.dll\Microsoft.Applications.Telemetry.dll' because it is being used by another process.
Fix bugs in exception handler rewriting.
See new repro tests TestMultiCatchBlock, TestMultiCatchFilter, TestMultiCatchBlockWithFilter,
Related work items: #5186
I was worried about our handling of GenericInstanceType and GenericInstanceMethod in rewriting, so I wrote some new unit tests to help me feel better about it all :-)
Fix how binary rewriting tests run so they can run in production and systematic test modes and fix run-tests.ps1 so it tests all frameworks (since that works now!)
Related work items: #4377, #4458, #4705, #4979
This allows you to do this:
```
{
"AssembliesPath": "bin/Debug/netcoreapp3.1",
"OutputPath": "bin/Debug/netcoreapp3.1",
"Assemblies": [
"AspWebApplication1.dll",
"c:/Program Files/dotnet/shared/Microsoft.AspNetCore.App/3.1.5/Microsoft.AspNetCore.dll"
]
}
```
and rewritten Microsoft.AspNetCore.dll will show up in OutputPath.
Also promoted these tests to run as both systematic and production test, and fixed our BaseTest class so it waits for Actor tests to fail when they are supposed to fail.
Related work items: #4955
Refactoring of `TaskController` to make it more robust (including reducing some "safe" internal concurrency due to task continuations) and increase code reuse. Support for task cancelations for the core Task.Run APIs.
Also support for core TaskFactory.StartNew and ThreadPool APIs required for ASP.NET rewriting. Many new tests.
Note: had to do all these in the same PR as the changes were connected to each other and the new supported APIs help test the runtime changes.
Note: we are only intercepting and modeling a very limited set of APIs to enable specific scenarios such as ASP.NET rewriting. Most APIs of these classes are not supported by our modeling, and we do not currently aim to support user applications with code that explicitly uses these APIs.
Related work items: #717, #4781, #4909, #4937
Caching the constructed types cannot be generalized, especially for generics. Many types we need to reconstruct under the specific context. This is most likely because the result is not immutable. Instead, we rely on method caching to optimize. We can revisit this in the future.
Related work items: #4891