Skip to content

Deprecate RunSource/RunUrl methods #2204

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

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions src/BenchmarkDotNet/Running/BenchmarkRunnerDirty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -66,22 +66,18 @@ public static Summary[] Run(BenchmarkRunInfo[] benchmarkRunInfos)
return RunWithExceptionHandling(() => RunWithDirtyAssemblyResolveHelper(benchmarkRunInfos));
}

/// <summary>
/// Supported only on Full .NET Framework. Not recommended.
/// </summary>
[PublicAPI]
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method will be removed soon as it is not supported in .NET Core")]
public static Summary RunUrl(string url, IConfig config = null)
{
using (DirtyAssemblyResolveHelper.Create())
return RunWithExceptionHandling(() => RunUrlWithDirtyAssemblyResolveHelper(url, config));
}

/// <summary>
/// Supported only on Full .NET Framework. Not recommended.
/// </summary>
[PublicAPI]
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method will be removed soon as it is not supported in .NET Core")]
public static Summary RunSource(string source, IConfig config = null)
{
using (DirtyAssemblyResolveHelper.Create())
Expand Down Expand Up @@ -115,6 +111,7 @@ private static Summary[] RunWithDirtyAssemblyResolveHelper(Type[] types, IConfig
private static Summary[] RunWithDirtyAssemblyResolveHelper(BenchmarkRunInfo[] benchmarkRunInfos)
=> BenchmarkRunnerClean.Run(benchmarkRunInfos);

#pragma warning disable CS0618 // Use of obsolete symbol
[MethodImpl(MethodImplOptions.NoInlining)]
private static Summary RunUrlWithDirtyAssemblyResolveHelper(string url, IConfig config = null)
=> RuntimeInformation.IsFullFramework
Expand All @@ -126,6 +123,7 @@ private static Summary RunSourceWithDirtyAssemblyResolveHelper(string source, IC
=> RuntimeInformation.IsFullFramework
? BenchmarkRunnerClean.Run(BenchmarkConverter.SourceToBenchmarks(source, config)).Single()
: throw new InvalidBenchmarkDeclarationException("Supported only on Full .NET Framework");
#pragma warning restore CS0618 // Use of obsolete symbol

private static Summary RunWithExceptionHandling(Func<Summary> run)
{
Expand Down
5 changes: 5 additions & 0 deletions src/BenchmarkDotNet/Running/ClassicBenchmarkConverter.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.IO;
using System.Linq;
#if NET6_0_OR_GREATER
Expand All @@ -22,6 +23,8 @@ public static partial class BenchmarkConverter
private static readonly HttpClient Client = new HttpClient();
#endif

[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method will be removed soon as it is not supported in .NET Core")]
public static BenchmarkRunInfo[] UrlToBenchmarks(string url, IConfig config = null)
{
if (!RuntimeInformation.IsFullFramework)
Expand Down Expand Up @@ -65,6 +68,8 @@ public static BenchmarkRunInfo[] UrlToBenchmarks(string url, IConfig config = nu
return SourceToBenchmarks(benchmarkContent, config);
}

[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This method will be removed soon as it is not supported in .NET Core")]
public static BenchmarkRunInfo[] SourceToBenchmarks(string source, IConfig config = null)
{
if (!RuntimeInformation.IsFullFramework)
Expand Down