-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AltCover fails with: CancellationToken exists in both 'AltCover.Recorder.g' and 'System.Private.CoreLib' #133
Comments
Interesting. Looking into this, I'm surprised this one hasn't come up before. After v7.1.782, in preparation for the net5.0 release, I reorganized the build so that rather than there being a separate .Net Framework and .Net Core build, there was one unified build; and the recorder became a shared net20-targeted assembly (with a suitably old If the Marten generated code builds a separate assembly, with a predictable name, then excluding that assembly (via If that is not the case, then from v7.2.800 a work-round exists in the form of using the For F# code, the equivalent work-round can be used from v8.1.817 with any method returning an |
Thank you so much for the quick response. Marten generates and compiles the code at runtime, and uses random name for the assembly. So the exclude filters cannot work. But I tried the workaround with I assume the assembly that contains the dummy |
Yes, that's correct. |
Also, the exclude filtering may be able to do the job by either
|
Thanks again for the tips. I actually already have an exclusion filter like this: This what the stack track for the exception look like:
|
Of course -- run-time created assemblies won't be affected by the filtering, but will be picking up whatever's in the process' environment. Well, that solidifies what the fix is going to have to be. |
To help avoid "works on my machine" effects, here's a pre-release build with a proposed fix for this issue, for the purpose of validation (nupkg inside zip archive to conform with file upload restrictions) altcover.8.2.473-github-pre.nupkg.zip This should work without needing the |
I can confirm the issue is fixed in that build. Thank you so much for the quick turnaround! |
The issue was easy to diagnose, and the fix a simple one -- while rewriting the recorder prototype assembly to contain the session specific details such as the location of the report file, also make all the static-linked types internal. As I'd only just made one release and hadn't started on any new content, it was a quick win to just implement it. The longest delay will be the wait for the next proper release, as, barring show-stoppers without work-round, I prefer to have some new content, and not just do releases with only a single bug-fix. That means it might not be until next week for the real deal. |
That makes sense. Since we have a temporary workaround, waiting for the next release won't be a problem for us. At least we can upgrade to the current latest release now. Thank you again. |
Release 8.2.831 now out with this fix included. |
We use Marten, a popular library for postgres database. Marten generates and compiles code at runtime. When running unit tests with AltCover against code the uses Marten, we get the following error.
I have a very concise runnable repro here: https://github.com/samisq/AltCoverIssue. It requires running postgres server. You can run one in docker easily.
Repro steps:
The issue started happening after build 7.1.782. So it doesn't occur on build 7.1.782 or earlier, or if AltCover is disabled.
I'm not interested in coverage for that generated code. So I wonder if there's a way to prevent instrumenting that code.
The text was updated successfully, but these errors were encountered: