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

Duplicate using causing benchmark not to work #538

Closed
CheloXL opened this Issue Sep 4, 2017 · 3 comments

Comments

Projects
None yet
3 participants
@CheloXL

CheloXL commented Sep 4, 2017

I know this is an edge case, but...
I have a solution wide Directory.build.props in the root folder where all the solution projects are stored. One specific setting that the props file is changing is the <TreatWarningsAsErrors>true</TreatWarningsAsErrors>.
Now, if I try to run my benchmarks, they fail as there are duplicate usings in the autogenerated .cs files. Those duplications are usually shown as warning but because of my settings, they are now errors and everything else fails.
So, my solution is to change that setting, run the benchmark and have to remember to switch it back again...

Example code from one autogenerated file:

#define RETURNS_CONSUMABLE
using System;
using System.Diagnostics;
using System.Linq;
using System.Threading;
using System.Reflection;
using System.Runtime.CompilerServices;
using BenchmarkDotNet;
using BenchmarkDotNet.Characteristics;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Jobs;
using BenchmarkDotNet.Extensions;
using BenchmarkDotNet.Helpers;
using BenchmarkDotNet.Running;
using BenchmarkDotNet.Engines;
using Benchmark.Dotnet;
using Benchmark.Dotnet;



namespace BenchmarkDotNet.Autogenerated
{
    public class Program
    {
        
        public static int Main(string[] args)
        {
            // this method MUST NOT have any dependencies to BenchmarkDotNet and any other external dlls!
            // otherwise if LINQPad's shadow copy is enabled, we will not register for AssemblyLoading event
            // before .NET Framework tries to load it for this method
            HelpAssemblyResolving();
            return AfterAssemblyLoadingAttached(args);
        }

@adamsitnik adamsitnik self-assigned this Sep 4, 2017

@adamsitnik adamsitnik closed this in cc8d074 Sep 4, 2017

@adamsitnik adamsitnik added this to the v0.10.10 milestone Sep 4, 2017

@adamsitnik

This comment has been minimized.

Show comment
Hide comment
@adamsitnik

adamsitnik Sep 4, 2017

Member

Fixed, you owe me a beer ;)

Member

adamsitnik commented Sep 4, 2017

Fixed, you owe me a beer ;)

@CheloXL

This comment has been minimized.

Show comment
Hide comment
@CheloXL

CheloXL Sep 4, 2017

I would gladly invite you more than one, if you come near where I live.. In the meanwhile, 🍺

CheloXL commented Sep 4, 2017

I would gladly invite you more than one, if you come near where I live.. In the meanwhile, 🍺

@lukasz-pyrzyk

This comment has been minimized.

Show comment
Hide comment
@lukasz-pyrzyk

lukasz-pyrzyk Sep 4, 2017

Collaborator

It looks like beerware license 🍻

Collaborator

lukasz-pyrzyk commented Sep 4, 2017

It looks like beerware license 🍻

alinasmirnova added a commit to alinasmirnova/BenchmarkDotNet that referenced this issue Sep 22, 2018

enforce TreatWarningsAsErrors=False in auto-generated csproj to overr…
…ide global settings which might cause the build to fail, fixes dotnet#538
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment