BenchmarkDotNet icon indicating copy to clipboard operation
BenchmarkDotNet copied to clipboard

[Bug] `System.InvalidOperationException: There is an error in XML document (0, 0).`

Open WhiteBlackGoose opened this issue 3 years ago • 3 comments

I cannot reproduce it properly, it may or may not occur. Here's the stacktrace:

Unhandled exception. System.InvalidOperationException: There is an error in XML document (0, 0).
 ---> System.Xml.XmlException: Root element is missing.
   at System.Xml.XmlTextReaderImpl.Throw(Exception e)
   at System.Xml.XmlTextReaderImpl.ParseDocumentContent()
   at System.Xml.XmlReader.MoveToContent()
   at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationReaderDisassemblyResult.Read15_DisassemblyResult()
   --- End of inner exception stack trace ---
   at System.Xml.Serialization.XmlSerializer.Deserialize(XmlReader xmlReader, String encodingStyle, XmlDeserializationEvents events)
   at BenchmarkDotNet.Disassemblers.WindowsDisassembler.Disassemble(DiagnoserActionParameters parameters)
   at BenchmarkDotNet.Diagnosers.DisassemblyDiagnoser.Handle(HostSignal signal, DiagnoserActionParameters parameters)
   at BenchmarkDotNet.Diagnosers.CompositeDiagnoser.Handle(HostSignal signal, DiagnoserActionParameters parameters)
   at BenchmarkDotNet.Loggers.SynchronousProcessOutputLoggerWithDiagnoser.ProcessInput()
   at BenchmarkDotNet.Toolchains.DotNetCli.DotNetCliExecutor.Execute(BenchmarkCase benchmarkCase, BenchmarkId benchmarkId, ILogger logger, ArtifactsPaths artifactsPaths, IDiagn
oser diagnoser, String executableName, IResolver resolver)
   at BenchmarkDotNet.Toolchains.DotNetCli.DotNetCliExecutor.Execute(ExecuteParameters executeParameters)
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.RunExecute(ILogger logger, BenchmarkCase benchmarkCase, BenchmarkId benchmarkId, IToolchain toolchain, BuildResult buildResul
t, IResolver resolver, IDiagnoser diagnoser, Boolean& success)
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.Execute(ILogger logger, BenchmarkCase benchmarkCase, BenchmarkId benchmarkId, IToolchain toolchain, BuildResult buildResult,
IResolver resolver)
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.RunCore(BenchmarkCase benchmarkCase, BenchmarkId benchmarkId, ILogger logger, IResolver resolver, BuildResult buildResult)
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.Run(BenchmarkRunInfo benchmarkRunInfo, Dictionary`2 buildResults, IResolver resolver, ILogger logger, List`1 artifactsToClean
up, String resultsFolderPath, String logFilePath, StartedClock& runChronometer)
   at BenchmarkDotNet.Running.BenchmarkRunnerClean.Run(BenchmarkRunInfo[] benchmarkRunInfos)
   at BenchmarkDotNet.Running.BenchmarkRunner.RunWithDirtyAssemblyResolveHelper(Type type, IConfig config, String[] args)
   at BenchmarkDotNet.Running.BenchmarkRunner.<>c__DisplayClass0_0`1.<Run>b__0()
   at BenchmarkDotNet.Running.BenchmarkRunner.RunWithExceptionHandling(Func`1 run)
   at BenchmarkDotNet.Running.BenchmarkRunner.Run[T](IConfig config, String[] args)
   at Silk.NET.Maths.Benchmark.Program.Main(String[] args) in D:\main\vs_prj\Silk.NETFork\Silk.NET\src\Maths\Silk.NET.Maths.Benchmarks\Program.cs:line 13

WhiteBlackGoose avatar Nov 10 '21 16:11 WhiteBlackGoose

I just added additional diagnostics for this case (130f0fb)

AndreyAkinshin avatar Dec 08 '21 14:12 AndreyAkinshin

Hmmm, why can it be happening though?

Also mb constrain the exception to InvalidOperation one? 😅

WhiteBlackGoose avatar Dec 08 '21 20:12 WhiteBlackGoose

Hmmm, why can it be happening though?

To find out you need to debug the disassembler, here is how you can do it: https://benchmarkdotnet.org/articles/contributing/disassembler.html#how-to-debug-the-disassembler

adamsitnik avatar Dec 09 '21 06:12 adamsitnik

With all the improvements we did for diassembler in 0.13.2 this issue should be gone now

adamsitnik avatar Oct 05 '22 11:10 adamsitnik