Skip to content

Commit e12e476

Browse files
authored
Update test matrix to include .NET Standard 2.0 testing (#638)
1 parent d13babb commit e12e476

File tree

9 files changed

+77
-17
lines changed

9 files changed

+77
-17
lines changed

Diff for: Directory.Build.props

+17-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- DevFramework46: .NET Framework 4.6
1313
- DevCore11: .NET Core 1.1
1414
- DevCore21: .NET Core 2.1
15+
- DevCore30: .NET Core 3.0
1516
- All: Will build for all platforms
1617
-->
1718
<ProjectLoadStyle Condition=" '$(ProjectLoadStyle)' == '' ">DevCore21</ProjectLoadStyle>
@@ -32,6 +33,7 @@
3233
<AssetsTargetFrameworks>net452</AssetsTargetFrameworks>
3334
<!-- BenchmarkDotNet only supports .NET Standard 2.0-->
3435
<BenchmarkTargetFrameworks>net461</BenchmarkTargetFrameworks>
36+
<SamplesFrameworks>net46</SamplesFrameworks>
3537
</PropertyGroup>
3638
</When>
3739
<When Condition=" '$(ProjectLoadStyle)' == 'DevFramework46' ">
@@ -40,6 +42,7 @@
4042
<TestTargetFrameworks>net46</TestTargetFrameworks>
4143
<AssetsTargetFrameworks>net452</AssetsTargetFrameworks>
4244
<BenchmarkTargetFrameworks>net461</BenchmarkTargetFrameworks>
45+
<SamplesFrameworks>net46</SamplesFrameworks>
4346
</PropertyGroup>
4447
</When>
4548
<When Condition=" '$(ProjectLoadStyle)' == 'DevCore11' ">
@@ -49,6 +52,7 @@
4952
<AssetsTargetFrameworks>netstandard1.3</AssetsTargetFrameworks>
5053
<!-- BenchmarkDotNet only supports .NET Standard 2.0-->
5154
<BenchmarkTargetFrameworks>netcoreapp2.1</BenchmarkTargetFrameworks>
55+
<SamplesFrameworks>netcoreapp1.1</SamplesFrameworks>
5256
</PropertyGroup>
5357
</When>
5458
<When Condition=" '$(ProjectLoadStyle)' == 'DevCore21' ">
@@ -57,6 +61,16 @@
5761
<TestTargetFrameworks>netcoreapp2.1</TestTargetFrameworks>
5862
<AssetsTargetFrameworks>netstandard1.3</AssetsTargetFrameworks>
5963
<BenchmarkTargetFrameworks>netcoreapp2.1</BenchmarkTargetFrameworks>
64+
<SamplesFrameworks>netcoreapp2.1</SamplesFrameworks>
65+
</PropertyGroup>
66+
</When>
67+
<When Condition=" '$(ProjectLoadStyle)' == 'DevCore30' ">
68+
<PropertyGroup>
69+
<ProductTargetFrameworks>netstandard2.0</ProductTargetFrameworks>
70+
<TestTargetFrameworks>netcoreapp3.0</TestTargetFrameworks>
71+
<AssetsTargetFrameworks>netstandard1.3</AssetsTargetFrameworks>
72+
<BenchmarkTargetFrameworks>netcoreapp3.0</BenchmarkTargetFrameworks>
73+
<SamplesFrameworks>netcoreapp3.0</SamplesFrameworks>
6074
</PropertyGroup>
6175
</When>
6276
<When Condition=" '$(ProjectLoadStyle)' == 'All' ">
@@ -67,8 +81,9 @@
6781
-->
6882
<ProductTargetFrameworks>netstandard1.3;netstandard2.0;net35;net40;net46</ProductTargetFrameworks>
6983
<AssetsTargetFrameworks>net452;netstandard1.3</AssetsTargetFrameworks>
70-
<TestTargetFrameworks>net452;net46;netcoreapp1.1;netcoreapp2.1</TestTargetFrameworks>
71-
<BenchmarkTargetFrameworks>net461;netcoreapp2.1</BenchmarkTargetFrameworks>
84+
<TestTargetFrameworks>net452;net46;netcoreapp1.1;netcoreapp2.1;netcoreapp3.0</TestTargetFrameworks>
85+
<BenchmarkTargetFrameworks>net461;netcoreapp2.1;netcoreapp3.0</BenchmarkTargetFrameworks>
86+
<SamplesFrameworks>net46;netcoreapp2.1;netcoreapp3.0</SamplesFrameworks>
7287

7388
<!-- Must disable this due to https://github.com/NuGet/Home/issues/7414 so .NET Core 1.x will build -->
7489
<DisableImplicitNuGetFallbackFolder>true</DisableImplicitNuGetFallbackFolder>

Diff for: README.md

+7-6
Original file line numberDiff line numberDiff line change
@@ -70,12 +70,13 @@ WindowsBase or System.IO.Packaging
7070

7171
There is a known issue in `WindowsBase` that causes crashes when handling large data sources. This is fixed in later versions of the library, based on the platform availability of the `System.IO.Packaging` package. When possible, we use this package instead of `WindowsBase`. This not only fixes the crash seen by some users, but is available cross platform. However, it is only available on .NET Standard 1.3+ and .NET Framework 4.6+. For this reason, the NuGet package has multiple targets to bring in, when possible. The targets are determined by NuGet at installation and build time and are listed in the table below.
7272

73-
| Platform | System.IO.Packing Source | Tested by |
74-
| -------- | ------------------------ | ------------- |
75-
| .NET 3.5 | WindowsBase | N/A |
76-
| .NET 4.0 | WindowsBase | .NET 4.5.2 |
77-
| .NET 4.6 | NuGet | .NET 4.6 |
78-
| .NET Standard | NuGet | .NET Core 1.0 |
73+
| Platform | System.IO.Packing Source | Tested by |
74+
| ----------------- | ------------------------ | ---------------------------- |
75+
| .NET 3.5 | WindowsBase | N/A |
76+
| .NET 4.0 | WindowsBase | .NET 4.5.2 |
77+
| .NET 4.6 | NuGet | .NET 4.6 |
78+
| .NET Standard 1.3 | NuGet | .NET Core 1.1 |
79+
| .NET Standard 2.0 | NuGet | .NET Core 2.1, .NET Core 3.0 |
7980

8081
Keep in mind, though, that the `System.IO.Packaging` on .NET 4.6+ is simply a facade over WindowsBase, and thus everything running on .NET 4.6 will use WindowsBase instead of the newer implementation.
8182

Diff for: build/azure-pipelines.yml

+5
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,8 @@ stages:
3131
name: net461
3232
- tfm: netcoreapp2.1
3333
name: netcoreapp2_1
34+
- tfm: netcoreapp3.0
35+
name: netcoreapp3_0
3436
dependsOn: Build
3537
condition: succeeded()
3638

@@ -45,8 +47,11 @@ stages:
4547
name: net46
4648
- tfm: netcoreapp1.1
4749
name: netcoreapp1_1
50+
runtime: '1.1.14'
4851
- tfm: netcoreapp2.1
4952
name: netcoreapp2_1
53+
- tfm: netcoreapp3.0
54+
name: netcoreapp3_0
5055
dependsOn: Build
5156
condition: succeeded()
5257

Diff for: build/build.yml

+2-1
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,13 @@ steps:
44
inputs:
55
packageType: 'sdk'
66
useGlobalJson: true
7+
78
- task: PowerShell@2
89
displayName: 'Update version'
910
inputs:
1011
targetType: 'inline'
1112
script: |
12-
dotnet tool install --global GitVersion.Tool --version 5.0.1
13+
dotnet tool install --global GitVersion.Tool --version 5.1.2
1314
dotnet gitversion /output buildserver /nofetch
1415
1516
- task: VSBuild@1

Diff for: build/test.yml

+6
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,12 @@ jobs:
1010
steps:
1111
- checkout: none
1212

13+
- ${{ if framework.runtime }}:
14+
- task: UseDotNet@2
15+
displayName: 'Install SDK'
16+
inputs:
17+
version: '${{ framework.runtime }}'
18+
1319
- download: current
1420
artifact: build
1521
patterns: '*.Tests/${{ framework.tfm }}/publish/**/*'

Diff for: global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
22
"sdk": {
3-
"version": "2.1.801"
3+
"version": "3.0.100"
44
}
55
}

Diff for: samples/IsolatedStorageExceptionWorkaround/IsolatedStorageExceptionWorkaround.csproj

+15-2
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,26 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFramework>net46</TargetFramework>
5+
<TargetFrameworks>$(SamplesFrameworks)</TargetFrameworks>
66
<IsPackable>false</IsPackable>
7+
<NoWarn>$(NoWarn);CA1303</NoWarn>
78
</PropertyGroup>
89

10+
<Choose>
11+
<When Condition=" '$(TargetFramework)' == 'net46' ">
12+
<ItemGroup>
13+
<Compile Remove="Program.Empty.cs" />
14+
</ItemGroup>
15+
</When>
16+
<Otherwise>
17+
<ItemGroup >
18+
<Compile Remove="Program.cs" />
19+
</ItemGroup>
20+
</Otherwise>
21+
</Choose>
22+
923
<ItemGroup>
1024
<PackageReference Include="DocumentFormat.OpenXml" Version="2.9.1" />
1125
</ItemGroup>
1226

13-
1427
</Project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Copyright (c) Microsoft. All rights reserved.
2+
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
3+
4+
using System;
5+
6+
namespace IsolatedStorageExceptionWorkaround
7+
{
8+
internal class Program
9+
{
10+
private static void Main()
11+
{
12+
Console.WriteLine("Sample only applicable on .NET Framework");
13+
}
14+
}
15+
}

Diff for: test/DocumentFormat.OpenXml.Tests/ofapiTest/OpenXmlValidatorTest.cs

+9-5
Original file line numberDiff line numberDiff line change
@@ -1033,6 +1033,7 @@ public void FloatAttributeValidationTest()
10331033
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
10341034
Assert.Equal("The attribute 'val' has invalid value 'abc'. The string 'abc' is not a valid 'Single' value.", actual.First().Description);
10351035

1036+
#if !NETCOREAPP3_0
10361037
// float overflow
10371038
element.Val.InnerText = "-3.402823e39";
10381039
actual = O12Validator.Validate(element);
@@ -1048,6 +1049,7 @@ public void FloatAttributeValidationTest()
10481049
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
10491050
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
10501051
Assert.Equal("The attribute 'val' has invalid value '3.402823e39'. The string '3.402823e39' is not a valid 'Single' value.", actual.First().Description);
1052+
#endif
10511053
}
10521054

10531055
/// <summary>
@@ -1096,6 +1098,7 @@ public void DoubleAttributeValidationTest()
10961098
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
10971099
Assert.Equal("The attribute 'val' has invalid value 'abc'. The string 'abc' is not a valid 'Double' value.", actual.First().Description);
10981100

1101+
#if !NETCOREAPP3_0 // Fails due to https://github.com/dotnet/coreclr/issues/27898
10991102
// double overflow
11001103
element.Val.InnerText = "-1.79769313486232e309";
11011104
actual = O12Validator.Validate(element);
@@ -1111,6 +1114,7 @@ public void DoubleAttributeValidationTest()
11111114
Assert.Equal(ValidationErrorType.Schema, actual.First().ErrorType);
11121115
Assert.Equal("Sch_AttributeValueDataTypeDetailed", actual.First().Id);
11131116
Assert.Equal("The attribute 'val' has invalid value '1.79769313486232e309'. The string '1.79769313486232e309' is not a valid 'Double' value.", actual.First().Description);
1117+
#endif
11141118

11151119
element.Val = 0;
11161120
actual = O12Validator.Validate(element);
@@ -2796,9 +2800,9 @@ public void TrueFalseBlankValueValidationTest2()
27962800
Assert.Equal("The attribute 'invx' has invalid value 'F'. The Enumeration constraint failed.", actual.First().Description);
27972801
}
27982802

2799-
#endregion
2803+
#endregion
28002804

2801-
#region unit test with test file data
2805+
#region unit test with test file data
28022806

28032807
/// <summary>
28042808
///A test for Validate(Stream) - validating Spreadsheet package.
@@ -3207,9 +3211,9 @@ public void MaxErrorsTest()
32073211
}
32083212
}
32093213

3210-
#endregion
3214+
#endregion
32113215

3212-
#region new test regarding O14 support
3216+
#region new test regarding O14 support
32133217

32143218
/// <summary>
32153219
/// A test for the newly added element.
@@ -3776,7 +3780,7 @@ public void NamespaceTest()
37763780
Assert.Empty(actual);
37773781
}
37783782

3779-
#endregion
3783+
#endregion
37803784

37813785
/// <summary>
37823786
///A test for Validate(OpenXmlPackage) - validating a document opened with a different version.

0 commit comments

Comments
 (0)