allure-framework / allure-csharp

Allure integrations for C# test frameworks
https://allurereport.org/
Apache License 2.0
106 stars 65 forks source link

.Net 8.0 Xunit-Testproject Throws InvalidOperationException #447

Closed Nepitwin closed 7 months ago

Nepitwin commented 8 months ago

I'm submitting a ...

What is the current behavior?

If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem

What is the expected behavior?

What is the motivation / use case for changing the behavior?

Other information

dotnet test
  Wiederherzustellende Projekte werden ermittelt...
  Alle Projekte sind für die Wiederherstellung auf dem neuesten Stand.
  Allure.Examples.Xunit -> C:\Users\andreas.sekulski\Desktop\allure-xunit-main\tests\Allure.Examples.Xunit\bin\Debug\ne
  t8.0\Allure.Examples.Xunit.dll
Testlauf für "C:\Users\andreas.sekulski\Desktop\allure-xunit-main\tests\Allure.Examples.Xunit\bin\Debug\net8.0\Allure.Examples.Xunit.dll" (.NETCoreApp,Version=v8.0)
Microsoft (R) Testausführungs-Befehlszeilentool Version 17.8.0 (x64)
Copyright (c) Microsoft Corporation. Alle Rechte vorbehalten.

Die Testausführung wird gestartet, bitte warten...
Insgesamt 1 Testdateien stimmten mit dem angegebenen Muster überein.
[xUnit.net 00:00:00.20] Unable to patch XunitTestRunner's Void .ctor(Xunit.Abstractions.ITest, Xunit.Sdk.IMessageBus, System.Type, System.Object[], System.Reflection.MethodInfo, System.Object[], System.String, System.Collections.Generic.IReadOnlyList`1[Xunit.Sdk.BeforeAfterTestAttribute], Xunit.Sdk.ExceptionAggregator, System.Threading.CancellationTokenSource): System.TypeInitializationException: The type initializer for 'MonoMod.Utils.DMDEmitDynamicMethodGenerator' threw an exception.
 ---> System.InvalidOperationException: Cannot find returnType fieeld on DynamicMethod
   at MonoMod.Utils.DMDEmitDynamicMethodGenerator..cctor()
   --- End of inner exception stack trace ---
   at MonoMod.Utils.DMDEmitDynamicMethodGenerator.GenerateCore(DynamicMethodDefinition dmd, Object context)
   at MonoMod.Utils.DMDGenerator`1.Generate(DynamicMethodDefinition dmd, Object context)
   at MonoMod.Utils.DynamicMethodDefinition.Generate(Object context)
   at MonoMod.Utils.DynamicMethodDefinition.Generate()
   at HarmonyLib.MethodPatcher.CreateReplacement(Dictionary`2& finalInstructions)
   at HarmonyLib.PatchFunctions.UpdateWrapper(MethodBase original, PatchInfo patchInfo)
   at HarmonyLib.PatchProcessor.Patch()
   at HarmonyLib.Harmony.Patch(MethodBase original, HarmonyMethod prefix, HarmonyMethod postfix, HarmonyMethod transpiler, HarmonyMethod finalizer)
   at Allure.XUnit.AllureXunitPatcher.PatchXunitTestRunnerCtors(Harmony patcher)
[xUnit.net 00:00:00.20] No constructors of XunitTestRunner were pathched. Some theories may miss their parameters in the report
[xUnit.net 00:00:00.39]     Add label to existing issue by authorized user [FAIL]
  Fehler Add label to existing issue by authorized user [6 ms]
  Fehlermeldung:
   System.Exception : Element not found for xpath [//div[@class='something']]
  Stapelverfolgung:
     at Allure.Examples.NUnit3.WebUITests.WebUITestFixtureBase.MaybeThrowElementNotFoundException() in C:\Users\andreas.sekulski\Desktop\allure-xunit-main\tests\Allure.Examples.Xunit\WebUITests\WebUITestBase.cs:line 30
   at Allure.Examples.NUnit3.WebUITests.LabelTests.FilterIssuesByLabel(String labelTitle) in C:\Users\andreas.sekulski\Desktop\allure-xunit-main\tests\Allure.Examples.Xunit\WebUITests\LabelTests.cs:line 78
   at Allure.Net.Commons.Steps.AllureAbstractStepAspect.WrapAsync(Func`2 target, Object[] args, MethodBase metadata, String stepName, List`1 stepParameters)
   at Allure.Examples.NUnit3.WebUITests.LabelTests.AddLabelToExistingIssueByAuthorizedUser() in C:\Users\andreas.sekulski\Desktop\allure-xunit-main\tests\Allure.Examples.Xunit\WebUITests\LabelTests.cs:line 31
--- End of stack trace from previous location ---

Fehler!      : Fehler:     1, erfolgreich:     6, übersprungen:     0, gesamt:     7, Dauer: 46 ms - Allure.Examples.Xunit.dll (net8.0)
TonEnfer commented 8 months ago

As a workaround, you can specify links to specific versions of libraries in the project

<PackageReference Include="Lib.Harmony" Version="2.3.0-prerelease.5" />
<PackageReference Include="MonoMod.Utils" Version="25.0.4" />
delatrie commented 7 months ago

Duplicate of #434 It will be fixed soon (the next week, presumably).