stryker-mutator / stryker-net

Mutation testing for .NET core and .NET framework!
https://stryker-mutator.io
Apache License 2.0
1.76k stars 176 forks source link

MutantControl.cs failed to build 'GC.KeepAlive' #2686

Closed tnoiretisa closed 11 months ago

tnoiretisa commented 11 months ago

Describe the bug After fixing https://github.com/stryker-mutator/stryker-net/issues/2685, we got a new error

I think it's collision with my solution root Namespace "GC" and the Garbage Collector class name

Logs

[10:55:06 INF] Initial testrun started.
[10:55:11 WRN] Stryker.NET encountered an compile error in Stryker.Core.InjectedHelpers.MutantControl.cs (at 43:12) with message: Le nom de type ou d'espace de noms 'KeepAlive' n'existe pas dans l'espace de noms 'GC' (vous manque-t-il une référence d'assembly ?) (Source code: GC.KeepAlive)
[10:55:11 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.
[10:55:11 WRN] Stryker.NET encountered an compile error in Stryker.Core.InjectedHelpers.MutantControl.cs (at 44:12) with message: Le nom de type ou d'espace de noms 'KeepAlive' n'existe pas dans l'espace de noms 'GC' (vous manque-t-il une référence d'assembly ?) (Source code: GC.KeepAlive)

Expected behavior No build error

Desktop (please complete the following information):

Additional context With just replace

GC.KeepAlive with System.GC.KeepAlive it's work.

But maybe it's better to remove all using on this source and specific full name on all types to avoid all potential conflict with roslyn build class ? I can do a PR to do this if you want :)