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

Resolve warnings #207

Merged
merged 3 commits into from
Oct 17, 2022
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
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public EfTestDbContext() : base(GetConnectionString()) { }
#if NETCOREAPP
static string GetConnectionString()
{
var location = new Uri(typeof(EfTestDbContext).Assembly.EscapedCodeBase).LocalPath;
var location = new Uri(typeof(EfTestDbContext).Assembly.Location).LocalPath;
var configuration = ConfigurationManager.OpenExeConfiguration(location);
var connectionString = configuration.ConnectionStrings.ConnectionStrings["DelegateDecompilerEfTestDb"]
.ConnectionString;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,9 @@ public void ComputedShouldThrowExceptionIfUnsupportedMemberInfo()

class TestClass
{
public int Field;
public int Property { get { return Field; } }
public int Field = 1;

public int Property => Field;

public int Method()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public static string GetMarkupFileDirectory(string alternateTestDir = MarkupDire
{
string path;
if (GetMarkupFileDirectory(Environment.CurrentDirectory, alternateTestDir, out path) ||
GetMarkupFileDirectory(Path.GetDirectoryName(new Uri(typeof(MarkupFileHelpers).Assembly.CodeBase).LocalPath), alternateTestDir, out path))
GetMarkupFileDirectory(Path.GetDirectoryName(new Uri(typeof(MarkupFileHelpers).Assembly.Location).LocalPath), alternateTestDir, out path))
{
return path;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public void ComputedShouldThrowExceptionIfUnsupportedMemberInfo()

class TestClass
{
public int Field;
public int Field = 1;
public int Property { get { return Field; } }

public int Method()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Linq.Expressions;
using System.Threading;
Expand Down Expand Up @@ -30,6 +31,7 @@ public virtual TResult ExecuteAsync<TResult>(Expression expression, Cancellation
return AsyncQueryProvider.ExecuteAsync<TResult>(decompiled, cancellationToken);
}

[SuppressMessage("EntityFramework", "EF1001")]
public override IQueryable<TElement> CreateQuery<TElement>(Expression expression)
{
var decompiled = expression.Decompile();
Expand Down
4 changes: 2 additions & 2 deletions src/DelegateDecompiler.Tests/AbstractMethodTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ public class C<T> : A

public class D : C<int>
{
public string Me = "C";
public new string Me = "C";

public override string M1() => "D";

Expand All @@ -112,7 +112,7 @@ public class D : C<int>

public abstract class E : C<int>
{
public string Me = "C";
public new string Me = "C";

public override string M1() => "E";

Expand Down
3 changes: 2 additions & 1 deletion src/DelegateDecompiler.Tests/BooleanTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using System;
#pragma warning disable CS0162 // Code is unreachable
using System;
using System.Linq.Expressions;
using NUnit.Framework;

Expand Down
4 changes: 3 additions & 1 deletion src/DelegateDecompiler.Tests/NullTests.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
using System;
// ReSharper disable EqualExpressionComparison
#pragma warning disable CS1718 // Comparison made to same variable
using System;
using System.Linq.Expressions;
using NUnit.Framework;

Expand Down
2 changes: 2 additions & 0 deletions src/Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>

<TreatWarningsAsErrors>True</TreatWarningsAsErrors>

<ContinuousIntegrationBuild Condition="'$(CI)' != ''">$(CI)</ContinuousIntegrationBuild>
</PropertyGroup>

Expand Down