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

Is c#8 supported? #557

Open
lg2de opened this issue Jun 3, 2019 · 2 comments

Comments

Projects
None yet
2 participants
@lg2de
Copy link

commented Jun 3, 2019

Describe the bug
We have a .NET Core 3 project and would like to validate our tests using Stryker.
.NET Core 3 itself seems to be supported.
But I think C# 8 is not (yet) supported, isn't it? It is planned to support?

Logs
log-20190603.txt

Actual behavior

[17:33:40 INF] Using d:\Projekte\Test\StrykerTest\XUnitTestProject\XUnitTestProject.csproj as project file
[17:33:46 INF] Started initial build using dotnet build
[17:33:49 INF] Initial build successful
[17:33:49 INF] Using testrunner DotnetTest
[17:33:49 INF] Initial testrun started
[17:33:53 INF] Total number of tests found in initial test run: 0
[17:33:53 INF] Initial testrun successful in 4326 ms
[17:33:53 INF] Using 36489 ms as testrun timeout
[17:33:56 WRN] Stryker.NET encountered an compile error in d:\Projekte\Test\StrykerTest\ClassLibrary\Calculator.cs with message: Das Feature "Using-Deklarationen" befindet sich zurzeit in der Vorschau und wird *nicht unterstützt*. Um Previewfunktionen zu nutzen, verwenden Sie die Sprachversion "Preview". (Source code: using var cancellationTokenSource = new CancellationTokenSource();)
[17:33:56 WRN] Safe Mode! Stryker will try to continue by rolling back all mutations in method. This should not happen, please report this as an issue on github with the previous error message.
[17:33:56 WRN] Stryker.NET encountered an compile error in d:\Projekte\Test\StrykerTest\ClassLibrary\Calculator.cs with message: Das Feature "Using-Deklarationen" befindet sich zurzeit in der Vorschau und wird *nicht unterstützt*. Um Previewfunktionen zu nutzen, verwenden Sie die Sprachversion "Preview". (Source code: using var cancellationTokenSource = new CancellationTokenSource();)
[17:33:56 WRN] Safe Mode! Stryker will try to continue by rolling back all mutations in method. This should not happen, please report this as an issue on github with the previous error message.
[17:33:56 FTL] Stryker.NET could not compile the project after mutation. This is probably an error for Stryker.NET and not your project. Please report this issue on github with the previous error message.
[17:33:56 ERR] An error occurred during the mutation test run
System.ApplicationException: Internal error due to compile error.
   at Stryker.Core.Compiling.RollbackProcess.RemoveMutantIfStatements(SyntaxTree originalTree, ICollection`1 diagnosticInfo, Boolean devMode) in D:\a\1\s\src\Stryker.Core\Stryker.Core\Compiling\RollbackProcess.cs:line 191
   at Stryker.Core.Compiling.RollbackProcess.Start(CSharpCompilation compiler, ImmutableArray`1 diagnostics, Boolean devMode) in D:\a\1\s\src\Stryker.Core\Stryker.Core\Compiling\RollbackProcess.cs:line 61
   at Stryker.Core.Compiling.CompilingProcess.TryCompilation(MemoryStream ms, CSharpCompilation compilation, EmitResult previousEmitResult, Boolean devMode, Int32 retryCount) in D:\a\1\s\src\Stryker.Core\Stryker.Core\Compiling\CompilingProcess.cs:line 108
   at Stryker.Core.Compiling.CompilingProcess.Compile(IEnumerable`1 syntaxTrees, MemoryStream ms, Boolean devMode) in D:\a\1\s\src\Stryker.Core\Stryker.Core\Compiling\CompilingProcess.cs:line 76
   at Stryker.Core.MutationTest.MutationTestProcess.Mutate(StrykerOptions options) in D:\a\1\s\src\Stryker.Core\Stryker.Core\MutationTest\MutationTestProcess.cs:line 91
   at Stryker.Core.StrykerRunner.RunMutationTest(StrykerOptions options) in D:\a\1\s\src\Stryker.Core\Stryker.Core\StrykerRunner.cs:line 77
[17:33:56 INF] Time Elapsed 00:00:15.8790249

Expected behavior
Without using the C#8 feature (using declaration on CancellationTokenSource) the project is analyzed correctly:

[17:22:13 INF] Using d:\Projekte\Test\StrykerTest\XUnitTestProject\XUnitTestProject.csproj as project file
[17:22:19 INF] Started initial build using dotnet build
[17:22:22 INF] Initial build successful
[17:22:22 INF] Using testrunner DotnetTest
[17:22:22 INF] Initial testrun started
[17:22:27 INF] Total number of tests found in initial test run: 0
[17:22:27 INF] Initial testrun successful in 4723 ms
[17:22:27 INF] Using 37084 ms as testrun timeout
[17:22:29 INF] 1 mutants ready for test

1 mutants have been created. Each mutant will now be tested, this could take a while.

Tests progress | ██████████ | 1 / 1 | 100 % | ~0m 00s |
Killed : 1
Survived: 0
Timeout : 0


All mutants have been tested, and your mutation score has been calculated
- \ClassLibrary [1/1 (100.00 %)]
--- Calculator.cs [1/1 (100.00 %)]
[Killed] Binary expression mutation on line 9: 'a + b' ==> 'a - b'
[17:22:33 INF] Time Elapsed 00:00:21.0552669

Desktop (please complete the following information):

  • OS: Windows
  • Type of project: core
  • Framework Version: core 3.0 preview 5
  • Stryker Version: beta 0.11.0

Additional context

public int Add(int a, int b)
{
    // The following line is useless but it reproduces the issue:
    // With this line the analysis failed, without it will succeed.
    using var cancellationTokenSource = new CancellationTokenSource();
    return a + b;
}

@lg2de lg2de added the bug label Jun 3, 2019

@richardwerkman

This comment has been minimized.

Copy link
Member

commented Jun 3, 2019

Hi, we compile with C# language version set to latest. And I just checked what C# versions our roslyn version does support and I saw this:

image

I would guess that latests would also contain version 8...

But as your error message states the version should be preview we might have to change from version latest to preview.

@lg2de

This comment has been minimized.

Copy link
Author

commented Jun 3, 2019

You can add a command line option.

Mobrockers added a commit that referenced this issue Jun 7, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.