Skip to content

Commit

Permalink
Make C# warnings fail the build
Browse files Browse the repository at this point in the history
* Treat warnings as errors
* Fix existing warning in Core tests
  • Loading branch information
chwarr committed Apr 22, 2016
1 parent 616f73f commit f79d213
Show file tree
Hide file tree
Showing 3 changed files with 40 additions and 40 deletions.
4 changes: 2 additions & 2 deletions cs/build/Common.Internal.props
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<FileAlignment>512</FileAlignment>
<MinimumVisualStudioVersion>11.0</MinimumVisualStudioVersion>
<NoWarn>1591</NoWarn>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
<AllowUnsafeBlocks>false</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
Expand Down Expand Up @@ -54,5 +55,4 @@
<AssemblyOriginatorKeyFile>$(DELAY_SIGN_KEY)</AssemblyOriginatorKeyFile>
<DefineConstants>$(DefineConstants);DELAY_SIGN</DefineConstants>
</PropertyGroup>
</Project>

</Project>
64 changes: 32 additions & 32 deletions cs/test/core/CustomBondedTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,47 +108,47 @@ public static CustomBonded<T> From<TActual>(TActual instance)
{
return new CustomBondedPoly<T,TActual>(instance);
}
}

internal class CustomBondedPoly<T, TActual> : CustomBonded<T>, IBonded<T>
{
public new static readonly CustomBonded<T> Empty = new CustomBondedPoly<T, TActual>(GenericFactory.Create<TActual>());
internal class CustomBondedPoly<T, TActual> : CustomBonded<T>, IBonded<T>
{
public new static readonly CustomBonded<T> Empty = new CustomBondedPoly<T, TActual>(GenericFactory.Create<TActual>());

private readonly TActual instance;
private readonly TActual instance;

public CustomBondedPoly(TActual instance)
{
this.instance = instance;
}
public CustomBondedPoly(TActual instance)
{
this.instance = instance;
}

public override T Value
{
get { return Deserialize(); }
}
public override T Value
{
get { return Deserialize(); }
}

public T Deserialize()
{
return CustomTransformFactory.Instance.Cloner<TActual, T>().Clone<T>(instance);
}
public T Deserialize()
{
return CustomTransformFactory.Instance.Cloner<TActual, T>().Clone<T>(instance);
}

public void Serialize<W>(W writer)
{
CustomTransformFactory.Instance.Serializer<W, TActual>().Serialize(instance, writer);
}
public void Serialize<W>(W writer)
{
CustomTransformFactory.Instance.Serializer<W, TActual>().Serialize(instance, writer);
}

public U Deserialize<U>()
{
return CustomTransformFactory.Instance.Cloner<TActual, U>().Clone<U>(instance);
}
public U Deserialize<U>()
{
return CustomTransformFactory.Instance.Cloner<TActual, U>().Clone<U>(instance);
}

IBonded<U> IBonded.Convert<U>()
{
return this as IBonded<U>;
}
IBonded<U> IBonded.Convert<U>()
{
return this as IBonded<U>;
}

public override CustomBonded<U> Convert<U>()
{
return new CustomBondedPoly<U, TActual>(instance);
}
public override CustomBonded<U> Convert<U>()
{
return new CustomBondedPoly<U, TActual>(instance);
}
}

Expand Down
12 changes: 6 additions & 6 deletions cs/test/core/Equal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -158,12 +158,12 @@ public static bool IsEqual<T>(this T left, T right) where T : class
var equal = comparerEqual.MakeGenericMethod(right.GetType());
var result = (bool)equal.Invoke(null, new object[] { left, right });

if (!result)
{
// Set breakpoint here to debug unequal test failure
var strLeft = Util.SerializeXmlString(left);
var strRight = Util.SerializeXmlString(right);
}
// Uncomment this block and set breakpoint here to debug unequal test failure
//if (!result)
//{
// var strLeft = Util.SerializeXmlString(left);
// var strRight = Util.SerializeXmlString(right);
//}

return result;
}
Expand Down

0 comments on commit f79d213

Please sign in to comment.