Skip to content

Commit 4a4df61

Browse files
authored
Disable nullability in System.Xmal unit test to fix build (#8700)
1 parent 51822b5 commit 4a4df61

22 files changed

+53
-46
lines changed

src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/AcceptedMarkupExtensionExpressionTypeAttributeTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#nullable disable
56
using Xunit;
67

78
#pragma warning disable 0618

src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/ArrayExtensionTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
4-
4+
#nullable disable
55
using System.Collections;
66
using System.Collections.Generic;
77
using Xunit;

src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/ConstructorArgumentAttributeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
4-
4+
#nullable disable
55
using Xunit;
66

77
namespace System.Windows.Markup.Tests

src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/ContentPropertyAttributeTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#nullable disable
56
using Xunit;
67

78
namespace System.Windows.Markup.Tests;

src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/ContentWrapperAttributeTests.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#nullable disable
56
using System.Collections.Generic;
67
using Xunit;
78

@@ -18,18 +19,18 @@ public void Ctor_Type(Type contentWrapper)
1819
Assert.Equal(contentWrapper, attribute.ContentWrapper);
1920
}
2021

21-
public static IEnumerable<object?[]> Equals_TestData()
22+
public static IEnumerable<object[]> Equals_TestData()
2223
{
2324
var attribute = new ContentWrapperAttribute(typeof(int));
24-
yield return new object?[] { attribute, attribute, true };
25-
yield return new object?[] { attribute, new ContentWrapperAttribute(typeof(int)), true };
26-
yield return new object?[] { attribute, new ContentWrapperAttribute(typeof(string)), false };
27-
yield return new object?[] { attribute, new ContentWrapperAttribute(null), false };
28-
yield return new object?[] { new ContentWrapperAttribute(null), new ContentWrapperAttribute(null), true };
29-
yield return new object?[] { new ContentWrapperAttribute(null), new ContentWrapperAttribute(typeof(int)), false };
30-
31-
yield return new object?[] { attribute, new object(), false };
32-
yield return new object?[] { attribute, null, false };
25+
yield return new object[] { attribute, attribute, true };
26+
yield return new object[] { attribute, new ContentWrapperAttribute(typeof(int)), true };
27+
yield return new object[] { attribute, new ContentWrapperAttribute(typeof(string)), false };
28+
yield return new object[] { attribute, new ContentWrapperAttribute(null), false };
29+
yield return new object[] { new ContentWrapperAttribute(null), new ContentWrapperAttribute(null), true };
30+
yield return new object[] { new ContentWrapperAttribute(null), new ContentWrapperAttribute(typeof(int)), false };
31+
32+
yield return new object[] { attribute, new object(), false };
33+
yield return new object[] { attribute, null, false };
3334
}
3435

3536
[Theory]

src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/DateTimeValueSerializerTests.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
4-
4+
#nullable disable
55
using System.Collections.Generic;
66
using System.Globalization;
77
using Xunit;
@@ -10,11 +10,11 @@ namespace System.Windows.Markup.Tests;
1010

1111
public class DateTimeValueSerializerTests
1212
{
13-
public static IEnumerable<object?[]> CanConvertFrom_TestData()
13+
public static IEnumerable<object[]> CanConvertFrom_TestData()
1414
{
15-
yield return new object?[] { new DateTime(), true };
16-
yield return new object?[] { new object(), false };
17-
yield return new object?[] { null, false };
15+
yield return new object[] { new DateTime(), true };
16+
yield return new object[] { new object(), false };
17+
yield return new object[] { null, false };
1818
}
1919

2020
[Theory]

src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/DependsOnAttributeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
4-
4+
#nullable disable
55
using Xunit;
66

77
namespace System.Windows.Markup.Tests;

src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/DictionaryKeyPropertyAttributeTests.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#nullable disable
56
using Xunit;
67

78
namespace System.Windows.Markup.Tests;

src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/MarkupExtensionReturnTypeAttributeTests.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// Licensed to the .NET Foundation under one or more agreements.
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
4-
4+
#nullable disable
55
using Xunit;
66

77
#pragma warning disable 0618

src/Microsoft.DotNet.Wpf/tests/UnitTests/System.Xaml.Tests/System/Windows/Markup/NameReferenceConverterTests.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5+
#nullable disable
56
using System.Collections.Generic;
67
using System.ComponentModel;
78
using System.ComponentModel.Design.Serialization;
@@ -119,13 +120,13 @@ public void ConvertFrom_InvalidValue_ThrowsInvalidOperationException(object valu
119120
Assert.Throws<InvalidOperationException>(() => converter.ConvertFrom(context, null, value));
120121
}
121122

122-
public static IEnumerable<object?[]> CanConvertTo_TestData()
123+
public static IEnumerable<object[]> CanConvertTo_TestData()
123124
{
124-
yield return new object?[] { null, null, false };
125-
yield return new object?[] { new CustomTypeDescriptorContext { GetServiceAction = serviceType => null! }, typeof(string), false };
126-
yield return new object?[] { new CustomTypeDescriptorContext { GetServiceAction = serviceType => new object() }, typeof(string), false };
127-
yield return new object?[] { new CustomTypeDescriptorContext { GetServiceAction = serviceType => new CustomXamlNameProvider() }, typeof(int), false };
128-
yield return new object?[] { new CustomTypeDescriptorContext { GetServiceAction = serviceType => new CustomXamlNameProvider() }, typeof(string), true };
125+
yield return new object[] { null, null, false };
126+
yield return new object[] { new CustomTypeDescriptorContext { GetServiceAction = serviceType => null! }, typeof(string), false };
127+
yield return new object[] { new CustomTypeDescriptorContext { GetServiceAction = serviceType => new object() }, typeof(string), false };
128+
yield return new object[] { new CustomTypeDescriptorContext { GetServiceAction = serviceType => new CustomXamlNameProvider() }, typeof(int), false };
129+
yield return new object[] { new CustomTypeDescriptorContext { GetServiceAction = serviceType => new CustomXamlNameProvider() }, typeof(string), true };
129130
}
130131

131132
[Theory]
@@ -201,7 +202,7 @@ private class CustomTypeDescriptorContext : ITypeDescriptorContext
201202

202203
public PropertyDescriptor PropertyDescriptor => throw new NotImplementedException();
203204

204-
public Func<Type, object>? GetServiceAction { get; set; }
205+
public Func<Type, object> GetServiceAction { get; set; }
205206

206207
public object GetService(Type serviceType)
207208
{
@@ -222,7 +223,7 @@ private class CustomXamlNameResolver : IXamlNameResolver
222223
{
223224
public bool IsFixupTokenAvailable => throw new NotImplementedException();
224225

225-
public Func<string, object>? ResolveAction { get; set; }
226+
public Func<string, object> ResolveAction { get; set; }
226227

227228
public object Resolve(string name)
228229
{
@@ -238,7 +239,7 @@ public object Resolve(string name)
238239

239240
public object GetFixupToken(IEnumerable<string> names) => throw new NotImplementedException();
240241

241-
public Func<IEnumerable<string>, bool, object>? GetFixupTokenAction { get; set; }
242+
public Func<IEnumerable<string>, bool, object> GetFixupTokenAction { get; set; }
242243

243244
public object GetFixupToken(IEnumerable<string> names, bool canAssignDirectly)
244245
{
@@ -262,7 +263,7 @@ public event EventHandler OnNameScopeInitializationComplete
262263

263264
private class CustomXamlNameProvider : IXamlNameProvider
264265
{
265-
public Func<object, string>? GetNameAction { get; set; }
266+
public Func<object, string> GetNameAction { get; set; }
266267

267268
public string GetName(object value)
268269
{

0 commit comments

Comments
 (0)