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

WPF Benchmark with Net80 RuntimeMoniker not supported #2608

Open
trivalik opened this issue Aug 7, 2024 · 0 comments
Open

WPF Benchmark with Net80 RuntimeMoniker not supported #2608

trivalik opened this issue Aug 7, 2024 · 0 comments

Comments

@trivalik
Copy link

trivalik commented Aug 7, 2024

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant