Skip to content
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

Fix #2423: Coverlet: don't use implicit yield #2424

Merged
merged 2 commits into from
Nov 2, 2019

Conversation

Tarmil
Copy link
Contributor

@Tarmil Tarmil commented Oct 29, 2019

Use explicit yield to construct the MSBuild param list to make sure that they don't get ignored by an older language version.

@Tarmil Tarmil marked this pull request as ready for review October 30, 2019 18:17
@matthid
Copy link
Member

matthid commented Nov 1, 2019

fixes #2423

Do we know why the tests passed? /cc @SteveGilham

@SteveGilham
Copy link
Contributor

SteveGilham commented Nov 1, 2019

With the current tip (commit cd7d749) the code generated for the function of interest, Fake.DotNet.Testing.Coverlet.properties@92.GenerateNext, is very different in debug and release builds. Debug is the sort of state machine one would expect, and emits the expected results in order; Release evaluates all the results in the initial state, then drops them on the floor, to give an empty output. This has to be an underlying compiler issue.

@matthid
Copy link
Member

matthid commented Nov 1, 2019

Maybe a compiler bug in the new feature /cc @dsyme

@SteveGilham
Copy link
Contributor

Bumping the .net SDK version to 3.0.100 in global.json from 2.1.508 -- picking up the tooling which has the implicit yield implementation -- puts the full state machine into the Release build which now matches up with the Debug version.

@matthid
Copy link
Member

matthid commented Nov 1, 2019

@SteveGilham As the CI always builds in Release mode, shouldn't the test still fail in CI, before this PR?

@SteveGilham
Copy link
Contributor

That the tests pass is still a mystery to me.

@SteveGilham
Copy link
Contributor

Not sure if related, but reverting the global.json, I loaded Fake.sln in Visual Studio, and in Release configuration, attempted to debug the relevant unit tests. In the process of the build that kicks off, the Coverlet assembly went to version 1.0.0.0 and the GenerateNext method in that version had the state machine OK. I couldn't step through the tests, but they went green.

@dsyme
Copy link
Collaborator

dsyme commented Nov 1, 2019

With the current tip (commit cd7d749) the code generated for the function of interest....

Which compiler is being used here?

If an old compiler is being used, then I assume it's pouring out warnings about ignored values, and then release mode is removing them.

@matthid
Copy link
Member

matthid commented Nov 1, 2019

Ok, I took a look at why this could happen. It seems to be a VERY unfortunate combination of events. Here is what I found:

  • Test code failed due to this:
    image
    So even the props are empty the test is still green. -> Reported Can we make containsAll fail when the expected argument is an empty list? haf/expecto#359

  • In fact, when using dotnet build on the command line (when using the CI) an old compiler is used (properly emitting the warnings as @dsyme said)

  • When using Visual Studio 2019 for building and running the tests a new compiler is used and you have no warnings (and even worse when you debug it you see 'expected' behavior), even though global.json locks an older version. This is VERY unfortunate. @cartermp, @dsyme I think this is most likely a "known limitation" or "by design", should I open an issue anyway?

@cartermp
Copy link

cartermp commented Nov 1, 2019

This would be by design. Since tooling is always built and tested against the compiler that it ships with, that's what is always used. There's no way to use an older compiler by setting global.json and there isn't a correspondence between a value there and a given LangVersion configuration. This might be machinery someone could build, but I highly doubt it's on anyone's priority list at Microsoft.

@matthid
Copy link
Member

matthid commented Nov 1, 2019

@cartermp Ok not opening an issue then, I still think it is worth keeping an eye open to see if others fall into the same trap. Thanks for the fast response.

@matthid matthid merged commit 4bc0f2e into fsprojects:release/next Nov 2, 2019
@Tarmil Tarmil deleted the 2423-coverlet branch November 3, 2019 09:45
@matthid matthid mentioned this pull request Nov 4, 2019
matthid added a commit that referenced this pull request Nov 4, 2019
* BUGFIX: `Fake.DotNet.Testing.Coverlet` was not working, thanks @Tarmil - #2424
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants