Skip to content

WPF Benchmark with Net80 RuntimeMoniker not supported #2608

Open
@trivalik

Description

@trivalik

I just want to write a small benchmark which needs for test the System.Windows.Point class from "WindowsBase.dll". The result of this was:

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFrameworks>net8.0-windows</TargetFrameworks>
    <UseWPF>true</UseWPF>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="BenchmarkDotNet" Version="0.14.0" />
  </ItemGroup>

</Project>
using System.Collections.Generic;
using System;
using System.Windows;
using BenchmarkDotNet.Attributes;
using BenchmarkDotNet.Engines;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Running;

namespace DrawingBenchmark
{
    internal class Program
    {
        static void Main(string[] args)
        {
            BenchmarkRunner.Run<Benchmarks>();
        }
    }
    [ShortRunJob(RuntimeMoniker.Net80)]
    public class Benchmarks
    {
        [Benchmark(Baseline = true)]
        public Point GivePoint() => new Point();
    }
}

Error output:

// Build Error: Standard output:

 Standard error:
   Determining projects to restore...
C:\Users\robo\source\repos\_Benchmarks\PROMGraphDrawingHelperBenchmark\PROMGraphDrawingHelperBenchmark\bin\Release\net8.0-windows\729262df-4442-43a4-b071-e22884eeb500\BenchmarkDotNet.Autogenerated.csproj : error NU1201: Das Projekt PROMGraphDrawingHelperBenchmark ist nicht mit net8.0 (.NETCoreApp,Version=v8.0) kompatibel. Das Projekt PROMGraphDrawingHelperBenchmark unterstützt Folgendes: net8.0-windows7.0 (.NETCoreApp,Version=v8.0)
  Fehler beim Wiederherstellen von "C:\Users\Trivalik\source\repos\Benchmarks\DrawingBenchmark\DrawingBenchmark\bin\Release\net8.0-windows\729262df-4442-43a4-b071-e22884eeb500\BenchmarkDotNet.Autogenerated.csproj" (in 67 ms.).
  1 von 2 Projekten sind für die Wiederherstellung auf dem neuesten Stand.

The funny thing about it, in first place I had the TargetFrameworks includeng net48 or net48-windows (not sure anymore), it builds but fails that it couldn't find the WindowsBase.dll.

But the important observation is if I use BenchmarkRunner.Run<Benchmarks>(new DebugBuildConfig()); in Main function, the debug job works. I guess the issue is that the failing job has "net8.0" in project file, the working job has <TargetFramework>net8.0-Windows7.0</TargetFramework>, but just this target in my project has no effect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions