Skip to content

Commit

Permalink
Upgrade build SDK to 5.0 preview8
Browse files Browse the repository at this point in the history
  • Loading branch information
smitpatel committed Aug 26, 2020
1 parent da209f4 commit 29a0753
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 112 deletions.
2 changes: 1 addition & 1 deletion docs/getting-and-building-the-code.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ Following instructions are for current **main** branch only. For building releas

## Prerequisites

EF Core does not generally need any prerequisites installed to build the code. However, the SQL Server tests require that SQL Server LocalDb be installed. For this, and for a rich developer experience, install a recent [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) edition. This has been most recently tested with the 16.1.6 Community Edition, installing the "ASP.NET and web development" workload.
EF Core does not generally need any prerequisites installed to build the code. However, the SQL Server tests require that SQL Server LocalDb be installed. For this, and for a rich developer experience, install [Visual Studio 2019](https://visualstudio.microsoft.com/downloads/) 16.8.0 preview2 or higher version with the "ASP.NET and web development" workload.

## Clone the repository

Expand Down
2 changes: 1 addition & 1 deletion eng/helix.proj
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@

<IncludeDotNetCli>true</IncludeDotNetCli>
<DotNetCliPackageType>sdk</DotNetCliPackageType>
<DotNetCliVersion>5.0.100-preview.7.20366.6</DotNetCliVersion>
<DotNetCliVersion>5.0.100-preview.8.20417.9</DotNetCliVersion>

<EnableAzurePipelinesReporter>true</EnableAzurePipelinesReporter>
<FailOnTestFailure>true</FailOnTestFailure>
Expand Down
8 changes: 4 additions & 4 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
{
"tools": {
"dotnet": "5.0.100-preview.7.20366.6",
"dotnet": "5.0.100-preview.8.20417.9",
"runtimes": {
"dotnet": [
"3.1.6"
"3.1.7"
],
"aspnetcore": [
"3.1.6"
"3.1.7"
]
}
},
"sdk": {
"version": "5.0.100-preview.7.20366.6",
"version": "5.0.100-preview.8.20417.9",
"allowPrerelease": true,
"rollForward": "latestMajor"
},
Expand Down
1 change: 1 addition & 0 deletions src/EFCore.Cosmos/EFCore.Cosmos.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.1.118" PrivateAssets="All" />
<PackageReference Include="Microsoft.Azure.Cosmos" Version="3.12.0" />
<PackageReference Include="Microsoft.Azure.Cosmos.Direct" Version="3.11.4" />
</ItemGroup>

<ItemGroup>
Expand Down
10 changes: 10 additions & 0 deletions test/Directory.Build.targets
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<Project>
<Import Project="..\Directory.Build.targets" />

<ItemGroup>
<!-- Using xunit.core and .assert instead of the main package because compilation fails due to warnings triggered by xunit.analyzers. -->
<PackageReference Remove="xunit" />
<PackageReference Include="xunit.core" Version="$(XUnitVersion)" />
<PackageReference Include="xunit.assert" Version="$(XUnitVersion)" />
</ItemGroup>
</Project>
27 changes: 0 additions & 27 deletions test/EFCore.Design.Tests/DesignExceptionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using Microsoft.EntityFrameworkCore.Design;
using Xunit;

Expand Down Expand Up @@ -33,30 +31,5 @@ public void OperationException_exposes_public_string_and_inner_exception_constru
Assert.Equal("Foo", ex.Message);
Assert.Same(inner, ex.InnerException);
}

[ConditionalFact]
public void Deserialized_OperationException_can_be_serialized_and_deserialized_again()
{
var transportedException = SerializeAndDeserialize(
SerializeAndDeserialize(
new OperationException(
"But somehow the vital connection is made",
new Exception("Bang!"))));

Assert.Equal("But somehow the vital connection is made", transportedException.Message);
Assert.Equal("Bang!", transportedException.InnerException.Message);
}

private TException SerializeAndDeserialize<TException>(TException exception)
where TException : Exception
{
var stream = new MemoryStream();
var formatter = new BinaryFormatter();

formatter.Serialize(stream, exception);
stream.Seek(0, SeekOrigin.Begin);

return (TException)formatter.Deserialize(stream);
}
}
}
79 changes: 0 additions & 79 deletions test/EFCore.Tests/ExceptionTest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// Licensed under the Apache License, Version 2.0. See License.txt in the project root for license information.

using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
using Microsoft.EntityFrameworkCore.ChangeTracking;
using Microsoft.EntityFrameworkCore.ChangeTracking.Internal;
using Microsoft.EntityFrameworkCore.Metadata;
Expand Down Expand Up @@ -42,19 +40,6 @@ public void RetryLimitExceededException_exposes_public_string_and_inner_exceptio
Assert.Same(inner, ex.InnerException);
}

[ConditionalFact]
public void Deserialized_RetryLimitExceededException_can_be_serialized_and_deserialized_again()
{
var transportedException = SerializeAndDeserialize(
SerializeAndDeserialize(
new RetryLimitExceededException(
"But somehow the vital connection is made",
new Exception("Bang!"))));

Assert.Equal("But somehow the vital connection is made", transportedException.Message);
Assert.Equal("Bang!", transportedException.InnerException.Message);
}

[ConditionalFact]
public void DbUpdateException_exposes_public_empty_constructor()
{
Expand All @@ -78,31 +63,6 @@ public void DbUpdateException_exposes_public_string_and_inner_exception_construc
Assert.Same(inner, ex.InnerException);
}

[ConditionalFact]
public void Deserialized_DbUpdateException_can_be_serialized_and_deserialized_again()
{
var transportedException = SerializeAndDeserialize(
SerializeAndDeserialize(
new DbUpdateException("But somehow the vital connection is made")));

Assert.Equal("But somehow the vital connection is made", transportedException.Message);
}

[ConditionalFact]
public void Deserialized_DbUpdateException_can_be_serialized_and_deserialized_again_with_entries()
{
var transportedException = SerializeAndDeserialize(
SerializeAndDeserialize(
new DbUpdateException(
"But somehow the vital connection is made",
new Exception("Bang!"),
new IUpdateEntry[] { new FakeUpdateEntry() })));

Assert.Equal("But somehow the vital connection is made", transportedException.Message);
Assert.Equal("Bang!", transportedException.InnerException.Message);
Assert.Empty(transportedException.Entries); // Because the entries cannot be serialized
}

[ConditionalFact]
public void DbUpdateConcurrencyException_exposes_public_empty_constructor()
{
Expand All @@ -126,33 +86,6 @@ public void DbUpdateConcurrencyException_exposes_public_string_and_inner_excepti
Assert.Same(inner, ex.InnerException);
}

[ConditionalFact]
public void Deserialized_DbUpdateConcurrencyException_can_be_serialized_and_deserialized_again()
{
var transportedException = SerializeAndDeserialize(
SerializeAndDeserialize(
new DbUpdateConcurrencyException("But somehow the vital connection is made")));

Assert.Equal(
"But somehow the vital connection is made",
transportedException.Message);
}

[ConditionalFact]
public void Deserialized_DbUpdateConcurrencyException_can_be_serialized_and_deserialized_again_with_entries()
{
var transportedException = SerializeAndDeserialize(
SerializeAndDeserialize(
new DbUpdateConcurrencyException(
"But somehow the vital connection is made",
new Exception("Bang!"),
new IUpdateEntry[] { new FakeUpdateEntry() })));

Assert.Equal("But somehow the vital connection is made", transportedException.Message);
Assert.Equal("Bang!", transportedException.InnerException.Message);
Assert.Empty(transportedException.Entries); // Because the entries cannot be serialized
}

private class FakeUpdateEntry : IUpdateEntry
{
public void SetOriginalValue(IProperty property, object value)
Expand Down Expand Up @@ -219,17 +152,5 @@ private static IEntityType CreateEntityType()
model.FinalizeModel();
return entityType;
}

private TException SerializeAndDeserialize<TException>(TException exception)
where TException : Exception
{
var stream = new MemoryStream();
var formatter = new BinaryFormatter();

formatter.Serialize(stream, exception);
stream.Seek(0, SeekOrigin.Begin);

return (TException)formatter.Deserialize(stream);
}
}
}

0 comments on commit 29a0753

Please sign in to comment.