From 380ff2e702b3c1ed29d7108e043253b0d4ffbe8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 31 Jul 2025 17:46:52 +0200 Subject: [PATCH 01/10] Remove pinned XunitAnalyzersVersion from Versions.props Fixes https://github.com/dotnet/runtime/issues/97088 --- eng/Versions.props | 2 -- 1 file changed, 2 deletions(-) diff --git a/eng/Versions.props b/eng/Versions.props index 8cf2ac46aceb10..97c86222f1c7c9 100644 --- a/eng/Versions.props +++ b/eng/Versions.props @@ -100,8 +100,6 @@ 10.0.0-beta.25367.101 10.0.0-beta.25367.101 10.0.0-beta.25367.101 - - 1.4.0 6.0.0-preview.1.102 From 483c77db6ff211a99ddf3a527a6ac56551663a54 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 31 Jul 2025 17:21:54 +0000 Subject: [PATCH 02/10] Fix xUnit1012: Null should not be used for value type parameters --- .../HttpClientHandlerTest.Authentication.cs | 4 +-- .../Cryptography/PbeParametersTests.cs | 4 +-- .../System/IO/PathInternal.Unix.Tests.cs | 2 +- .../System/IO/PathInternal.Windows.Tests.cs | 2 +- .../Common/tests/Tests/System/StringTests.cs | 18 +++++----- .../tests/IniConfigurationExtensionsTest.cs | 2 +- .../tests/JsonConfigurationExtensionsTest.cs | 2 +- .../MetricsBuilderExtensionsRulesTests.cs | 8 ++--- .../PatternContextRaggedTests.cs | 2 +- .../CurrentPathSegmentTests.cs | 2 +- .../ConsoleLoggerTest.cs | 2 +- .../tests/Common/FormattedLogValuesTest.cs | 8 ++--- .../Generated/OptionsValidationTests.cs | 2 +- .../CompilerServices/DecimalTypeTests.cs | 2 +- .../tests/CompilerServices/DoubleTypeTests.cs | 2 +- .../tests/CompilerServices/VersionedTests.cs | 8 ++--- .../tests/ConversionTests.cs | 12 +++---- .../tests/ErrObjectTests.cs | 2 +- .../tests/InformationTests.cs | 14 ++++---- .../tests/InteractionTests.cs | 2 +- .../VisualBasic/ComClassAttributeTests.cs | 6 ++-- .../MyGroupCollectionAttributeTests.cs | 2 +- .../tests/StringTypeTests.cs | 8 ++--- .../tests/StringsTests.cs | 36 +++++++++---------- .../CodeDom/CodeAttributeArgumentTests.cs | 2 +- .../CodeDom/CodeAttributeDeclarationTests.cs | 2 +- .../System/CodeDom/CodeChecksumPragmaTests.cs | 2 +- .../CodeDelegateCreateExpressionTests.cs | 2 +- .../CodeEventReferenceExpressionTests.cs | 2 +- .../CodeFieldReferenceExpressionTests.cs | 2 +- .../tests/System/CodeDom/CodeGotoStatement.cs | 4 +-- .../CodePropertyReferenceExpressionTests.cs | 2 +- .../CodeDom/CodeSnippetTypeMemberTests.cs | 4 +-- .../System/CodeDom/CodeTypeMemberTestBase.cs | 2 +- .../CodeTypeParameterCollectionTests.cs | 2 +- .../CodeTypeReferenceCollectionTests.cs | 2 +- .../System/CodeDom/CodeTypeReferenceTests.cs | 4 +-- .../CodeDom/Compiler/CodeCompilerTests.cs | 2 +- .../Compiler/CodeGeneratorOptionsTests.cs | 4 +-- .../CodeDom/Compiler/CodeGeneratorTests.cs | 36 +++++++++---------- .../CodeDom/Compiler/CompilerErrorTests.cs | 2 +- .../CodeDom/Compiler/CompilerResultsTests.cs | 2 +- .../System/CodeDom/TempFileCollectionTests.cs | 8 ++--- .../tests/CaseInsensitiveComparerTests.cs | 8 ++--- .../tests/ComparerTests.cs | 2 +- .../StringDictionary.ContainsValueTests.cs | 2 +- ...Generic.Tests.ConcurrentAccessDetection.cs | 4 +-- .../tests/DoWorkEventArgsTests.cs | 4 +-- .../tests/ProgressChangedEventArgsTests.cs | 2 +- .../tests/RunWorkerCompletedEventArgsTests.cs | 2 +- .../ComponentModel/CategoryAttributeTests.cs | 4 +-- .../System/ComponentModel/ComponentTests.cs | 4 +-- .../DescriptionAttributeTests.cs | 4 +-- .../ComponentModel/DesignerAttributeTests.cs | 2 +- .../DesignerCategoryAttributeTests.cs | 2 +- .../DisplayNameAttributeTests.cs | 4 +-- .../ComponentModel/EditorAttributeTests.cs | 2 +- .../InitializationEventAttributeTests.cs | 2 +- .../InvalidEnumArgumentExceptionTests.cs | 4 +-- .../tests/AddingNewEventArgsTests.cs | 2 +- .../tests/AmbientValueAttributeTests.cs | 6 ++-- .../tests/ArrayConverterTests.cs | 2 +- .../tests/BindingListTests.cs | 2 +- .../tests/CollectionChangedEventArgsTests.cs | 2 +- .../ComplexBindingPropertiesAttributeTests.cs | 4 +-- .../tests/CustomTypeDescriptorTests.cs | 6 ++-- .../DefaultBindingPropertyAttributeTests.cs | 2 +- .../tests/DefaultEventAttributeTests.cs | 2 +- .../tests/DefaultPropertyAttributeTests.cs | 2 +- .../Design/DesignerOptionServiceTests.cs | 4 +-- .../tests/Design/DesignerTransactionTests.cs | 2 +- .../tests/Design/DesignerVerbTests.cs | 6 ++-- .../Design/DesigntimeLicenseContextTests.cs | 2 +- .../Serialization/InstanceDescriptorTests.cs | 6 ++-- .../ResolveNameEventArgsTests.cs | 4 +-- .../RootDesignerSerializerAttributeTests.cs | 4 +-- .../tests/Design/ServiceContainerTests.cs | 2 +- .../tests/LicenseExceptionTests.cs | 2 +- .../tests/LicenseProviderAttributeTests.cs | 4 +-- .../LookupBindingPropertiesAttributeTests.cs | 2 +- .../tests/MemberDescriptorTests.cs | 20 +++++------ .../tests/NestedContainerTests.cs | 6 ++-- .../tests/ProvidePropertyAttributeTests.cs | 4 +-- .../tests/RefreshEventArgsTests.cs | 2 +- ...endedProtectionPolicyTypeConverterTests.cs | 2 +- .../tests/SyntaxCheckTests.cs | 6 ++-- .../tests/ToolboxItemFilterAttributeTests.cs | 8 ++--- .../tests/TypeDescriptionProviderTests.cs | 18 +++++----- .../tests/WarningExceptionTests.cs | 4 +-- .../tests/ExportAttributeTests.cs | 6 ++-- .../tests/ExportMetadataAttributeTests.cs | 2 +- .../tests/ImportAttributeTests.cs | 2 +- .../tests/ImportManyAttributeTests.cs | 2 +- .../ImportMetadataConstraintAttributeTests.cs | 2 +- .../tests/PartMetadataAttributeTests.cs | 2 +- .../tests/SharedAttributeTests.cs | 2 +- .../Hosting/Core/CompositionHostTests.cs | 2 +- .../Composition/CompositionContextTests.cs | 4 +-- .../Hosting/Core/CompositionContractTests.cs | 4 +-- .../Configuration/ConfigPathUtilityTests.cs | 2 +- .../System/Configuration/StringUtilTests.cs | 8 ++--- .../SubclassTypeValidatorAttributeTests.cs | 2 +- .../Configuration/ValidatiorUtilsTests.cs | 6 ++-- .../SystemDrawingSectionTests.cs | 2 +- src/libraries/System.Console/tests/Color.cs | 2 +- .../tests/ActivityTests.cs | 2 +- .../tests/PerformanceDataTests.cs | 6 ++-- .../tests/ProcessStartInfoTests.cs | 12 +++---- .../tests/ProcessTests.Unix.cs | 2 +- .../tests/ProcessTests.cs | 2 +- .../tests/StackFrameTests.cs | 4 +-- .../tests/XmlWriterTraceListenerTests.cs | 4 +-- .../tests/PrincipalContextTests.cs | 16 ++++----- .../tests/AddRequestTests.cs | 4 +-- .../tests/CompareRequestTests.cs | 4 +-- .../tests/CrossDomainMoveControlTests.cs | 2 +- .../tests/DeleteRequestTests.cs | 2 +- .../tests/DirectoryAttributeTests.cs | 4 +-- .../tests/DirectoryControlTests.cs | 2 +- .../tests/DsmlAuthRequestTests.cs | 2 +- .../tests/ExtendedRequestTests.cs | 4 +-- .../tests/LdapConnectionTests.cs | 2 +- .../tests/LdapDirectoryIdentifierTests.cs | 10 +++--- .../tests/ModifyDNRequestTests.cs | 2 +- .../tests/SearchRequestTests.cs | 2 +- .../tests/SortKeyTests.cs | 2 +- .../ActiveDirectory/DirectoryContextTests.cs | 4 +-- .../DirectoryServices/DirectoryEntryTests.cs | 8 ++--- .../DirectorySynchronizationTests.cs | 6 ++-- .../DirectoryVirtualListViewTests.cs | 2 +- .../tests/ReadExactTypesTests.cs | 2 +- ...File.CreateFromDirectory.File.Roundtrip.cs | 4 +-- ...CreateFromDirectoryAsync.File.Roundtrip.cs | 4 +-- .../tests/Args.FileSystemEventArgs.cs | 10 +++--- .../tests/Args.RenamedEventArgs.cs | 6 ++-- .../tests/MemoryMappedFile.CreateNew.Tests.cs | 4 +-- .../BinaryOperators/Assignment/Assign.cs | 2 +- .../StandardFormatTests.cs | 4 +-- .../tests/Span/EnumerateLines.cs | 2 +- .../HttpClientHandlerTest.Http2.cs | 2 +- .../tests/FunctionalTests/HttpClientTest.cs | 4 +-- .../Headers/CacheControlHeaderValueTest.cs | 2 +- .../UnitTests/Headers/HttpHeadersTest.cs | 4 +-- .../Headers/NameValueHeaderValueTest.cs | 2 +- .../UnitTests/HttpEnvironmentProxyTest.cs | 2 +- .../tests/HttpListenerAuthenticationTests.cs | 2 +- .../tests/HttpListenerRequestTests.cs | 8 ++--- .../HttpListenerResponseTests.Headers.cs | 4 +-- .../tests/HttpListenerResponseTests.cs | 2 +- .../Functional/ContentDispositionTest.cs | 4 +-- .../tests/Functional/ContentTypeTest.cs | 4 +-- .../Functional/SmtpClientSendMailTest.cs | 2 +- .../SmtpClientSpecifiedPickupDirectoryTest.cs | 2 +- .../tests/Functional/SmtpClientTest.cs | 2 +- .../tests/FunctionalTests/PingTest.cs | 4 +-- .../tests/FunctionalTests/CookieTest.cs | 2 +- .../tests/AuthorizationTest.cs | 6 ++-- .../SslAuthenticationOptionsTests.cs | 2 +- .../tests/FunctionalTests/KeepAliveTest.cs | 2 +- .../tests/WebClientTest.cs | 2 +- .../tests/WebHeaderCollectionTest.cs | 8 ++--- .../NotifyCollectionChangedEventArgsTests.cs | 12 +++---- .../DataErrorsChangedEventArgsTests.cs | 2 +- .../PropertyChangedEventArgsTests.cs | 2 +- .../PropertyChangingEventArgsTests.cs | 2 +- .../Markup/ValueSerializerAttributeTests.cs | 4 +-- .../tests/FunctionalTests/UriBuilderTests.cs | 22 ++++++------ .../tests/FunctionalTests/UriTests.cs | 4 +-- .../tests/Properties/NamespaceAccessors.cs | 8 ++--- .../TC_SchemaSet_AllowXmlAttributes.cs | 2 +- .../XmlSchemaSet/TC_SchemaSet_Imports.cs | 12 +++---- .../ValidateAttribute.cs | 2 +- .../ValidateAttribute_String.cs | 2 +- .../XmlSchemaValidatorApi/ValidateElement.cs | 2 +- .../tests/CustomAttributeBuilderTests.cs | 4 +-- .../tests/Label/LabelEquals.cs | 2 +- .../SignatureHelperAddArgument.cs | 2 +- .../tests/DynamicMethodCtor.cs | 4 +-- .../tests/DynamicMethodToString.cs | 2 +- ...epParameterBuilderSetBaseTypeConstraint.cs | 2 +- .../ModuleBuilder/ModuleBuilderDefineEnum.cs | 2 +- .../TypeBuilder/TypeBuilderDefineEvent.cs | 2 +- .../TypeBuilderDefineNestedType.cs | 2 +- .../Metadata/TypeNameParserHelpersTests.cs | 2 +- .../System.Runtime.Caching/MemoryCacheTest.cs | 16 ++++----- .../RequiredAttributeAttributeTests.cs | 2 +- .../InteropServices/ArrayWithOffsetTests.cs | 2 +- .../InteropServices/BStrWrapperTests.cs | 4 +-- .../InteropServices/CoClassAttributeTests.cs | 2 +- .../ComAliasNameAttributeTests.cs | 2 +- .../ComDefaultInterfaceAttributeTests.cs | 2 +- .../ComEventInterfaceAttributeTests.cs | 2 +- .../ComSourceInterfacesAttributeTests.cs | 2 +- .../ComVariantMarshallerTests.cs | 4 +-- .../DefaultParameterValueAttributeTests.cs | 2 +- .../DllImportAttributeTests.cs | 2 +- .../InteropServices/GuidAttributeTests.cs | 2 +- .../InteropServices/HandleCollectorTests.cs | 4 +-- .../Runtime/InteropServices/HandleRefTests.cs | 2 +- .../ImportedFromTypeLibAttributeTests.cs | 2 +- .../LibraryImportAttributeTests.cs | 2 +- ...gedToNativeComInteropStubAttributeTests.cs | 2 +- .../Marshal/BindToMonikerTests.cs | 2 +- .../InteropServices/ProgIdAttributeTests.cs | 2 +- .../TypeIdentifierAttributeTests.cs | 2 +- .../InteropServices/UnknownWrapperTests.cs | 2 +- .../InteropServices/VariantWrapperTests.cs | 2 +- .../ContractNamespaceAttributeTests.cs | 4 +-- .../DataContractAttributeTests.cs | 4 +-- .../Serialization/DataMemberAttributeTests.cs | 2 +- .../Serialization/EnumMemberAttributeTests.cs | 2 +- .../Serialization/KnownTypeAttributeTests.cs | 4 +-- .../DebuggerDisplayAttributeTests.cs | 8 ++--- .../DebuggerTypeProxyAttributeTests.cs | 4 +-- .../DebuggerVisualizerAttributeTests.cs | 8 ++--- .../Compiler/GeneratedCodeAttributeTests.cs | 2 +- .../SuppressMessageAttributeTests.cs | 2 +- .../GetStringComparerTests.cs | 2 +- .../CultureInfo/CultureInfoCurrentCulture.cs | 2 +- .../CultureInfo/CultureInfoGetFormat.cs | 2 +- .../File/ChangeExtension.cs | 2 +- .../System.IO.Tests/IndentedTextWriter.cs | 2 +- .../AssemblyNameTests.cs | 6 ++-- .../DefaultBinderTests.cs | 2 +- .../System.Reflection.Tests/FieldInfoTests.cs | 2 +- .../MethodInfoTests.cs | 2 +- .../ParameterInfoTests.cs | 4 +-- .../System.Reflection.Tests/TypeInfoTests.cs | 8 ++--- .../System/Environment.ProcessorCount.cs | 2 +- .../System/IO/PathTests.cs | 2 +- .../System/AppContext/AppContextTests.cs | 2 +- .../System/ArgumentNullExceptionTests.cs | 2 +- .../System.Runtime.Tests/System/ArrayTests.cs | 4 +-- .../System/BooleanTests.cs | 4 +-- .../System.Runtime.Tests/System/ByteTests.cs | 4 +-- .../System.Runtime.Tests/System/CharTests.cs | 6 ++-- .../System/DateTimeTests.cs | 2 +- .../ConstantExpectedAttributeTests.cs | 6 ++-- .../DynamicDependencyAttributeTests.cs | 10 +++--- .../ExperimentalAttributeTests.cs | 4 +-- .../RequiresAssemblyFilesAttributeTests.cs | 6 ++-- .../RequiresDynamicCodeAttributeTests.cs | 2 +- .../RequiresUnreferencedCodeAttributeTests.cs | 2 +- ...onditionalSuppressMessageAttributeTests.cs | 2 +- .../System/DoubleTests.cs | 4 +-- .../System.Runtime.Tests/System/EnumTests.cs | 18 +++++----- .../System.Runtime.Tests/System/Int16Tests.cs | 4 +-- .../System.Runtime.Tests/System/Int32Tests.cs | 4 +-- .../System.Runtime.Tests/System/Int64Tests.cs | 4 +-- .../System/IntPtrTests.cs | 4 +-- .../System/NullableTests.cs | 2 +- .../System/ObsoleteAttributeTests.cs | 4 +-- .../AssemblyCompanyAttributeTests.cs | 2 +- .../AssemblyConfigurationAttributeTests.cs | 2 +- .../AssemblyCopyrightAttributeTests.cs | 2 +- .../AssemblyCultureAttributeTests.cs | 2 +- .../AssemblyDefaultAliasAttributeTests.cs | 2 +- .../AssemblyDescriptionAttributeTests.cs | 2 +- ...emblyInformationalVersionAttributeTests.cs | 2 +- .../AssemblyKeyFileAttributeTests.cs | 2 +- .../AssemblyKeyNameAttributeTests.cs | 2 +- .../AssemblyMetadataAttributeTests.cs | 2 +- .../AssemblyProductAttributeTests.cs | 2 +- .../AssemblySignatureKeyAttributeTests.cs | 2 +- .../Reflection/AssemblyTitleAttributeTests.cs | 2 +- .../AssemblyTrademarkAttributeTests.cs | 2 +- .../AssemblyVersionAttributeTests.cs | 2 +- .../Reflection/DefaultMemberAttributeTests.cs | 2 +- .../Reflection/ObfuscationAttributeTests.cs | 2 +- .../Reflection/StrongNameKeyPairTests.cs | 2 +- .../Serialization/StreamingContextTests.cs | 2 +- .../RequiresPreviewFeaturesAttributeTests.cs | 4 +-- .../System.Runtime.Tests/System/SByteTests.cs | 4 +-- .../System/SingleTests.cs | 4 +-- .../System/String.SplitTests.cs | 6 ++-- .../System/Text/StringBuilderReplaceTests.cs | 2 +- .../System/Text/StringBuilderTests.cs | 26 +++++++------- .../System/Type/TypeTests.cs | 2 +- .../System/UInt16Tests.cs | 4 +-- .../System/UInt32Tests.cs | 4 +-- .../System/UInt64Tests.cs | 4 +-- .../System/UIntPtrTests.cs | 4 +-- .../System/Uri.MethodsTests.cs | 4 +-- ...PoolingAsyncValueTaskMethodBuilderTests.cs | 2 +- .../AsyncTaskMethodBuilderTests.cs | 2 +- .../tests/Pkcs8PrivateKeyInfoTests.cs | 2 +- .../tests/Rfc3161/TimestampTokenTests.cs | 10 +++--- .../tests/SignedCms/SignedCmsTests.cs | 2 +- .../tests/ProtectedDataTests.cs | 4 +-- .../tests/X509Certificates/CollectionTests.cs | 2 +- .../tests/X509Certificates/ExportTests.cs | 2 +- .../InlineCategoriesDocumentTests.cs | 8 ++--- .../ReferencedCategoriesDocumentTests.cs | 8 ++--- .../ResourceCollectionInfoTests.cs | 6 ++-- .../Syndication/ServiceDocumentTests.cs | 8 ++--- .../Syndication/SyndicationCategoryTests.cs | 12 +++---- .../Syndication/SyndicationContentTests.cs | 8 ++--- ...dicationElementExtensionCollectionTests.cs | 2 +- .../SyndicationElementExtensionTests.cs | 4 +-- .../Syndication/SyndicationFeedTests.cs | 10 +++--- .../Syndication/SyndicationItemTests.cs | 8 ++--- .../Syndication/SyndicationLinkTests.cs | 8 ++--- .../Syndication/SyndicationPersonTests.cs | 12 +++---- .../TextSyndicationContentTests.cs | 4 +-- .../Syndication/WorkspaceTests.cs | 6 ++-- .../Syndication/XmlSyndicationContentTests.cs | 2 +- .../JsonDocumentTests.cs | 2 +- .../JsonPropertyTests.cs | 2 +- .../CustomConverterTests.cs | 2 +- .../Serialization/ReadValueTests.cs | 4 +-- .../Utf8JsonReaderTests.TryGet.cs | 2 +- .../GeneratedRegexAttributeTests.cs | 2 +- .../UnitTests/RegexPrefixAnalyzerTests.cs | 2 +- .../tests/EventWaitHandleAclTests.cs | 2 +- .../tests/MutexAclTests.cs | 2 +- .../tests/SemaphoreAclTests.cs | 2 +- .../tests/AsyncTransactionScopeTests.cs | 4 +-- .../tests/HttpUtility/HttpUtilityTest.cs | 10 +++--- .../tests/System/Media/SoundPlayerTests.cs | 6 ++-- 319 files changed, 661 insertions(+), 661 deletions(-) diff --git a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Authentication.cs b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Authentication.cs index 430cfeb2d47295..d0f9ecc4feed5a 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Authentication.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpClientHandlerTest.Authentication.cs @@ -226,7 +226,7 @@ public static IEnumerable Authentication_TestData() [InlineData("NTLM")] [InlineData("Kerberos")] [InlineData("Negotiate")] - public async Task PreAuthenticate_NoPreviousAuthenticatedRequests_NoCredentialsSent(string credCacheScheme) + public async Task PreAuthenticate_NoPreviousAuthenticatedRequests_NoCredentialsSent(string? credCacheScheme) { const int NumRequests = 3; await LoopbackServer.CreateClientAndServerAsync(async uri => @@ -268,7 +268,7 @@ await LoopbackServer.CreateClientAndServerAsync(async uri => [Theory] [InlineData(null, "WWW-Authenticate: Basic realm=\"hello\"\r\n")] [InlineData("Basic", "WWW-Authenticate: Basic realm=\"hello\"\r\n")] - public async Task PreAuthenticate_FirstRequestNoHeaderAndAuthenticates_SecondRequestPreauthenticates(string credCacheScheme, string authResponse) + public async Task PreAuthenticate_FirstRequestNoHeaderAndAuthenticates_SecondRequestPreauthenticates(string? credCacheScheme, string authResponse) { await LoopbackServer.CreateClientAndServerAsync(async uri => { diff --git a/src/libraries/Common/tests/System/Security/Cryptography/PbeParametersTests.cs b/src/libraries/Common/tests/System/Security/Cryptography/PbeParametersTests.cs index e5e74fb3e48600..48f6f2b4836371 100644 --- a/src/libraries/Common/tests/System/Security/Cryptography/PbeParametersTests.cs +++ b/src/libraries/Common/tests/System/Security/Cryptography/PbeParametersTests.cs @@ -31,7 +31,7 @@ public static void EncryptionAlgorithm_NotVerified(int algId) [InlineData("Potato")] [InlineData("")] [InlineData(null)] - public static void HashAlgorithm_NotVerified(string algId) + public static void HashAlgorithm_NotVerified(string? algId) { HashAlgorithmName hashName = new HashAlgorithmName(algId); @@ -54,7 +54,7 @@ public static void HashAlgorithm_NotVerified_DefaultValue() [InlineData("SHA256")] [InlineData("Potato")] [InlineData(default)] - public static void Pkcs12_NotVerifed_InCtor(string hashAlgName) + public static void Pkcs12_NotVerifed_InCtor(string? hashAlgName) { HashAlgorithmName hashName = new HashAlgorithmName(hashAlgName); diff --git a/src/libraries/Common/tests/Tests/System/IO/PathInternal.Unix.Tests.cs b/src/libraries/Common/tests/Tests/System/IO/PathInternal.Unix.Tests.cs index d97cfacbabe830..d40593653cc15d 100644 --- a/src/libraries/Common/tests/Tests/System/IO/PathInternal.Unix.Tests.cs +++ b/src/libraries/Common/tests/Tests/System/IO/PathInternal.Unix.Tests.cs @@ -33,7 +33,7 @@ public class PathInternalTests_Unix InlineData(@"a\\", @"a\\"), ] [PlatformSpecific(TestPlatforms.AnyUnix)] - public void NormalizeDirectorySeparatorTests(string path, string expected) + public void NormalizeDirectorySeparatorTests(string? path, string? expected) { string result = PathInternal.NormalizeDirectorySeparators(path); Assert.Equal(expected, result); diff --git a/src/libraries/Common/tests/Tests/System/IO/PathInternal.Windows.Tests.cs b/src/libraries/Common/tests/Tests/System/IO/PathInternal.Windows.Tests.cs index 0c8fa43f4e7471..66ec17e331e146 100644 --- a/src/libraries/Common/tests/Tests/System/IO/PathInternal.Windows.Tests.cs +++ b/src/libraries/Common/tests/Tests/System/IO/PathInternal.Windows.Tests.cs @@ -119,7 +119,7 @@ public void IsPartiallyQualifiedTest(string path, bool expected) InlineData(@" \\", @" \"), InlineData(@" //", @" \") ] - public void NormalizeDirectorySeparatorTests(string path, string expected) + public void NormalizeDirectorySeparatorTests(string? path, string? expected) { string result = PathInternal.NormalizeDirectorySeparators(path); Assert.Equal(expected, result); diff --git a/src/libraries/Common/tests/Tests/System/StringTests.cs b/src/libraries/Common/tests/Tests/System/StringTests.cs index 7775280e2edba6..08ce3c6d54dc3e 100644 --- a/src/libraries/Common/tests/Tests/System/StringTests.cs +++ b/src/libraries/Common/tests/Tests/System/StringTests.cs @@ -150,7 +150,7 @@ public static void Ctor_Char_Int_Negative_Count_ThrowsArgumentOutOfRangeExceptio [InlineData(new char[] { '\u041F', '\u0420', '\u0418', '\u0412', '\u0415', '\u0422' }, 0, 6, "\u041F\u0420\u0418\u0412\u0415\u0422")] [InlineData(new char[0], 0, 0, "")] [InlineData(null, 0, 0, "")] - public static void Ctor_CharArray(char[] value, int startIndex, int length, string expected) + public static void Ctor_CharArray(char[]? value, int startIndex, int length, string expected) { if (value == null) { @@ -2556,7 +2556,7 @@ public static void GetHashCode_EmbeddedNull_ReturnsDifferentHashCodes() [InlineData("", "", StringComparison.OrdinalIgnoreCase, true)] [InlineData("123", 123, StringComparison.OrdinalIgnoreCase, false)] // Not a string [InlineData("\0AAAAAAAAA", "\0BBBBBBBBBBBB", StringComparison.OrdinalIgnoreCase, false)] - public static void EqualsTest(string s1, object obj, StringComparison comparisonType, bool expected) + public static void EqualsTest(string? s1, object? obj, StringComparison comparisonType, bool expected) { string s2 = obj as string; if (s1 != null) @@ -2857,7 +2857,7 @@ public static IEnumerable Format_Invalid_FormatExceptionFromArgs_Membe [MemberData(nameof(Format_Invalid_FormatExceptionFromArgs_MemberData))] [InlineData(null, "{10000000}", new object[] { null })] [InlineData(null, "{0,10000000}", new string[] { null })] - public static void Format_Invalid_FormatExceptionFromFormatOrArgs(IFormatProvider provider, string format, object[] args) + public static void Format_Invalid_FormatExceptionFromFormatOrArgs(IFormatProvider? provider, string format, object[] args) { if (provider is null) { @@ -3805,7 +3805,7 @@ public static void Insert_Invalid() [InlineData("", true)] [InlineData("foo", false)] [InlineData(" ", false)] - public static void IsNullOrEmpty(string value, bool expected) + public static void IsNullOrEmpty(string? value, bool expected) { Assert.Equal(expected, string.IsNullOrEmpty(value)); @@ -3970,7 +3970,7 @@ public static void MakeSureNoIsWhiteSpaceChecksGoOutOfRange() [InlineData("$$", new string[] { "Foo", "Bar", "Baz" }, 0, 3, "Foo$$Bar$$Baz")] [InlineData("$$", new string[] { "Foo", "Bar", "Baz" }, 3, 0, "")] [InlineData("$$", new string[] { "Foo", "Bar", "Baz" }, 1, 1, "Bar")] - public static void Join_StringArray(string separator, string[] values, int startIndex, int count, string expected) + public static void Join_StringArray(string? separator, string[] values, int startIndex, int count, string expected) { if (startIndex + count == values.Length && count != 0) { @@ -4892,7 +4892,7 @@ public static void Replace_Char_Char_DoesntAllocateIfNothingIsReplaced(string s, [InlineData("Aa1Bbb1Cccc1Ddddd1Eeeeee1Fffffff", "1", "23", "Aa23Bbb23Cccc23Ddddd23Eeeeee23Fffffff")] [InlineData("11111111111111111111111", "1", "11", "1111111111111111111111111111111111111111111111")] // Checks if we handle the max # of matches [InlineData("11111111111111111111111", "1", "", "")] // Checks if we handle the max # of matches - public static void Replace_String_String(string s, string oldValue, string newValue, string expected) + public static void Replace_String_String(string s, string oldValue, string? newValue, string expected) { Assert.Equal(expected, s.Replace(oldValue, newValue)); } @@ -6149,7 +6149,7 @@ public static void ToLowerToUpperInvariant_ASCII() [InlineData(" ", new char[] { ' ' }, "")] [InlineData("aaaaa", new char[] { 'a' }, "")] [InlineData("abaabaa", new char[] { 'b', 'a' }, "")] - public static void Trim(string s, char[] trimChars, string expected) + public static void Trim(string s, char[]? trimChars, string expected) { if (trimChars == null || trimChars.Length == 0 || (trimChars.Length == 1 && trimChars[0] == ' ')) { @@ -6179,7 +6179,7 @@ public static void Trim(string s, char[] trimChars, string expected) [InlineData(" ", new char[] { ' ' }, "")] [InlineData("aaaaa", new char[] { 'a' }, "")] [InlineData("abaabaa", new char[] { 'b', 'a' }, "")] - public static void TrimEnd(string s, char[] trimChars, string expected) + public static void TrimEnd(string s, char[]? trimChars, string expected) { if (trimChars == null || trimChars.Length == 0 || (trimChars.Length == 1 && trimChars[0] == ' ')) { @@ -6209,7 +6209,7 @@ public static void TrimEnd(string s, char[] trimChars, string expected) [InlineData(" ", new char[] { ' ' }, "")] [InlineData("aaaaa", new char[] { 'a' }, "")] [InlineData("abaabaa", new char[] { 'b', 'a' }, "")] - public static void TrimStart(string s, char[] trimChars, string expected) + public static void TrimStart(string s, char[]? trimChars, string expected) { if (trimChars == null || trimChars.Length == 0 || (trimChars.Length == 1 && trimChars[0] == ' ')) { diff --git a/src/libraries/Microsoft.Extensions.Configuration.Ini/tests/IniConfigurationExtensionsTest.cs b/src/libraries/Microsoft.Extensions.Configuration.Ini/tests/IniConfigurationExtensionsTest.cs index a6f3564458b472..03da264ae412ad 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Ini/tests/IniConfigurationExtensionsTest.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Ini/tests/IniConfigurationExtensionsTest.cs @@ -13,7 +13,7 @@ public class IniConfigurationExtensionsTest [InlineData(null)] [InlineData("")] [ActiveIssue("https://github.com/dotnet/runtime/issues/50867", TestPlatforms.Android)] - public void AddIniFile_ThrowsIfFilePathIsNullOrEmpty(string path) + public void AddIniFile_ThrowsIfFilePathIsNullOrEmpty(string? path) { // Arrange var configurationBuilder = new ConfigurationBuilder(); diff --git a/src/libraries/Microsoft.Extensions.Configuration.Json/tests/JsonConfigurationExtensionsTest.cs b/src/libraries/Microsoft.Extensions.Configuration.Json/tests/JsonConfigurationExtensionsTest.cs index ba37d44740b88e..b9e0f288361644 100644 --- a/src/libraries/Microsoft.Extensions.Configuration.Json/tests/JsonConfigurationExtensionsTest.cs +++ b/src/libraries/Microsoft.Extensions.Configuration.Json/tests/JsonConfigurationExtensionsTest.cs @@ -12,7 +12,7 @@ public class JsonConfigurationExtensionsTest [Theory] [InlineData(null)] [InlineData("")] - public void AddJsonFile_ThrowsIfFilePathIsNullOrEmpty(string path) + public void AddJsonFile_ThrowsIfFilePathIsNullOrEmpty(string? path) { // Arrange var configurationBuilder = new ConfigurationBuilder(); diff --git a/src/libraries/Microsoft.Extensions.Diagnostics.Abstractions/tests/MetricsBuilderExtensionsRulesTests.cs b/src/libraries/Microsoft.Extensions.Diagnostics.Abstractions/tests/MetricsBuilderExtensionsRulesTests.cs index 18568a8480392a..f06f254d5f5abb 100644 --- a/src/libraries/Microsoft.Extensions.Diagnostics.Abstractions/tests/MetricsBuilderExtensionsRulesTests.cs +++ b/src/libraries/Microsoft.Extensions.Diagnostics.Abstractions/tests/MetricsBuilderExtensionsRulesTests.cs @@ -15,7 +15,7 @@ public class MetricsBuilderExtensionsRulesTests [InlineData("")] [InlineData("*")] [InlineData("foo")] - public void BuilderEnableMetricsAddsRule(string meterName) + public void BuilderEnableMetricsAddsRule(string? meterName) { var services = new ServiceCollection(); services.AddOptions(); @@ -59,7 +59,7 @@ public void BuilderEnableMetricsWithAllParamsAddsRule() [InlineData("")] [InlineData("*")] [InlineData("foo")] - public void OptionsEnableMetricsAddsRule(string meterName) + public void OptionsEnableMetricsAddsRule(string? meterName) { var services = new ServiceCollection(); services.AddOptions(); @@ -100,7 +100,7 @@ public void OptionsEnableMetricsAllParamsAddsRule() [InlineData("")] [InlineData("*")] [InlineData("foo")] - public void BuilderDisableMetricsAddsRule(string meterName) + public void BuilderDisableMetricsAddsRule(string? meterName) { var services = new ServiceCollection(); services.AddOptions(); @@ -144,7 +144,7 @@ public void BuilderDisableMetricsWithAllParamsAddsRule() [InlineData("")] [InlineData("*")] [InlineData("foo")] - public void OptionsDisableMetricsAddsRule(string meterName) + public void OptionsDisableMetricsAddsRule(string? meterName) { var services = new ServiceCollection(); services.AddOptions(); diff --git a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/PatternContexts/PatternContextRaggedTests.cs b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/PatternContexts/PatternContextRaggedTests.cs index 0622ffb80b4ec1..607f208be1b12a 100644 --- a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/PatternContexts/PatternContextRaggedTests.cs +++ b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/PatternContexts/PatternContextRaggedTests.cs @@ -35,7 +35,7 @@ public void PredictBeforeEnterDirectoryShouldThrow() [InlineData("/a/b/**/c/d", new string[] { "root", "a", "b" }, null)] [InlineData("/a/b/**/c/d", new string[] { "root", "a", "b", "whatever" }, null)] [InlineData("/a/b/**/c/d", new string[] { "root", "a", "b", "whatever", "anything" }, null)] - public void PredictReturnsCorrectResult(string patternString, string[] pushDirectory, string expectSegment) + public void PredictReturnsCorrectResult(string patternString, string[] pushDirectory, string? expectSegment) { var builder = new PatternBuilder(); var pattern = builder.Build(patternString) as IRaggedPattern; diff --git a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/PatternSegments/CurrentPathSegmentTests.cs b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/PatternSegments/CurrentPathSegmentTests.cs index c01416171275ad..f5562d440ab284 100644 --- a/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/PatternSegments/CurrentPathSegmentTests.cs +++ b/src/libraries/Microsoft.Extensions.FileSystemGlobbing/tests/PatternSegments/CurrentPathSegmentTests.cs @@ -12,7 +12,7 @@ public class CurrentPathSegmentTests [InlineData("anything")] [InlineData("")] [InlineData(null)] - public void Match(string testSample) + public void Match(string? testSample) { var pathSegment = new CurrentPathSegment(); Assert.False(pathSegment.Match(testSample)); diff --git a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleLoggerTest.cs b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleLoggerTest.cs index 6747e98ebf322f..f48a4a0e1176ab 100644 --- a/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleLoggerTest.cs +++ b/src/libraries/Microsoft.Extensions.Logging.Console/tests/Microsoft.Extensions.Logging.Console.Tests/ConsoleLoggerTest.cs @@ -239,7 +239,7 @@ public void DoesNotLog_NewLine_WhenNoExceptionIsProvided() [InlineData(null, 1)] [InlineData("missingFormatter", 0)] [InlineData("missingFormatter", 1)] - public void Options_FormatterNameNull_UsesDeprecatedProperties(string formatterName, int formatNumber) + public void Options_FormatterNameNull_UsesDeprecatedProperties(string? formatterName, int formatNumber) { // Arrange ConsoleLoggerFormat format = (ConsoleLoggerFormat)formatNumber; diff --git a/src/libraries/Microsoft.Extensions.Logging/tests/Common/FormattedLogValuesTest.cs b/src/libraries/Microsoft.Extensions.Logging/tests/Common/FormattedLogValuesTest.cs index c20ede7d712b97..4f5b3a8af4746b 100644 --- a/src/libraries/Microsoft.Extensions.Logging/tests/Common/FormattedLogValuesTest.cs +++ b/src/libraries/Microsoft.Extensions.Logging/tests/Common/FormattedLogValuesTest.cs @@ -19,7 +19,7 @@ public class FormattedLogValuesTest [InlineData("0064", "{Hex:X4}", new object[] { 100 })] [InlineData("8,765", "{Number:#,#}", new object[] { 8765.4321 })] [InlineData(" 8,765", "{Number,6:#,#}", new object[] { 8765.4321 })] - public void LogValues_With_Basic_Types(string expected, string format, object[] args) + public void LogValues_With_Basic_Types(string expected, string format, object[]? args) { var logValues = new FormattedLogValues(format, args); Assert.Equal(expected, logValues.ToString()); @@ -33,7 +33,7 @@ public void LogValues_With_Basic_Types(string expected, string format, object[] [InlineData("[null]", null, new object[] { })] [InlineData("[null]", null, new object[] { null })] [InlineData("[null]", null, new object[] { 1 })] - public void Log_NullFormat(string expected, string format, object[] args) + public void Log_NullFormat(string expected, string? format, object[]? args) { var logValues = new FormattedLogValues(format, args); Assert.Equal(expected, logValues.ToString()); @@ -42,7 +42,7 @@ public void Log_NullFormat(string expected, string format, object[] args) [Theory] [InlineData("(null), (null) : (null)", "{0} : {1}", new object[] { new object[] { null, null }, null })] [InlineData("(null)", "{0}", new object[] { null })] - public void LogValues_WithNulls(string expected, string format, object[] args) + public void LogValues_WithNulls(string expected, string format, object[]? args) { var logValues = new FormattedLogValues(format, args); Assert.Equal(expected, logValues.ToString()); @@ -70,7 +70,7 @@ public void LogValues_With_DateTime(string expected, string format) "{0} {1} '{{}}' '{{' '{{:}}' '{{,:}}' {{,}}- test string", new object[] { "arg1", "arg2" })] [InlineData("{prefix{arg1}suffix}", "{{prefix{{{Argument}}}suffix}}", new object[] { "arg1" })] - public void LogValues_With_Escaped_Braces(string expected, string format, object[] args) + public void LogValues_With_Escaped_Braces(string expected, string format, object[]? args) { var logValues = args == null ? new FormattedLogValues(format) : diff --git a/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/Generated/OptionsValidationTests.cs b/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/Generated/OptionsValidationTests.cs index 01519b780eba1e..4770f02955751d 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/Generated/OptionsValidationTests.cs +++ b/src/libraries/Microsoft.Extensions.Options/tests/SourceGenerationTests/Generated/OptionsValidationTests.cs @@ -241,7 +241,7 @@ public void MultipleAttributeModelValid() [InlineData("abc", 0, 4, 9)] [InlineData("abc", 2, 8, 8)] [InlineData("abc", 2, 4, 10)] - public void MultipleAttributeModelInvalid(string val1, int val2, int val3, int val4) + public void MultipleAttributeModelInvalid(string? val1, int val2, int val3, int val4) { var validModel = new MultipleAttributeModel { diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/CompilerServices/DecimalTypeTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/CompilerServices/DecimalTypeTests.cs index 53d3888a7dcad1..6f833ca11da70e 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/CompilerServices/DecimalTypeTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/CompilerServices/DecimalTypeTests.cs @@ -23,7 +23,7 @@ public void FromBoolean(bool value, decimal expected) [InlineData("&H123", 291)] [InlineData("&O123", 83)] [InlineData("123", 123)] - public void FromString(string value, decimal expected) + public void FromString(string? value, decimal expected) { Assert.Equal(expected, DecimalType.FromString(value)); } diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/CompilerServices/DoubleTypeTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/CompilerServices/DoubleTypeTests.cs index 9bca77d26a2524..4980956e0582dc 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/CompilerServices/DoubleTypeTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/CompilerServices/DoubleTypeTests.cs @@ -15,7 +15,7 @@ public class DoubleTypeTests [InlineData("&H123", 291)] [InlineData("&O123", 83)] [InlineData("123", 123)] - public void FromString(string value, double expected) + public void FromString(string? value, double expected) { Assert.Equal(expected, DoubleType.FromString(value)); } diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/CompilerServices/VersionedTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/CompilerServices/VersionedTests.cs index c2a930cf9d00d7..cce74a4855b81b 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/CompilerServices/VersionedTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/CompilerServices/VersionedTests.cs @@ -83,7 +83,7 @@ public object this[object index] [InlineData('1', true)] [InlineData("&O123", true)] [InlineData("&H123", true)] - public void IsNumeric(object value, bool expected) + public void IsNumeric(object? value, bool expected) { Assert.Equal(expected, Versioned.IsNumeric(value)); } @@ -94,14 +94,14 @@ public void IsNumeric(object value, bool expected) [InlineData(" OBJECT ", "System.Object")] [InlineData("object", "System.Object")] [InlineData("custom", null)] - public void SystemTypeName(string value, string expected) + public void SystemTypeName(string? value, string? expected) { Assert.Equal(expected, Versioned.SystemTypeName(value)); } [Theory] [MemberData(nameof(TypeName_TestData))] - public void TypeName(object expression, string expected) + public void TypeName(object? expression, string expected) { Assert.Equal(expected, Versioned.TypeName(expression)); } @@ -155,7 +155,7 @@ public static IEnumerable TypeName_ComObject_TestData() [InlineData("Object", "Object")] [InlineData(" object ", "Object")] [InlineData("custom", null)] - public void VbTypeName(string value, string expected) + public void VbTypeName(string? value, string? expected) { Assert.Equal(expected, Versioned.VbTypeName(value)); } diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/ConversionTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/ConversionTests.cs index c28005480741b0..09c78b0b48003f 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/ConversionTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/ConversionTests.cs @@ -123,7 +123,7 @@ private static void CTypeDynamic(object expression, object expected) [Theory] [InlineData(null, null)] [InlineData("", null)] - public void CTypeDynamic_ArgumentException(object expression, Type targetType) + public void CTypeDynamic_ArgumentException(object? expression, Type? targetType) { Assert.Throws(() => Conversion.CTypeDynamic(expression, targetType)); } @@ -222,7 +222,7 @@ public void Fix_ArgumentException(object value) [Theory] [InlineData(null)] - public void Fix_ArgumentNullException(object value) + public void Fix_ArgumentNullException(object? value) { Assert.Throws(() => Conversion.Fix(value)); } @@ -399,7 +399,7 @@ public void Hex_ArgumentException(object value) [Theory] [InlineData(null)] - public void Hex_ArgumentNullException(object value) + public void Hex_ArgumentNullException(object? value) { Assert.Throws(() => Conversion.Hex(value)); } @@ -565,7 +565,7 @@ public void Int_ArgumentException(object value) [Theory] [InlineData(null)] - public void Int_ArgumentNullException(object value) + public void Int_ArgumentNullException(object? value) { Assert.Throws(() => Conversion.Int(value)); } @@ -737,7 +737,7 @@ public void Oct_ArgumentException(object value) [Theory] [InlineData(null)] - public void Oct_ArgumentNullException(object value) + public void Oct_ArgumentNullException(object? value) { Assert.Throws(() => Conversion.Oct(value)); } @@ -846,7 +846,7 @@ public void Str(object value, string expected) [Theory] [InlineData(null)] - public void Str_ArgumentNullException(object value) + public void Str_ArgumentNullException(object? value) { Assert.Throws(() => Conversion.Str(value)); } diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs index a14d797a527283..61a1f8c4b66fbd 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/ErrObjectTests.cs @@ -122,7 +122,7 @@ public void MakeHelpLink() [InlineData("#-3", -3, "")] [InlineData("MyFile1", 0, "MyFile1")] [InlineData("MyFile4#4", 4, "MyFile4")] - public void ParseHelpLink(string helpLink, int expectedHelpContext, string expectedHelpFile) + public void ParseHelpLink(string? helpLink, int expectedHelpContext, string expectedHelpFile) { ProjectData.ClearProjectError(); ProjectData.SetProjectError(new ArgumentException() { HelpLink = helpLink }); diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/InformationTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/InformationTests.cs index 474ab884d72ed9..97604b65ce4f43 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/InformationTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/InformationTests.cs @@ -12,7 +12,7 @@ public class InformationTests [Theory] [InlineData(new int[0], true)] [InlineData(null, false)] - public void IsArray(object value, bool expected) + public void IsArray(object? value, bool expected) { Assert.Equal(expected, Information.IsArray(value)); } @@ -38,7 +38,7 @@ public void IsDBNull() [Theory] [InlineData(null, true)] [InlineData("abc", false)] - public void IsNothing(object value, bool expected) + public void IsNothing(object? value, bool expected) { Assert.Equal(expected, Information.IsNothing(value)); } @@ -55,7 +55,7 @@ public void IsError() [InlineData(null, true)] [InlineData("abc", true)] [InlineData(1, false)] - public void IsReference(object value, bool expected) + public void IsReference(object? value, bool expected) { Assert.Equal(expected, Information.IsReference(value)); } @@ -137,7 +137,7 @@ public void RGB_Invalid() [InlineData(true, VariantType.Boolean)] [InlineData((byte)1, VariantType.Byte)] [InlineData('a', VariantType.Char)] - public void VarType(object value, VariantType expected) + public void VarType(object? value, VariantType expected) { Assert.Equal(expected, Information.VarType(value)); } @@ -151,7 +151,7 @@ public void VarType(object value, VariantType expected) [InlineData('1', true)] [InlineData("&O123", true)] [InlineData("&H123", true)] - public void IsNumeric(object value, bool expected) + public void IsNumeric(object? value, bool expected) { Assert.Equal(expected, Information.IsNumeric(value)); } @@ -168,7 +168,7 @@ public void IsNumeric_Invalid() [InlineData(" OBJECT ", "System.Object")] [InlineData("object", "System.Object")] [InlineData("custom", null)] - public void SystemTypeName(string value, string expected) + public void SystemTypeName(string? value, string? expected) { Assert.Equal(expected, Information.SystemTypeName(value)); } @@ -212,7 +212,7 @@ public static IEnumerable TypeName_TestData() [InlineData("Object", "Object")] [InlineData(" object ", "Object")] [InlineData("custom", null)] - public void VbTypeName(string value, string expected) + public void VbTypeName(string? value, string? expected) { Assert.Equal(expected, Information.VbTypeName(value)); } diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/InteractionTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/InteractionTests.cs index 962749c6a6e8a2..1d3bc0f9b31d13 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/InteractionTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/InteractionTests.cs @@ -334,7 +334,7 @@ public void Shell() [InlineData(new object[] { true, "red", false, "green", false, "blue" }, "red")] [InlineData(new object[] { false, "red", true, "green", false, "blue" }, "green")] [InlineData(new object[] { false, "red", false, "green", true, "blue" }, "blue")] - public void Switch(object[] VarExpr, object expected) + public void Switch(object[]? VarExpr, object? expected) { Assert.Equal(expected, Interaction.Switch(VarExpr)); } diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft/VisualBasic/ComClassAttributeTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft/VisualBasic/ComClassAttributeTests.cs index f7b256c1f4faba..2c33e6a65c698d 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft/VisualBasic/ComClassAttributeTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft/VisualBasic/ComClassAttributeTests.cs @@ -21,7 +21,7 @@ public void Ctor_Default() [InlineData(null)] [InlineData("")] [InlineData("classID")] - public void Ctor_String(string classID) + public void Ctor_String(string? classID) { var attribute = new ComClassAttribute(classID); Assert.Equal(classID, attribute.ClassID); @@ -34,7 +34,7 @@ public void Ctor_String(string classID) [InlineData(null, null)] [InlineData("", "")] [InlineData("classID", "interfaceID")] - public void Ctor_String_String(string classID, string interfaceID) + public void Ctor_String_String(string? classID, string? interfaceID) { var attribute = new ComClassAttribute(classID, interfaceID); Assert.Equal(classID, attribute.ClassID); @@ -47,7 +47,7 @@ public void Ctor_String_String(string classID, string interfaceID) [InlineData(null, null, null)] [InlineData("", "", "")] [InlineData("classID", "interfaceID", "eventID")] - public void Ctor_String_String_String(string classID, string interfaceID, string eventID) + public void Ctor_String_String_String(string? classID, string? interfaceID, string? eventID) { var attribute = new ComClassAttribute(classID, interfaceID, eventID); Assert.Equal(classID, attribute.ClassID); diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft/VisualBasic/MyGroupCollectionAttributeTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft/VisualBasic/MyGroupCollectionAttributeTests.cs index 9ab1d9b28a2ba2..d9ef0350a24a5c 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft/VisualBasic/MyGroupCollectionAttributeTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/Microsoft/VisualBasic/MyGroupCollectionAttributeTests.cs @@ -11,7 +11,7 @@ public class MyGroupCollectionAttributeTests [InlineData(null, null, null, null)] [InlineData("", "", "", "")] [InlineData("typeToCollect", "createInstanceMethodName", "disposeInstanceMethodName", "defaultInstanceAlias")] - public void Ctor_String_String_String(string typeToCollect, string createInstanceMethodName, string disposeInstanceMethodName, string defaultInstanceAlias) + public void Ctor_String_String_String(string? typeToCollect, string? createInstanceMethodName, string? disposeInstanceMethodName, string? defaultInstanceAlias) { var attribute = new MyGroupCollectionAttribute(typeToCollect, createInstanceMethodName, disposeInstanceMethodName, defaultInstanceAlias); Assert.Equal(typeToCollect, attribute.MyGroupName); diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/StringTypeTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/StringTypeTests.cs index 8d4d2842766d7f..1aa4dd7dfc3969 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/StringTypeTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/StringTypeTests.cs @@ -339,7 +339,7 @@ public static IEnumerable FromDecimal_Format_TestData() [InlineData("abc", 2, 1, "def", "adc")] [InlineData("abc", 2, 2, "def", "ade")] [InlineData("abc", 2, 3, "def", "ade")] - public void MidStmtStr(string str, int start, int length, string insert, string expected) + public void MidStmtStr(string str, int start, int length, string? insert, string expected) { StringType.MidStmtStr(ref str, start, length, insert); Assert.Equal(expected, str); @@ -358,7 +358,7 @@ public void MidStmtStr(string str, int start, int length, string insert, string [InlineData("abc", 0, 0, "")] [InlineData("abc", 4, 0, "")] [InlineData("abc", 1, -3, "")] - public void MidStmtStr_ArgumentException(string str, int start, int length, string insert) + public void MidStmtStr_ArgumentException(string? str, int start, int length, string? insert) { Assert.Throws(() => StringType.MidStmtStr(ref str, start, length, insert)); } @@ -396,7 +396,7 @@ public static IEnumerable StrCmp_TestData() [InlineData("a", "?", true, true)] [InlineData("a3", "[A-Z]#", false, true)] [InlineData("A3", "[a-z]#", false, true)] - public void StrLike(string source, string pattern, bool expectedBinaryCompare, bool expectedTextCompare) + public void StrLike(string? source, string? pattern, bool expectedBinaryCompare, bool expectedTextCompare) { Assert.Equal(expectedBinaryCompare, StringType.StrLike(source, pattern, CompareMethod.Binary)); Assert.Equal(expectedTextCompare, StringType.StrLike(source, pattern, CompareMethod.Text)); @@ -406,7 +406,7 @@ public void StrLike(string source, string pattern, bool expectedBinaryCompare, b [Theory] [InlineData(null, "*")] - public void StrLike_NullReferenceException(string source, string pattern) + public void StrLike_NullReferenceException(string? source, string pattern) { Assert.Throws(() => StringType.StrLike(source, pattern, CompareMethod.Binary)); Assert.Throws(() => StringType.StrLike(source, pattern, CompareMethod.Text)); diff --git a/src/libraries/Microsoft.VisualBasic.Core/tests/StringsTests.cs b/src/libraries/Microsoft.VisualBasic.Core/tests/StringsTests.cs index 27967fa777fe10..f844e0d0c801b7 100644 --- a/src/libraries/Microsoft.VisualBasic.Core/tests/StringsTests.cs +++ b/src/libraries/Microsoft.VisualBasic.Core/tests/StringsTests.cs @@ -38,7 +38,7 @@ public void Asc_String_ReturnsExpected(string String, int expected) [Theory] [InlineData(null)] [InlineData("")] - public void Asc_NullOrEmpty_ThrowsArgumentException(string String) + public void Asc_NullOrEmpty_ThrowsArgumentException(string? String) { AssertExtensions.Throws("String", null, () => Strings.Asc(String)); } @@ -61,7 +61,7 @@ public void AscW_String_ReturnsExpected(string String, int expected) [Theory] [InlineData(null)] [InlineData("")] - public void AscW_NullOrEmpty_ThrowsArgumentException(string String) + public void AscW_NullOrEmpty_ThrowsArgumentException(string? String) { AssertExtensions.Throws("String", null, () => Strings.AscW(String)); } @@ -151,7 +151,7 @@ public void Asc_Chr_DoubleByte(int charCode, int expected) [Theory] [InlineData(new string[] { }, null, null)] [InlineData(new string[] { }, "", null)] - public void Filter_WhenNoMatchArgument_ReturnsNull(string[] source, string match, string[] expected) + public void Filter_WhenNoMatchArgument_ReturnsNull(string[] source, string? match, string[]? expected) { Assert.Equal(expected, Strings.Filter(source, match)); } @@ -400,7 +400,7 @@ public void GetChar(string str, int index, char expected) [InlineData("", 1)] [InlineData("ABC", 0)] [InlineData("ABC", 4)] - public void GetChar_ArgumentException(string str, int index) + public void GetChar_ArgumentException(string? str, int index) { Assert.Throws< ArgumentException>(() => Strings.GetChar(str, index)); } @@ -564,7 +564,7 @@ public void LCase_Char(char value, char expected) [InlineData("abc", "abc")] [InlineData("ABC", "abc")] [InlineData("123", "123")] - public void LCase_String(string value, string expected) + public void LCase_String(string? value, string? expected) { Assert.Equal(expected, Strings.LCase(value)); } @@ -588,7 +588,7 @@ public void UCase_Char(char value, char expected) [InlineData("abc", "ABC")] [InlineData("ABC", "ABC")] [InlineData("123", "123")] - public void UCase_String(string value, string expected) + public void UCase_String(string? value, string expected) { Assert.Equal(expected, Strings.UCase(value)); } @@ -674,7 +674,7 @@ public void Mid2_Invalid(string str, int start) [InlineData("abc", 1, "abc")] // 1-based strings in VB [InlineData("abcd", 2, "bcd")] [InlineData("abcd", 3, "cd")] - public void Mid2_Valid(string str, int start, string expected) + public void Mid2_Valid(string? str, int start, string? expected) { Assert.Equal(expected, Strings.Mid(str, start)); } @@ -695,7 +695,7 @@ public void Mid3_Invalid(string str, int start, int length) [InlineData("abc", 1, 2, "ab")] // 1-based strings in VB [InlineData("abcd", 2, 2, "bc")] [InlineData("abcd", 2, 3, "bcd")] - public void Mid3_Valid(string str, int start, int length, string expected) + public void Mid3_Valid(string? str, int start, int length, string expected) { Assert.Equal(expected, Strings.Mid(str, start, length)); } @@ -712,7 +712,7 @@ public void Mid3_Valid(string str, int start, int length, string expected) [InlineData("AB", 1, "A")] [InlineData("AB", 2, "AB")] [InlineData("AB", 4, "AB ")] - public void LSet(string source, int length, string expected) + public void LSet(string? source, int length, string expected) { Assert.Equal(expected, Strings.LSet(source, length)); } @@ -729,7 +729,7 @@ public void LSet(string source, int length, string expected) [InlineData("AB", 1, "A")] [InlineData("AB", 2, "AB")] [InlineData("AB", 4, " AB")] - public void RSet(string source, int length, string expected) + public void RSet(string? source, int length, string expected) { Assert.Equal(expected, Strings.RSet(source, length)); } @@ -743,7 +743,7 @@ public void RSet(string source, int length, string expected) [InlineData("\nabc ", "\nabc ")] [InlineData("abc ", "abc ")] [InlineData("abc", "abc")] - public void LTrim_Valid(string str, string expected) + public void LTrim_Valid(string? str, string expected) { // Trims only space and \u3000 specifically Assert.Equal(expected, Strings.LTrim(str)); @@ -758,7 +758,7 @@ public void LTrim_Valid(string str, string expected) [InlineData(" abc\n", " abc\n")] [InlineData(" abc", " abc")] [InlineData("abc", "abc")] - public void RTrim_Valid(string str, string expected) + public void RTrim_Valid(string? str, string expected) { // Trims only space and \u3000 specifically Assert.Equal(expected, Strings.RTrim(str)); @@ -773,7 +773,7 @@ public void RTrim_Valid(string str, string expected) [InlineData("\u3000abc\n\u3000", "abc\n")] [InlineData("abc\n", "abc\n")] [InlineData("abc", "abc")] - public void Trim_Valid(string str, string expected) + public void Trim_Valid(string? str, string expected) { // Trims only space and \u3000 specifically Assert.Equal(expected, Strings.Trim(str)); @@ -793,7 +793,7 @@ public void Trim_Valid(string str, string expected) [InlineData("abc", "bc", "23", 2, -1, CompareMethod.Text, "23")] [InlineData("abc", "bc", "23", 3, -1, CompareMethod.Text, "c")] [InlineData("abc", "bc", "23", 4, -1, CompareMethod.Text, null)] - public void Replace(string expression, string find, string replacement, int start, int n, CompareMethod compare, string expected) + public void Replace(string expression, string? find, string? replacement, int start, int n, CompareMethod compare, string? expected) { Assert.Equal(expected, Strings.Replace(expression, find, replacement, start, n, compare)); } @@ -801,7 +801,7 @@ public void Replace(string expression, string find, string replacement, int star [Theory] [InlineData(null, null, null, 0, 0, CompareMethod.Text)] [InlineData(null, "", "", 0, 0, CompareMethod.Text)] - public void Replace_ArgumentException(string expression, string find, string replacement, int start, int length, CompareMethod compare) + public void Replace_ArgumentException(string? expression, string? find, string? replacement, int start, int length, CompareMethod compare) { Assert.Throws< ArgumentException>(() => Strings.Replace(expression, find, replacement, start, length, compare)); } @@ -828,7 +828,7 @@ public void Space(int number, string expected) [InlineData("A, B, C", ", ", 1, CompareMethod.Text, new string[] { "A, B, C" })] [InlineData("A, B, C", ", ", 2, CompareMethod.Text, new string[] { "A", "B, C" })] [InlineData("A, B, C", ", ", int.MaxValue, CompareMethod.Text, new string[] { "A", "B", "C" })] - public void Split(string expression, string delimiter, int limit, CompareMethod compare, string[] expected) + public void Split(string? expression, string? delimiter, int limit, CompareMethod compare, string[] expected) { Assert.Equal(expected, Strings.Split(expression, delimiter, limit, compare)); } @@ -860,7 +860,7 @@ public void StrComp(string left, string right, int expectedBinaryCompare, int ex [InlineData("", VbStrConv.Lowercase, 0, "")] [InlineData("Abc123", VbStrConv.Lowercase, 0, "abc123")] [InlineData("Abc123", VbStrConv.Uppercase, 0, "ABC123")] - public void StrConv(string str, Microsoft.VisualBasic.VbStrConv conversion, int localeID, string expected) + public void StrConv(string? str, Microsoft.VisualBasic.VbStrConv conversion, int localeID, string? expected) { if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows)) { @@ -968,7 +968,7 @@ public static IEnumerable StrDup_String_ArgumentException_TestData() [InlineData("ABC", "CBA")] [InlineData("\ud83c\udfc8", "\ud83c\udfc8")] [InlineData("A\ud83c\udfc8", "\ud83c\udfc8A")] - public void StrReverse(string str, string expected) + public void StrReverse(string? str, string expected) { Assert.Equal(expected, Strings.StrReverse(str)); } diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeArgumentTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeArgumentTests.cs index e97d7a17cdff70..1ae72af5762140 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeArgumentTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeArgumentTests.cs @@ -42,7 +42,7 @@ public void Ctor(string name, CodeExpression value) [InlineData(null)] [InlineData("")] [InlineData("Name")] - public void Name_Set_Get_ReturnsExpected(string value) + public void Name_Set_Get_ReturnsExpected(string? value) { var argument = new CodeAttributeArgument(); argument.Name = value; diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeDeclarationTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeDeclarationTests.cs index 7eb9c59ccdf624..6f52cd1f0f1ea7 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeDeclarationTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeAttributeDeclarationTests.cs @@ -87,7 +87,7 @@ public void Ctor_NullObjectInArguments_ThrowsArgumentNullException() [InlineData(null)] [InlineData("")] [InlineData("Name")] - public void Name_Set_Get_ReturnsExpected(string value) + public void Name_Set_Get_ReturnsExpected(string? value) { var declaration = new CodeAttributeDeclaration(); declaration.Name = value; diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeChecksumPragmaTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeChecksumPragmaTests.cs index 6e85e23d8a337c..494e1328f1333b 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeChecksumPragmaTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeChecksumPragmaTests.cs @@ -62,7 +62,7 @@ public void AlgorithmId_Set_Get_ReturnsExpected(Guid value) [InlineData(null)] [InlineData(new byte[0])] [InlineData(new byte[] { 0, 1, 2, 3 })] - public void ChecksumData_Set_Get_ReturnsExpected(byte[] value) + public void ChecksumData_Set_Get_ReturnsExpected(byte[]? value) { var pragma = new CodeChecksumPragma(); pragma.ChecksumData = value; diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeDelegateCreateExpressionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeDelegateCreateExpressionTests.cs index 8c411c151ccbb4..f10c2d27e77b2c 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeDelegateCreateExpressionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeDelegateCreateExpressionTests.cs @@ -57,7 +57,7 @@ public void TargetObject_Set_Get_ReturnsExpected(CodeExpression value) [InlineData(null)] [InlineData("")] [InlineData("MethodName")] - public void MethodName_Set_Get_ReturnsExpected(string value) + public void MethodName_Set_Get_ReturnsExpected(string? value) { var delegateCreate = new CodeDelegateCreateExpression(); delegateCreate.MethodName = value; diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeEventReferenceExpressionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeEventReferenceExpressionTests.cs index 089dc60416f099..dbbc5617b239fe 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeEventReferenceExpressionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeEventReferenceExpressionTests.cs @@ -36,7 +36,7 @@ public void Ctor(CodeExpression targetObject, string eventName) [InlineData(null)] [InlineData("")] [InlineData("EventName")] - public void EventName_Set_Get_ReturnsExpected(string value) + public void EventName_Set_Get_ReturnsExpected(string? value) { var eventReference = new CodeEventReferenceExpression(); eventReference.EventName = value; diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeFieldReferenceExpressionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeFieldReferenceExpressionTests.cs index 662aea82572e93..e73f407f044961 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeFieldReferenceExpressionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeFieldReferenceExpressionTests.cs @@ -36,7 +36,7 @@ public void Ctor(CodeExpression targetObject, string fieldName) [InlineData(null)] [InlineData("")] [InlineData("FieldName")] - public void EventName_Set_Get_ReturnsExpected(string value) + public void EventName_Set_Get_ReturnsExpected(string? value) { var fieldReference = new CodeFieldReferenceExpression(); fieldReference.FieldName = value; diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeGotoStatement.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeGotoStatement.cs index 00568dceca240f..a1d73dcb5ffd50 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeGotoStatement.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeGotoStatement.cs @@ -26,7 +26,7 @@ public void Ctor_String(string label) [Theory] [InlineData(null)] [InlineData("")] - public void Ctor_StringNullOrEmpty_ThrowsArgumentNullException(string value) + public void Ctor_StringNullOrEmpty_ThrowsArgumentNullException(string? value) { AssertExtensions.Throws("value", () => new CodeGotoStatement(value)); } @@ -44,7 +44,7 @@ public void Label_Set_Get_ReturnsExpected(string value) [Theory] [InlineData(null)] [InlineData("")] - public void Label_SetNullOrEmpty_ThrowsArgumentNullException(string value) + public void Label_SetNullOrEmpty_ThrowsArgumentNullException(string? value) { var gotoStatement = new CodeGotoStatement(); AssertExtensions.Throws("value", () => gotoStatement.Label = value); diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodePropertyReferenceExpressionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodePropertyReferenceExpressionTests.cs index 463662afec9e33..9efbe0f448af1f 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodePropertyReferenceExpressionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodePropertyReferenceExpressionTests.cs @@ -36,7 +36,7 @@ public void Ctor(CodeExpression targetObject, string PropertyName) [InlineData(null)] [InlineData("")] [InlineData("PropertyName")] - public void EventName_Set_Get_ReturnsExpected(string value) + public void EventName_Set_Get_ReturnsExpected(string? value) { var propertyReference = new CodePropertyReferenceExpression(); propertyReference.PropertyName = value; diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeSnippetTypeMemberTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeSnippetTypeMemberTests.cs index dd361323ed75a3..9184277acae385 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeSnippetTypeMemberTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeSnippetTypeMemberTests.cs @@ -18,7 +18,7 @@ public void Ctor_Default() [InlineData(null)] [InlineData("")] [InlineData("Text")] - public void Ctor_String(string value) + public void Ctor_String(string? value) { var snippet = new CodeSnippetTypeMember(value); Assert.Equal(value ?? string.Empty, snippet.Text); @@ -28,7 +28,7 @@ public void Ctor_String(string value) [InlineData(null)] [InlineData("")] [InlineData("Text")] - public void Text_Set_Get_ReturnsExpected(string value) + public void Text_Set_Get_ReturnsExpected(string? value) { var snippet = new CodeSnippetTypeMember(); snippet.Text = value; diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeMemberTestBase.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeMemberTestBase.cs index 918d128b1eb5f3..bc2272ec1cef49 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeMemberTestBase.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeMemberTestBase.cs @@ -28,7 +28,7 @@ public void Ctor_Default_MemberBase() [InlineData("Name")] [InlineData("")] [InlineData(null)] - public void Name_Set_Get_ReturnsExpected(string value) + public void Name_Set_Get_ReturnsExpected(string? value) { CodeTypeMember member = new T() { Name = value }; Assert.Equal(value ?? string.Empty, member.Name); diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeParameterCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeParameterCollectionTests.cs index a0f6603215e123..211418a9acbf1d 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeParameterCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/CodeTypeParameterCollectionTests.cs @@ -34,7 +34,7 @@ public class CodeTypeParameterCollectionTests : CodeCollectionTestBase @@ -50,7 +50,7 @@ public void ContinueOnNewLine_InvokeWithOutput_Appends(string st, string expecte [InlineData(null)] [InlineData("")] [InlineData("st")] - public void ContinueOnNewLine_InvokeWithoutOutput_ThrowsNullReferenceException(string st) + public void ContinueOnNewLine_InvokeWithoutOutput_ThrowsNullReferenceException(string? st) { CodeGeneratorTests generator = this; Assert.Throws(() => generator.ContinueOnNewLine(st)); @@ -409,7 +409,7 @@ public void GenerateCodeFromMember_NullWriter_ThrowsArgumentNullException() [InlineData(null)] [InlineData("")] [InlineData("text")] - public void GenerateCommentStatement_Invoke_CallsCorrectMethod(string text) + public void GenerateCommentStatement_Invoke_CallsCorrectMethod(string? text) { CodeGeneratorTests generator = this; var e = new CodeCommentStatement(text); @@ -443,7 +443,7 @@ public void GenerateCommentStatement_NullEComment_ThrowsArgumentException() [InlineData(null)] [InlineData("")] [InlineData("text")] - public void GenerateCommentStatements_InvokeNonEmpty_CallsCorrectMethod(string text) + public void GenerateCommentStatements_InvokeNonEmpty_CallsCorrectMethod(string? text) { CodeGeneratorTests generator = this; generator.GenerateCommentStatementsAction = (actualE, baseMethod) => baseMethod(actualE); @@ -1687,7 +1687,7 @@ public void GeneratePrimitiveExpression_InvokeDecimal_Success() [InlineData(null, "")] [InlineData("", "")] [InlineData("result", "result")] - public void GeneratePrimitiveExpression_InvokeString_Success(string result, string expected) + public void GeneratePrimitiveExpression_InvokeString_Success(string? result, string expected) { CodeGeneratorTests generator = this; generator.GeneratePrimitiveExpressionAction = (actualE, baseMethod) => baseMethod(actualE); @@ -1794,7 +1794,7 @@ public void GenerateSingleFloatValue_InvokeWithoutWriter_ThrowsNullReferenceExce [InlineData(null, "")] [InlineData("", "")] [InlineData("value", "value")] - public void GenerateSnippetCompileUnit_Invoke_Success(string value, string expected) + public void GenerateSnippetCompileUnit_Invoke_Success(string? value, string expected) { CodeGeneratorTests generator = this; var e = new CodeSnippetCompileUnit(value); @@ -1872,7 +1872,7 @@ public void GenerateSnippetCompileUnit_InvokeWithoutOutput_ThrowsNullReferenceEx [InlineData(null, "")] [InlineData("", "")] [InlineData("value", "value")] - public void GenerateSnippetStatement_Invoke_Success(string value, string expected) + public void GenerateSnippetStatement_Invoke_Success(string? value, string expected) { CodeGeneratorTests generator = this; PerformActionWithOutput(writer => @@ -2661,7 +2661,7 @@ public void GenerateTypes_NullValueInE_ThrowsArgumentException() [InlineData("\n", false)] [InlineData("a\n", false)] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Not fixed on NetFX")] - public void IsValidLanguageIndependentIdentifier_Invoke_ReturnsExpected(string value, bool expected) + public void IsValidLanguageIndependentIdentifier_Invoke_ReturnsExpected(string? value, bool expected) { Assert.Equal(expected, CodeGenerator.IsValidLanguageIndependentIdentifier(value)); } @@ -2670,7 +2670,7 @@ public void IsValidLanguageIndependentIdentifier_Invoke_ReturnsExpected(string v [InlineData(null, "1")] [InlineData("", "1")] [InlineData("name", "name=1")] - public void OutputAttributeArgument_Invoke_Success(string name, string expected) + public void OutputAttributeArgument_Invoke_Success(string? name, string expected) { CodeGeneratorTests generator = this; PerformActionWithOutput(writer => @@ -2713,7 +2713,7 @@ public void OutputAttributeArgument_NullArgValue_ThrowsArgumentNullException() [InlineData(null)] [InlineData("")] [InlineData("name")] - public void OutputAttributeArgument_InvokeNonNullNameWithoutOutput_ThrowsNullReferenceException(string name) + public void OutputAttributeArgument_InvokeNonNullNameWithoutOutput_ThrowsNullReferenceException(string? name) { CodeGeneratorTests generator = this; var arg = new CodeAttributeArgument(name, new CodePrimitiveExpression(1)); @@ -2927,7 +2927,7 @@ public void OutputFieldScopeModifier_InvokeWithoutOutputInvalid_Nop(MemberAttrib [InlineData(null, "")] [InlineData("", "")] [InlineData("ident", "ident")] - public void OutputIdentifier_InvokeWithOutput_Appends(string st, string expected) + public void OutputIdentifier_InvokeWithOutput_Appends(string? st, string expected) { CodeGeneratorTests generator = this; generator.PerformActionWithOutput(writer => @@ -2942,7 +2942,7 @@ public void OutputIdentifier_InvokeWithOutput_Appends(string st, string expected [InlineData(null)] [InlineData("")] [InlineData("ident")] - public void OutputIdentifier_InvokeWithoutOutput_ThrowsNullReferenceException(string ident) + public void OutputIdentifier_InvokeWithoutOutput_ThrowsNullReferenceException(string? ident) { CodeGeneratorTests generator = this; generator.OutputIdentifierAction = (actualSt, baseMethod) => baseMethod(actualSt); @@ -3541,7 +3541,7 @@ public void OutputTypeAttributes_InvokeWithoutWriter_ThrowsNullReferenceExceptio [InlineData(null)] [InlineData("")] [InlineData("value")] - public void ValidateIdentifier_InvokeValid_Nop(string value) + public void ValidateIdentifier_InvokeValid_Nop(string? value) { CodeGeneratorTests generator = this; int isValidIdentifierCallCount = 0; @@ -3561,7 +3561,7 @@ public void ValidateIdentifier_InvokeValid_Nop(string value) [InlineData("")] [InlineData("value")] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Not fixed on NetFX")] - public void ValidateIdentifier_InvokeInvalid_ThrowsArgumentException(string value) + public void ValidateIdentifier_InvokeInvalid_ThrowsArgumentException(string? value) { CodeGeneratorTests generator = this; int isValidIdentifierCallCount = 0; @@ -3586,7 +3586,7 @@ public void ValidateIdentifier_InvokeInvalid_ThrowsArgumentException(string valu [InlineData("identifier", null)] [InlineData("identifier", "")] [InlineData("identifier", "escapedIdentifier")] - public void ICodeGeneratorCreateEscapedIdentifier_Invoke_ReturnsExpected(string value, string result) + public void ICodeGeneratorCreateEscapedIdentifier_Invoke_ReturnsExpected(string? value, string? result) { CodeGeneratorTests generator = this; int callCount = 0; @@ -3611,7 +3611,7 @@ public void ICodeGeneratorCreateEscapedIdentifier_Invoke_ReturnsExpected(string [InlineData("identifier", null)] [InlineData("identifier", "")] [InlineData("identifier", "validIdentifier")] - public void ICodeGeneratorCreateValidIdentifier_Invoke_ReturnsExpected(string value, string result) + public void ICodeGeneratorCreateValidIdentifier_Invoke_ReturnsExpected(string? value, string? result) { CodeGeneratorTests generator = this; int callCount = 0; @@ -3710,7 +3710,7 @@ public void ICodeGeneratorSupports_Invoke_ReturnsExpected(GeneratorSupport suppo [InlineData(null)] [InlineData("")] [InlineData("value")] - public void ICodeGeneratorValidateIdentifier_InvokeValid_Nop(string value) + public void ICodeGeneratorValidateIdentifier_InvokeValid_Nop(string? value) { CodeGeneratorTests generator = this; int isValidIdentifierCallCount = 0; @@ -3731,7 +3731,7 @@ public void ICodeGeneratorValidateIdentifier_InvokeValid_Nop(string value) [InlineData("")] [InlineData("value")] [SkipOnTargetFramework(TargetFrameworkMonikers.NetFramework, "Not fixed on NetFX")] - public void ICodeGeneratorValidateIdentifier_InvokeInvalid_ThrowsArgumentException(string value) + public void ICodeGeneratorValidateIdentifier_InvokeInvalid_ThrowsArgumentException(string? value) { CodeGeneratorTests generator = this; int isValidIdentifierCallCount = 0; diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerErrorTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerErrorTests.cs index aa1bd246449807..8feb6d45941ec6 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerErrorTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerErrorTests.cs @@ -23,7 +23,7 @@ public void Ctor_Default() [InlineData(null, 0, 0, null, null)] [InlineData("", -1, -1, "", "")] [InlineData("fileName", 1, 1, "errorNumber", "errorText")] - public void Ctor_String_Int_Int_String_String(string fileName, int line, int column, string errorNumber, string errorText) + public void Ctor_String_Int_Int_String_String(string? fileName, int line, int column, string? errorNumber, string? errorText) { var error = new CompilerError(fileName, line, column, errorNumber, errorText); Assert.Equal(column, error.Column); diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs index f36b765421ba4e..b550a80f0bcdf3 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/Compiler/CompilerResultsTests.cs @@ -64,7 +64,7 @@ public void CompiledAssembly_Set_GetReturnsExpected(Assembly value) [InlineData(null)] [InlineData("")] [InlineData("name")] - public void PathToAssembly_Set_GetReturnsExpected(string value) + public void PathToAssembly_Set_GetReturnsExpected(string? value) { var results = new CompilerResults(null) { PathToAssembly = value }; Assert.Same(value, results.PathToAssembly); diff --git a/src/libraries/System.CodeDom/tests/System/CodeDom/TempFileCollectionTests.cs b/src/libraries/System.CodeDom/tests/System/CodeDom/TempFileCollectionTests.cs index 0fce53d4f8772d..6385422015123f 100644 --- a/src/libraries/System.CodeDom/tests/System/CodeDom/TempFileCollectionTests.cs +++ b/src/libraries/System.CodeDom/tests/System/CodeDom/TempFileCollectionTests.cs @@ -59,7 +59,7 @@ public void Ctor_Empty() [InlineData(null)] [InlineData("")] [InlineData("TempDir")] - public void Ctor_String(string tempDir) + public void Ctor_String(string? tempDir) { var collection = new TempFileCollection(tempDir); Assert.Equal(0, collection.Count); @@ -71,7 +71,7 @@ public void Ctor_String(string tempDir) [InlineData(null, false)] [InlineData("", true)] [InlineData("TempDir", false)] - public void Ctor_String_Bool(string tempDir, bool keepFiles) + public void Ctor_String_Bool(string? tempDir, bool keepFiles) { var collection = new TempFileCollection(tempDir, keepFiles); Assert.Equal(0, collection.Count); @@ -116,7 +116,7 @@ public void AddFileExtension() [Theory] [InlineData(null)] [InlineData("")] - public void AddExtension_InvalidFileExtension_ThrowsArgumentException(string fileExtension) + public void AddExtension_InvalidFileExtension_ThrowsArgumentException(string? fileExtension) { using (var collection = new TempFileCollection()) { @@ -199,7 +199,7 @@ public void AddFile_MultipleFiles_DeletesAllIfKeepFilesFalse(bool keepFiles) [Theory] [InlineData(null)] [InlineData("")] - public void AddFile_InvalidFileName_ThrowsArgumentException(string fileName) + public void AddFile_InvalidFileName_ThrowsArgumentException(string? fileName) { using (var collection = new TempFileCollection()) { diff --git a/src/libraries/System.Collections.NonGeneric/tests/CaseInsensitiveComparerTests.cs b/src/libraries/System.Collections.NonGeneric/tests/CaseInsensitiveComparerTests.cs index 81dcc28a9165e7..dc16af257bf186 100644 --- a/src/libraries/System.Collections.NonGeneric/tests/CaseInsensitiveComparerTests.cs +++ b/src/libraries/System.Collections.NonGeneric/tests/CaseInsensitiveComparerTests.cs @@ -24,7 +24,7 @@ public class CaseInsensitiveComparerTests [InlineData(5, null, 1)] [InlineData(null, 5, -1)] [InlineData(null, null, 0)] - public void Ctor_Empty_Compare(object a, object b, int expected) + public void Ctor_Empty_Compare(object? a, object? b, int expected) { CaseInsensitiveComparer comparer = new CaseInsensitiveComparer(); Assert.Equal(expected, Math.Sign(comparer.Compare(a, b))); @@ -43,7 +43,7 @@ public void Ctor_Empty_Compare(object a, object b, int expected) [InlineData(5, null, 1)] [InlineData(null, 5, -1)] [InlineData(null, null, 0)] - public void Ctor_CultureInfo_Compare(object a, object b, int expected) + public void Ctor_CultureInfo_Compare(object? a, object? b, int expected) { var cultureNames = Helpers.TestCultureNames; @@ -118,7 +118,7 @@ public void Ctor_CultureInfo_NullCulture_ThrowsArgumentNullException() [InlineData(5, null, 1)] [InlineData(null, 5, -1)] [InlineData(null, null, 0)] - public void DefaultInvariant_Compare(object a, object b, int expected) + public void DefaultInvariant_Compare(object? a, object? b, int expected) { var cultureNames = Helpers.TestCultureNames; @@ -157,7 +157,7 @@ public void DefaultInvariant_Compare(object a, object b, int expected) [InlineData(5, null, 1)] [InlineData(null, 5, -1)] [InlineData(null, null, 0)] - public void Default_Compare(object a, object b, int expected) + public void Default_Compare(object? a, object? b, int expected) { Assert.Equal(expected, Math.Sign(CaseInsensitiveComparer.Default.Compare(a, b))); } diff --git a/src/libraries/System.Collections.NonGeneric/tests/ComparerTests.cs b/src/libraries/System.Collections.NonGeneric/tests/ComparerTests.cs index 98662f8152eca9..371aa6e923a4d2 100644 --- a/src/libraries/System.Collections.NonGeneric/tests/ComparerTests.cs +++ b/src/libraries/System.Collections.NonGeneric/tests/ComparerTests.cs @@ -22,7 +22,7 @@ public class ComparerTests [InlineData(1, null, 1)] [InlineData(null, null, 0)] [InlineData(null, 1, -1)] - public void Ctor_CultureInfo(object a, object b, int expected) + public void Ctor_CultureInfo(object? a, object? b, int expected) { var culture = new CultureInfo("en-US"); var comparer = new Comparer(culture); diff --git a/src/libraries/System.Collections.Specialized/tests/StringDictionary/StringDictionary.ContainsValueTests.cs b/src/libraries/System.Collections.Specialized/tests/StringDictionary/StringDictionary.ContainsValueTests.cs index 164991333fb299..8d694825ab9fd6 100644 --- a/src/libraries/System.Collections.Specialized/tests/StringDictionary/StringDictionary.ContainsValueTests.cs +++ b/src/libraries/System.Collections.Specialized/tests/StringDictionary/StringDictionary.ContainsValueTests.cs @@ -29,7 +29,7 @@ public void ContainsValue_NoSuchValue_ReturnsFalse(int count) [Theory] [InlineData("value")] [InlineData(null)] - public void ContainsValue_DuplicateValues(string value) + public void ContainsValue_DuplicateValues(string? value) { StringDictionary stringDictionary = new StringDictionary(); stringDictionary.Add("key1", value); diff --git a/src/libraries/System.Collections/tests/Generic/Dictionary/Dictionary.Generic.Tests.ConcurrentAccessDetection.cs b/src/libraries/System.Collections/tests/Generic/Dictionary/Dictionary.Generic.Tests.ConcurrentAccessDetection.cs index 1bfbe361b60391..6e465881483bf7 100644 --- a/src/libraries/System.Collections/tests/Generic/Dictionary/Dictionary.Generic.Tests.ConcurrentAccessDetection.cs +++ b/src/libraries/System.Collections/tests/Generic/Dictionary/Dictionary.Generic.Tests.ConcurrentAccessDetection.cs @@ -40,7 +40,7 @@ private async Task DictionaryConcurrentAccessDetection(Dictionary< [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [InlineData(null)] [InlineData(typeof(CustomEqualityComparerInt32ValueType))] - public async Task DictionaryConcurrentAccessDetection_ValueTypeKey(Type comparerType) + public async Task DictionaryConcurrentAccessDetection_ValueTypeKey(Type? comparerType) { IEqualityComparer customComparer = null; @@ -62,7 +62,7 @@ await DictionaryConcurrentAccessDetection(dic, [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [InlineData(null)] [InlineData(typeof(CustomEqualityComparerDummyRefType))] - public async Task DictionaryConcurrentAccessDetection_ReferenceTypeKey(Type comparerType) + public async Task DictionaryConcurrentAccessDetection_ReferenceTypeKey(Type? comparerType) { IEqualityComparer customComparer = null; diff --git a/src/libraries/System.ComponentModel.EventBasedAsync/tests/DoWorkEventArgsTests.cs b/src/libraries/System.ComponentModel.EventBasedAsync/tests/DoWorkEventArgsTests.cs index a4360c62f29478..b881e9dc6c468f 100644 --- a/src/libraries/System.ComponentModel.EventBasedAsync/tests/DoWorkEventArgsTests.cs +++ b/src/libraries/System.ComponentModel.EventBasedAsync/tests/DoWorkEventArgsTests.cs @@ -10,7 +10,7 @@ public static class DoWorkEventArgsTests [Theory] [InlineData(null)] [InlineData("non null test argument")] - public static void CtorTest(object expectedArgument) + public static void CtorTest(object? expectedArgument) { var target = new DoWorkEventArgs(expectedArgument); Assert.Equal(expectedArgument, target.Argument); @@ -30,7 +30,7 @@ public static void CancelPropertyTest(bool expectedCancel) [Theory] [InlineData(null)] [InlineData("non null test result")] - public static void ResultPropertyTest(object expectedResult) + public static void ResultPropertyTest(object? expectedResult) { var target = new DoWorkEventArgs(null) { Result = expectedResult }; Assert.Equal(expectedResult, target.Result); diff --git a/src/libraries/System.ComponentModel.EventBasedAsync/tests/ProgressChangedEventArgsTests.cs b/src/libraries/System.ComponentModel.EventBasedAsync/tests/ProgressChangedEventArgsTests.cs index 40ce768981a669..5a5a655b13fa94 100644 --- a/src/libraries/System.ComponentModel.EventBasedAsync/tests/ProgressChangedEventArgsTests.cs +++ b/src/libraries/System.ComponentModel.EventBasedAsync/tests/ProgressChangedEventArgsTests.cs @@ -11,7 +11,7 @@ public static class ProgressChangedEventArgsTests [InlineData(int.MinValue, null)] [InlineData(0, "non null test state")] [InlineData(int.MaxValue, "non null test state")] - public static void CtorAcceptsValuesAsIs(int expectedPercentage, object expectedState) + public static void CtorAcceptsValuesAsIs(int expectedPercentage, object? expectedState) { var target = new ProgressChangedEventArgs(expectedPercentage, expectedState); Assert.Equal(expectedPercentage, target.ProgressPercentage); diff --git a/src/libraries/System.ComponentModel.EventBasedAsync/tests/RunWorkerCompletedEventArgsTests.cs b/src/libraries/System.ComponentModel.EventBasedAsync/tests/RunWorkerCompletedEventArgsTests.cs index 5b3d36c599cd32..42a5b17b8ec8c6 100644 --- a/src/libraries/System.ComponentModel.EventBasedAsync/tests/RunWorkerCompletedEventArgsTests.cs +++ b/src/libraries/System.ComponentModel.EventBasedAsync/tests/RunWorkerCompletedEventArgsTests.cs @@ -28,7 +28,7 @@ public static IEnumerable TestInput [Theory] [InlineData(null)] [InlineData("non null")] - public static void CtorTest(object expectedResult) + public static void CtorTest(object? expectedResult) { var target = new RunWorkerCompletedEventArgs(expectedResult, null, false); Assert.Same(expectedResult, target.Result); diff --git a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/CategoryAttributeTests.cs b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/CategoryAttributeTests.cs index a30c2d80edfe0d..6001609fd25995 100644 --- a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/CategoryAttributeTests.cs +++ b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/CategoryAttributeTests.cs @@ -22,7 +22,7 @@ public void Ctor_Default() [InlineData("category", false)] [InlineData("Misc", true)] [InlineData("misc", false)] - public void Ctor_String(string category, bool expectedIsDefaultAttribute) + public void Ctor_String(string? category, bool expectedIsDefaultAttribute) { var attribute = new CategoryAttribute(category); Assert.Equal(category, attribute.Category); @@ -114,7 +114,7 @@ public void GetLocalizedString_InvokeValueExists_ReturnsNonEmpty(string value) [InlineData(null)] [InlineData("")] [InlineData("value")] - public void GetLocalizedString_InvokeNoSuchValue_ReturnsNull(string value) + public void GetLocalizedString_InvokeNoSuchValue_ReturnsNull(string? value) { var attribute = new SubCategoryAttribute(); Assert.Null(attribute.GetLocalizedString(value)); diff --git a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/ComponentTests.cs b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/ComponentTests.cs index d8ef543b7af159..245d152ee1d2a5 100644 --- a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/ComponentTests.cs +++ b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/ComponentTests.cs @@ -234,7 +234,7 @@ public void Finalize_Invoke_DoesNotCallDisposedEvent() [Theory] [InlineData(null)] [InlineData(typeof(int))] - public void GetService_InvokeWithoutSite_ReturnsNull(Type serviceType) + public void GetService_InvokeWithoutSite_ReturnsNull(Type? serviceType) { var component = new SubComponent(); Assert.Null(component.GetService(serviceType)); @@ -245,7 +245,7 @@ public void GetService_InvokeWithoutSite_ReturnsNull(Type serviceType) [InlineData(null, typeof(bool))] [InlineData(typeof(int), null)] [InlineData(typeof(int), typeof(bool))] - public void GetService_InvokeWithSite_ReturnsExpected(Type serviceType, Type result) + public void GetService_InvokeWithSite_ReturnsExpected(Type? serviceType, Type? result) { var site = new MockSite { diff --git a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DescriptionAttributeTests.cs b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DescriptionAttributeTests.cs index cc1ba193cd0905..584492a94448cb 100644 --- a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DescriptionAttributeTests.cs +++ b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DescriptionAttributeTests.cs @@ -21,7 +21,7 @@ public void Ctor_Default() [InlineData(null, false)] [InlineData("", true)] [InlineData("description", false)] - public void Ctor_String(string description, bool expectedIsDefaultAttribute) + public void Ctor_String(string? description, bool expectedIsDefaultAttribute) { var attribute = new SubDescriptionAttribute(description); Assert.Equal(description, attribute.Description); @@ -33,7 +33,7 @@ public void Ctor_String(string description, bool expectedIsDefaultAttribute) [InlineData(null)] [InlineData("")] [InlineData("descriptionValue")] - public void DescriptionValue_Set_GetReturnsExpected(string value) + public void DescriptionValue_Set_GetReturnsExpected(string? value) { var attribute = new SubDescriptionAttribute("Name") { diff --git a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DesignerAttributeTests.cs b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DesignerAttributeTests.cs index 4b7246eadd00dd..45820d63a187cf 100644 --- a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DesignerAttributeTests.cs +++ b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DesignerAttributeTests.cs @@ -35,7 +35,7 @@ public void Ctor_Type(Type designerType) [InlineData("", null)] [InlineData("designerTypeName", "")] [InlineData("designerTypeName.dll", "designerBaseTypeName")] - public void Ctor_String_String(string designerTypeName, string designerBaseTypeName) + public void Ctor_String_String(string designerTypeName, string? designerBaseTypeName) { var attribute = new DesignerAttribute(designerTypeName, designerBaseTypeName); Assert.Equal(designerTypeName, attribute.DesignerTypeName); diff --git a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DesignerCategoryAttributeTests.cs b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DesignerCategoryAttributeTests.cs index f51ef8eeabe62d..4e3dc312f4f404 100644 --- a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DesignerCategoryAttributeTests.cs +++ b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DesignerCategoryAttributeTests.cs @@ -21,7 +21,7 @@ public void Ctor_Default() [InlineData(null, false, "System.ComponentModel.DesignerCategoryAttribute")] [InlineData("", true, "System.ComponentModel.DesignerCategoryAttribute")] [InlineData("category", false, "System.ComponentModel.DesignerCategoryAttributecategory")] - public void Ctor_String(string category, bool expectedIsDefaultAttribute, string expectedTypeId) + public void Ctor_String(string? category, bool expectedIsDefaultAttribute, string expectedTypeId) { var attribute = new DesignerCategoryAttribute(category); Assert.Equal(category, attribute.Category); diff --git a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DisplayNameAttributeTests.cs b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DisplayNameAttributeTests.cs index c9dd2b9081b546..63d32a97624873 100644 --- a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DisplayNameAttributeTests.cs +++ b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/DisplayNameAttributeTests.cs @@ -21,7 +21,7 @@ public void Ctor_Default() [InlineData(null, false)] [InlineData("", true)] [InlineData("displayName", false)] - public void Ctor_String(string displayName, bool expectedIsDefaultAttribute) + public void Ctor_String(string? displayName, bool expectedIsDefaultAttribute) { var attribute = new SubDisplayNameAttribute(displayName); Assert.Equal(displayName, attribute.DisplayName); @@ -33,7 +33,7 @@ public void Ctor_String(string displayName, bool expectedIsDefaultAttribute) [InlineData(null)] [InlineData("")] [InlineData("displayName")] - public void DisplayNameValue_Set_GetReturnsExpected(string value) + public void DisplayNameValue_Set_GetReturnsExpected(string? value) { var attribute = new SubDisplayNameAttribute("Name") { diff --git a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/EditorAttributeTests.cs b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/EditorAttributeTests.cs index 8bf926578c1b8a..5c57ecfb46c8d6 100644 --- a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/EditorAttributeTests.cs +++ b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/EditorAttributeTests.cs @@ -21,7 +21,7 @@ public void Ctor_Default() [InlineData("", null)] [InlineData("typeName", "")] [InlineData("typeName.dll", "baseTypeName")] - public void Ctor_String_String(string typeName, string baseTypeName) + public void Ctor_String_String(string typeName, string? baseTypeName) { var attribute = new EditorAttribute(typeName, baseTypeName); Assert.Equal(typeName, attribute.EditorTypeName); diff --git a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/InitializationEventAttributeTests.cs b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/InitializationEventAttributeTests.cs index 49013a9a5980ae..f23046b5eb51c9 100644 --- a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/InitializationEventAttributeTests.cs +++ b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/InitializationEventAttributeTests.cs @@ -11,7 +11,7 @@ public class InitializationEventAttributeTests [InlineData(null)] [InlineData("")] [InlineData("test name")] - public void Ctor_EventName(string eventName) + public void Ctor_EventName(string? eventName) { var attribute = new InitializationEventAttribute(eventName); Assert.Equal(eventName, attribute.EventName); diff --git a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/InvalidEnumArgumentExceptionTests.cs b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/InvalidEnumArgumentExceptionTests.cs index 4b6187edc248df..2a90bfd6177650 100644 --- a/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/InvalidEnumArgumentExceptionTests.cs +++ b/src/libraries/System.ComponentModel.Primitives/tests/System/ComponentModel/InvalidEnumArgumentExceptionTests.cs @@ -25,7 +25,7 @@ public void Ctor_Default() [InlineData(null)] [InlineData("")] [InlineData("message")] - public void Ctor_Message(string message) + public void Ctor_Message(string? message) { var exception = new InvalidEnumArgumentException(message); if (message == null) @@ -68,7 +68,7 @@ public void Ctor_Message_InnerException(string message, Exception innerException [InlineData(null, 0, typeof(int))] [InlineData("", 1, typeof(int))] [InlineData("argumentName", int.MaxValue, typeof(int))] - public void Ctor_ArgumentName_InvalidValue_EnumClass(string argumentName, int invalidValue, Type enumClass) + public void Ctor_ArgumentName_InvalidValue_EnumClass(string? argumentName, int invalidValue, Type enumClass) { var exception = new InvalidEnumArgumentException(argumentName, invalidValue, enumClass); if (argumentName != null) diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/AddingNewEventArgsTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/AddingNewEventArgsTests.cs index 9d024f010d8f3c..e80facd9d56cdc 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/AddingNewEventArgsTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/AddingNewEventArgsTests.cs @@ -17,7 +17,7 @@ public void Ctor_Default() [Theory] [InlineData(null)] [InlineData("newObject")] - public void Ctor_NewObject(object newObject) + public void Ctor_NewObject(object? newObject) { var args = new AddingNewEventArgs(newObject); Assert.Same(newObject, args.NewObject); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/AmbientValueAttributeTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/AmbientValueAttributeTests.cs index 9af0e61f424e65..cec74c972f51c9 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/AmbientValueAttributeTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/AmbientValueAttributeTests.cs @@ -15,7 +15,7 @@ public class AmbientValueAttributeTests [InlineData(typeof(int*), "1", null)] [InlineData(typeof(string), "1", "1")] [InlineData(typeof(int), "1", 1)] - public void Ctor_Type_Value(Type type, string value, object expectedValue) + public void Ctor_Type_Value(Type? type, string? value, object? expectedValue) { var attribute = new AmbientValueAttribute(type, value); Assert.Equal(expectedValue, attribute.Value); @@ -88,7 +88,7 @@ public void Ctor_Bool() [Theory] [InlineData(null)] [InlineData("Value")] - public void Ctor_String(string value) + public void Ctor_String(string? value) { var args = new AmbientValueAttribute(value); Assert.Same(value, args.Value); @@ -97,7 +97,7 @@ public void Ctor_String(string value) [Theory] [InlineData(null)] [InlineData("Value")] - public void Ctor_Object(object value) + public void Ctor_Object(object? value) { var args = new AmbientValueAttribute(value); Assert.Same(value, args.Value); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/ArrayConverterTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/ArrayConverterTests.cs index ed5751c0bb27d8..92502f3ca41814 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/ArrayConverterTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/ArrayConverterTests.cs @@ -124,7 +124,7 @@ public void GetProperties_SetValueOutOfRangeWithHandler_CallsValueChanged() [Theory] [InlineData(null)] [InlineData("nonArrayValue")] - public void GetProperties_GetSetInvalidValue_Nop(string value) + public void GetProperties_GetSetInvalidValue_Nop(string? value) { var array = new int[] { 1, 2, 3 }; PropertyDescriptor property = Converter.GetProperties(array)[2]; diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/BindingListTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/BindingListTests.cs index 4d56a15105942d..8fdd9ef1a2da79 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/BindingListTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/BindingListTests.cs @@ -810,7 +810,7 @@ public void ItemPropertyChanged_RaiseListChangedEventsFalse_InvokesItemChanged() [Theory] [InlineData(null)] [InlineData("sender")] - public void ItemPropertyChanged_InvalidSender_InvokesReset(object invokeSender) + public void ItemPropertyChanged_InvalidSender_InvokesReset(object? invokeSender) { var item = new Item(); var bindingList = new BindingList { item }; diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/CollectionChangedEventArgsTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/CollectionChangedEventArgsTests.cs index 256be7e1a9bd29..da994ca965c6de 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/CollectionChangedEventArgsTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/CollectionChangedEventArgsTests.cs @@ -13,7 +13,7 @@ public class CollectionChangedEventArgsTests [InlineData(CollectionChangeAction.Refresh, "element")] [InlineData(CollectionChangeAction.Add - 1, "element")] [InlineData(CollectionChangeAction.Refresh + 1, "element")] - public void Ctor_Action_Element(CollectionChangeAction action, object element) + public void Ctor_Action_Element(CollectionChangeAction action, object? element) { var args = new CollectionChangeEventArgs(action, element); Assert.Equal(action, args.Action); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/ComplexBindingPropertiesAttributeTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/ComplexBindingPropertiesAttributeTests.cs index 6b73ee3c16c493..d6ecb12640fd2b 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/ComplexBindingPropertiesAttributeTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/ComplexBindingPropertiesAttributeTests.cs @@ -19,7 +19,7 @@ public void Ctor_Default() [Theory] [InlineData("DataSource")] [InlineData(null)] - public void Ctor_DataSource(string dataSource) + public void Ctor_DataSource(string? dataSource) { var attribute = new ComplexBindingPropertiesAttribute(dataSource); Assert.Same(dataSource, attribute.DataSource); @@ -29,7 +29,7 @@ public void Ctor_DataSource(string dataSource) [Theory] [InlineData("DataSource", "DataMember")] [InlineData(null, null)] - public void Ctor_DataSource_DataMember(string dataSource, string dataMember) + public void Ctor_DataSource_DataMember(string? dataSource, string? dataMember) { var attribute = new ComplexBindingPropertiesAttribute(dataSource, dataMember); Assert.Same(dataSource, attribute.DataSource); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/CustomTypeDescriptorTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/CustomTypeDescriptorTests.cs index 80c40e50d24377..ebaacd6661ea9b 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/CustomTypeDescriptorTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/CustomTypeDescriptorTests.cs @@ -58,7 +58,7 @@ public void GetClassName_InvokeWithoutParent_ReturnsNull() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] [InlineData(null)] [InlineData("name")] - public void GetClassName_InvokeWithParent_ReturnsExpected(string result) + public void GetClassName_InvokeWithParent_ReturnsExpected(string? result) { var mockParentDescriptor = new Mock(MockBehavior.Strict); mockParentDescriptor @@ -88,7 +88,7 @@ public void GetComponentName_InvokeWithoutParent_ReturnsNull() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] [InlineData(null)] [InlineData("name")] - public void GetComponentName_InvokeWithParent_ReturnsExpected(string result) + public void GetComponentName_InvokeWithParent_ReturnsExpected(string? result) { var mockParentDescriptor = new Mock(MockBehavior.Strict); mockParentDescriptor @@ -214,7 +214,7 @@ public void GetDefaultProperty_InvokeWithParent_ReturnsExpected(PropertyDescript [Theory] [InlineData(null)] [InlineData(typeof(int))] - public void GetEditor_InvokeWithoutParent_ReturnsNull(Type editorBaseType) + public void GetEditor_InvokeWithoutParent_ReturnsNull(Type? editorBaseType) { var descriptor = new SubCustomTypeDescriptor(); Assert.Null(descriptor.GetEditor(editorBaseType)); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/DefaultBindingPropertyAttributeTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/DefaultBindingPropertyAttributeTests.cs index 72ed0d51b12b7e..97671ef25f8d0c 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/DefaultBindingPropertyAttributeTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/DefaultBindingPropertyAttributeTests.cs @@ -18,7 +18,7 @@ public void Ctor_Default() [Theory] [InlineData(null)] [InlineData("name")] - public void Ctor_Name(string name) + public void Ctor_Name(string? name) { var attribute = new DefaultBindingPropertyAttribute(name); Assert.Equal(name, attribute.Name); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/DefaultEventAttributeTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/DefaultEventAttributeTests.cs index 4f0295e2046371..e9899aa1b2ac7b 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/DefaultEventAttributeTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/DefaultEventAttributeTests.cs @@ -11,7 +11,7 @@ public class DefaultEventAttributeTests [Theory] [InlineData(null)] [InlineData("name")] - public void Ctor_Name(string name) + public void Ctor_Name(string? name) { var attribute = new DefaultEventAttribute(name); Assert.Equal(name, attribute.Name); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/DefaultPropertyAttributeTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/DefaultPropertyAttributeTests.cs index 84fe3dcc6b6367..33caccbca4d2f4 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/DefaultPropertyAttributeTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/DefaultPropertyAttributeTests.cs @@ -11,7 +11,7 @@ public class DefaultPropertyAttributeTests [Theory] [InlineData(null)] [InlineData("name")] - public void Ctor_Name(string name) + public void Ctor_Name(string? name) { var attribute = new DefaultPropertyAttribute(name); Assert.Equal(name, attribute.Name); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesignerOptionServiceTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesignerOptionServiceTests.cs index d306714933c44c..1b6f5244d379fd 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesignerOptionServiceTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesignerOptionServiceTests.cs @@ -151,7 +151,7 @@ public void Indexer_ValidName_ReturnsExpected(string name) [Theory] [InlineData(null)] [InlineData("NoSuchName")] - public void Indexer_InvalidName_ReturnsNull(string name) + public void Indexer_InvalidName_ReturnsNull(string? name) { var service = new TestDesignerOptionService(); service.DoCreateOptionCollection(service.Options, "Name", "Value"); @@ -258,7 +258,7 @@ public void DesignerOptionConverterGetProperties_ValidValue_ReturnsExpected() [Theory] [InlineData("Value")] [InlineData(null)] - public void DesignerOptionConverterGetProperties_InvalidValue_ReturnsEmpty(object value) + public void DesignerOptionConverterGetProperties_InvalidValue_ReturnsEmpty(object? value) { TypeConverter converter = TypeDescriptor.GetConverter(typeof(DesignerOptionService.DesignerOptionCollection)); Assert.Empty(converter.GetProperties(value)); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesignerTransactionTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesignerTransactionTests.cs index 702e6b138fea8e..602db14cd229a9 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesignerTransactionTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesignerTransactionTests.cs @@ -21,7 +21,7 @@ public void Ctor_Default() [Theory] [InlineData(null)] [InlineData("Description")] - public void Ctor_Description(string description) + public void Ctor_Description(string? description) { using (var transaction = new TestDesignerTransaction(description)) { diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesignerVerbTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesignerVerbTests.cs index fdbf35d3df17f8..18e077486368fc 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesignerVerbTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesignerVerbTests.cs @@ -76,7 +76,7 @@ public void Ctor_NullProperties_ThrowsNullReferenceException() [InlineData(null, "")] [InlineData("", "")] [InlineData("Description", "Description")] - public void Description_GetWithProperties_ReturnsExpected(string value, string expected) + public void Description_GetWithProperties_ReturnsExpected(string? value, string expected) { var verb = new DesignerVerb("Text", new EventHandler(EventHandler)); verb.Properties["Description"] = value; @@ -102,7 +102,7 @@ public void Description_GetWithNullProperties_ThrowsNullReferenceException() [InlineData(null, "")] [InlineData("", "")] [InlineData("Description", "Description")] - public void Description_Set_GetReturnsExpected(string value, string expected) + public void Description_Set_GetReturnsExpected(string? value, string expected) { var verb = new DesignerVerb("Text", new EventHandler(EventHandler)) { @@ -128,7 +128,7 @@ public void Description_SetWithNullProperties_ThrowsNullReferenceException() [InlineData(null, "")] [InlineData("", "")] [InlineData("Text", "Text")] - public void Text_GetWithProperties_ReturnsExpected(string value, string expected) + public void Text_GetWithProperties_ReturnsExpected(string? value, string expected) { var verb = new DesignerVerb("Text", new EventHandler(EventHandler)); verb.Properties["Text"] = value; diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesigntimeLicenseContextTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesigntimeLicenseContextTests.cs index 054dac5427dbdb..3d3a03ee5b3652 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesigntimeLicenseContextTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/DesigntimeLicenseContextTests.cs @@ -31,7 +31,7 @@ public void GetService_Invoke_ReturnsNull() [Theory] [InlineData(null)] [InlineData("key")] - public void SetSavedLicenseKey_ValidType_Success(string key) + public void SetSavedLicenseKey_ValidType_Success(string? key) { var context = new DesigntimeLicenseContext(); context.SetSavedLicenseKey(typeof(int), key); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/Serialization/InstanceDescriptorTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/Serialization/InstanceDescriptorTests.cs index a2415f7b6d1fb7..a898d1bd009e9a 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/Serialization/InstanceDescriptorTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/Serialization/InstanceDescriptorTests.cs @@ -69,7 +69,7 @@ public void Constructor_ConstructorInfo_ICollection_Boolean() [Theory] [InlineData(null)] [InlineData(new object[] { new object[] { } })] - public void Ctor_ConstructorInfoArgumentMismatch_ThrowsArgumentException(object[] arguments) + public void Ctor_ConstructorInfoArgumentMismatch_ThrowsArgumentException(object[]? arguments) { ConstructorInfo ci = typeof(Uri).GetConstructor(new Type[] { typeof(string) }); AssertExtensions.Throws(null, () => new InstanceDescriptor(ci, arguments)); @@ -85,7 +85,7 @@ public void Ctor_StaticConstructor_ThrowsArgumentException() [Theory] [InlineData(null)] [InlineData(new object[] { new object[] { } })] - public void Ctor_FieldInfo_ICollection(object[] arguments) + public void Ctor_FieldInfo_ICollection(object[]? arguments) { FieldInfo fi = typeof(StaticField).GetField(nameof(StaticField.Field)); @@ -114,7 +114,7 @@ public void Ctor_NonStaticFieldInfo_ThrowsArgumentException() [Theory] [InlineData(null)] [InlineData(new object[] { new object[] { } })] - public void Ctor_PropertyInfo_ICollection(object[] arguments) + public void Ctor_PropertyInfo_ICollection(object[]? arguments) { PropertyInfo pi = typeof(StaticProperty).GetProperty(nameof(StaticProperty.Property)); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/Serialization/ResolveNameEventArgsTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/Serialization/ResolveNameEventArgsTests.cs index 1573983f6bba56..c9ac8dad6cbe29 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/Serialization/ResolveNameEventArgsTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/Serialization/ResolveNameEventArgsTests.cs @@ -10,7 +10,7 @@ public class ResolveNameEventArgsTests [Theory] [InlineData(null)] [InlineData("Name")] - public void Ctor_Name(string name) + public void Ctor_Name(string? name) { var eventArgs = new ResolveNameEventArgs(name); Assert.Same(name, eventArgs.Name); @@ -20,7 +20,7 @@ public void Ctor_Name(string name) [Theory] [InlineData(null)] [InlineData("Value")] - public void Value_Set_GetReturnsExpected(object value) + public void Value_Set_GetReturnsExpected(object? value) { var eventArgs = new ResolveNameEventArgs("Name") { Value = value }; Assert.Same(value, eventArgs.Value); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/Serialization/RootDesignerSerializerAttributeTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/Serialization/RootDesignerSerializerAttributeTests.cs index 08003d1f2d1c19..0db8e107eba1ec 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/Serialization/RootDesignerSerializerAttributeTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/Serialization/RootDesignerSerializerAttributeTests.cs @@ -36,7 +36,7 @@ public void Ctor_NullBaseSerializerType_ThrowsNullReferenceException() [Theory] [InlineData(null, typeof(int), true)] [InlineData("SerializerTypeName", typeof(DesignerSerializerAttribute), false)] - public void Ctor_SerializerTypeName_BaseSerializerType(string serializerTypeName, Type baseSerializerType, bool reloadable) + public void Ctor_SerializerTypeName_BaseSerializerType(string? serializerTypeName, Type baseSerializerType, bool reloadable) { var attribute = new RootDesignerSerializerAttribute(serializerTypeName, baseSerializerType, reloadable); Assert.Equal(serializerTypeName, attribute.SerializerTypeName); @@ -47,7 +47,7 @@ public void Ctor_SerializerTypeName_BaseSerializerType(string serializerTypeName [Theory] [InlineData(null, null, true)] [InlineData("SerializerTypeName", "BaseSerializerTypeName", false)] - public void Ctor_SerializerTypeName_BaseSerializerTypeName(string serializerTypeName, string baseSerializerTypeName, bool reloadable) + public void Ctor_SerializerTypeName_BaseSerializerTypeName(string? serializerTypeName, string? baseSerializerTypeName, bool reloadable) { var attribute = new RootDesignerSerializerAttribute(serializerTypeName, baseSerializerTypeName, reloadable); Assert.Equal(serializerTypeName, attribute.SerializerTypeName); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/ServiceContainerTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/ServiceContainerTests.cs index 846bb10e83196a..0adfe127b64aa3 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/Design/ServiceContainerTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/Design/ServiceContainerTests.cs @@ -519,7 +519,7 @@ public void GetService_DefaultService_ReturnsExpected(Type serviceType) [Theory] [InlineData(null)] [InlineData(typeof(int))] - public void GetService_NoSuchService_ReturnsNull(Type serviceType) + public void GetService_NoSuchService_ReturnsNull(Type? serviceType) { var container = new ServiceContainer(); Assert.Null(container.GetService(serviceType)); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/LicenseExceptionTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/LicenseExceptionTests.cs index e41b3b29e912fc..17a70680ce8244 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/LicenseExceptionTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/LicenseExceptionTests.cs @@ -13,7 +13,7 @@ public class LicenseExceptionTests [Theory] [InlineData(null)] [InlineData(typeof(int))] - public void Ctor_Type(Type type) + public void Ctor_Type(Type? type) { var exception = new LicenseException(type); Assert.Null(exception.InnerException); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/LicenseProviderAttributeTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/LicenseProviderAttributeTests.cs index 1963dcfd5864f8..591ee462e257ac 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/LicenseProviderAttributeTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/LicenseProviderAttributeTests.cs @@ -22,7 +22,7 @@ public void Ctor_Default() [InlineData("")] [InlineData("typeName")] [InlineData("System.Int32")] - public void Ctor_String(string typeName) + public void Ctor_String(string? typeName) { var attribute = new LicenseProviderAttribute(typeName); Assert.Equal(typeName == null ? null : Type.GetType(typeName), attribute.LicenseProvider); @@ -34,7 +34,7 @@ public void Ctor_String(string typeName) [InlineData(null)] [InlineData(typeof(int))] [InlineData(typeof(DesignerAttribute))] - public void Ctor_Type(Type type) + public void Ctor_Type(Type? type) { var attribute = new LicenseProviderAttribute(type); Assert.Same(type, attribute.LicenseProvider); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/LookupBindingPropertiesAttributeTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/LookupBindingPropertiesAttributeTests.cs index 2391d458cefd11..780f9e036e53bc 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/LookupBindingPropertiesAttributeTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/LookupBindingPropertiesAttributeTests.cs @@ -23,7 +23,7 @@ public void Ctor_Default() [InlineData(null, null, null, null)] [InlineData("", "", "", "")] [InlineData("dataSource", "displayMember", "valueMember", "lookupMember")] - public void Ctor_String_String_String_String(string dataSource, string displayMember, string valueMember, string lookupMember) + public void Ctor_String_String_String_String(string? dataSource, string? displayMember, string? valueMember, string? lookupMember) { var attribute = new LookupBindingPropertiesAttribute(dataSource, displayMember, valueMember, lookupMember); Assert.Equal(dataSource, attribute.DataSource); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs index 0d468201dad30f..33ab2c4d4a602f 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/MemberDescriptorTests.cs @@ -345,7 +345,7 @@ public void Category_GetWithCategoryAttribute_ReturnsExpected(CategoryAttribute [InlineData(null, "Category2")] [InlineData("", "")] [InlineData("Category", "Category")] - public void Category_GetModifyAttributesAndGet_CachesFirstResult(string originalCategory, string expected) + public void Category_GetModifyAttributesAndGet_CachesFirstResult(string? originalCategory, string expected) { var descriptor = new SubMemberDescriptor("Name", new Attribute[] { new CategoryAttribute(originalCategory) }); Assert.Equal(originalCategory, descriptor.Category); @@ -358,7 +358,7 @@ public void Category_GetModifyAttributesAndGet_CachesFirstResult(string original [InlineData(null)] [InlineData("")] [InlineData("Category")] - public void Category_DontGetModifyAttributesAndGet_DoesNotCacheFirstResult(string originalCategory) + public void Category_DontGetModifyAttributesAndGet_DoesNotCacheFirstResult(string? originalCategory) { var descriptor = new SubMemberDescriptor("Name", new Attribute[] { new CategoryAttribute(originalCategory) }); descriptor.AttributeArray = new Attribute[] { new CategoryAttribute("Category2") }; @@ -400,7 +400,7 @@ public void Description_GetWithDescriptionAttribute_ReturnsExpected(DescriptionA [InlineData(null, "Description2")] [InlineData("", "")] [InlineData("Description", "Description")] - public void Description_GetModifyDescriptionAttribute_CachesFirstResult(string originalDescription, string expected) + public void Description_GetModifyDescriptionAttribute_CachesFirstResult(string? originalDescription, string expected) { var attribute = new ChangingDescriptionAttribute { @@ -417,7 +417,7 @@ public void Description_GetModifyDescriptionAttribute_CachesFirstResult(string o [InlineData(null)] [InlineData("")] [InlineData("Description")] - public void Description_DontGetModifyDescriptionAttribute_DoesNotCacheFirstResult(string originalDescription) + public void Description_DontGetModifyDescriptionAttribute_DoesNotCacheFirstResult(string? originalDescription) { var attribute = new ChangingDescriptionAttribute { @@ -432,7 +432,7 @@ public void Description_DontGetModifyDescriptionAttribute_DoesNotCacheFirstResul [InlineData(null, "Description2")] [InlineData("", "")] [InlineData("Description", "Description")] - public void Description_GetModifyAttributesAndGet_CachesFirstResult(string originalDescription, string expected) + public void Description_GetModifyAttributesAndGet_CachesFirstResult(string? originalDescription, string expected) { var descriptor = new SubMemberDescriptor("Name", new Attribute[] { new DescriptionAttribute(originalDescription) }); Assert.Same(originalDescription, descriptor.Description); @@ -445,7 +445,7 @@ public void Description_GetModifyAttributesAndGet_CachesFirstResult(string origi [InlineData(null)] [InlineData("")] [InlineData("Description")] - public void Description_DontGetModifyAttributesAndGet_DoesNotCacheFirstResult(string originalDescription) + public void Description_DontGetModifyAttributesAndGet_DoesNotCacheFirstResult(string? originalDescription) { var descriptor = new SubMemberDescriptor("Name", new Attribute[] { new DescriptionAttribute(originalDescription) }); descriptor.AttributeArray = new Attribute[] { new DescriptionAttribute("Description2") }; @@ -535,7 +535,7 @@ public void DisplayName_GetWithDisplayNameAttribute_ReturnsExpected(DisplayNameA [InlineData(null, null)] [InlineData("", "Name")] [InlineData("DisplayName", "DisplayName")] - public void DisplayName_GetModifyDisplayNameAttribute_CachesFirstResult(string originalDisplayName, string expected) + public void DisplayName_GetModifyDisplayNameAttribute_CachesFirstResult(string? originalDisplayName, string? expected) { var attribute = new ChangingDisplayNameAttribute { @@ -552,7 +552,7 @@ public void DisplayName_GetModifyDisplayNameAttribute_CachesFirstResult(string o [InlineData(null)] [InlineData("")] [InlineData("DisplayName")] - public void DisplayName_DontGetModifyDisplayNameAttribute_DoesNotCacheFirstResult(string originalDisplayName) + public void DisplayName_DontGetModifyDisplayNameAttribute_DoesNotCacheFirstResult(string? originalDisplayName) { var attribute = new ChangingDisplayNameAttribute { @@ -567,7 +567,7 @@ public void DisplayName_DontGetModifyDisplayNameAttribute_DoesNotCacheFirstResul [InlineData(null, null)] [InlineData("", "Name")] [InlineData("DisplayName", "DisplayName")] - public void DisplayName_GetModifyAttributesAndGet_DoesNotCacheFirstResult(string originalDisplayName, string expected) + public void DisplayName_GetModifyAttributesAndGet_DoesNotCacheFirstResult(string? originalDisplayName, string? expected) { var descriptor = new SubMemberDescriptor("Name", new Attribute[] { new DisplayNameAttribute(originalDisplayName) }); Assert.Equal(expected, descriptor.DisplayName); @@ -580,7 +580,7 @@ public void DisplayName_GetModifyAttributesAndGet_DoesNotCacheFirstResult(string [InlineData(null)] [InlineData("")] [InlineData("DisplayName")] - public void DisplayName_DontGetModifyAttributesAndGet_DoesNotCacheFirstResult(string originalDisplayName) + public void DisplayName_DontGetModifyAttributesAndGet_DoesNotCacheFirstResult(string? originalDisplayName) { var descriptor = new SubMemberDescriptor("Name", new Attribute[] { new DisplayNameAttribute(originalDisplayName) }); descriptor.AttributeArray = new Attribute[] { new DisplayNameAttribute("DisplayName2") }; diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/NestedContainerTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/NestedContainerTests.cs index 16b3b8d159ae0f..2124ae1aee3ff9 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/NestedContainerTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/NestedContainerTests.cs @@ -50,7 +50,7 @@ public void OwnerName_HasINestedSite_ReturnsNull() [InlineData(null)] [InlineData("")] [InlineData("name")] - public void CreateSite_NullOwnerSite_Success(string name) + public void CreateSite_NullOwnerSite_Success(string? name) { var component = new Component(); @@ -68,7 +68,7 @@ public void CreateSite_NullOwnerSite_Success(string name) [InlineData(null)] [InlineData("")] [InlineData("name")] - public void Add_NonNullOwnerSite_Success(string name) + public void Add_NonNullOwnerSite_Success(string? name) { var component = new Component(); @@ -89,7 +89,7 @@ public void Add_NonNullOwnerSite_Success(string name) [InlineData("")] [InlineData("name")] [InlineData("newName")] - public void CreateSite_SetSiteName_Success(string value) + public void CreateSite_SetSiteName_Success(string? value) { var component = new Component(); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/ProvidePropertyAttributeTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/ProvidePropertyAttributeTests.cs index 8f227af7c0522d..e4640bcb7af4e2 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/ProvidePropertyAttributeTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/ProvidePropertyAttributeTests.cs @@ -13,7 +13,7 @@ public class ProvidePropertyAttributeTests [InlineData("", "")] [InlineData("propertyName", "invalidName")] [InlineData("propertyName", "System.Int32")] - public void Ctor_String_String(string propertyName, string receiverTypeName) + public void Ctor_String_String(string? propertyName, string? receiverTypeName) { var attribute = new ProvidePropertyAttribute(propertyName, receiverTypeName); Assert.Equal(propertyName, attribute.PropertyName); @@ -24,7 +24,7 @@ public void Ctor_String_String(string propertyName, string receiverTypeName) [InlineData(null, typeof(int))] [InlineData("", typeof(ProvidePropertyAttribute))] [InlineData("propertyName", typeof(ProvidePropertyAttributeTests))] - public void Ctor_String_Type(string propertyName, Type receiverType) + public void Ctor_String_Type(string? propertyName, Type receiverType) { var attribute = new ProvidePropertyAttribute(propertyName, receiverType); Assert.Equal(propertyName, attribute.PropertyName); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/RefreshEventArgsTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/RefreshEventArgsTests.cs index b3aa3cf1e804ae..8a0635f39e3650 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/RefreshEventArgsTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/RefreshEventArgsTests.cs @@ -11,7 +11,7 @@ public class RefreshEventArgsTests [Theory] [InlineData(null)] [InlineData(typeof(int))] - public void Ctor_Type(Type typeChanged) + public void Ctor_Type(Type? typeChanged) { var args = new RefreshEventArgs(typeChanged); Assert.Null(args.ComponentChanged); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverterTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverterTests.cs index 5a00c40b8daa13..06c5069ced2a18 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverterTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/Security/Authentication/ExtendedProtection/ExtendedProtectionPolicyTypeConverterTests.cs @@ -17,7 +17,7 @@ public class ExtendedProtectionPolicyTypeConverterTests [InlineData(null)] [InlineData(typeof(float))] [InlineData(typeof(TypeConverter))] - public void CanConvertTo_NegativeTests(Type destinationType) + public void CanConvertTo_NegativeTests(Type? destinationType) { Assert.False(converter.CanConvertTo(null, destinationType)); } diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/SyntaxCheckTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/SyntaxCheckTests.cs index 0c7238f36ff79a..2c5d43bc416f6b 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/SyntaxCheckTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/SyntaxCheckTests.cs @@ -14,7 +14,7 @@ public class SyntaxCheckTests [InlineData("machineName\\", false)] [InlineData("machineName", true)] [InlineData(" machineName ", true)] - public void CheckMachineName_Invoke_ReturnsExpected(string value, bool expected) + public void CheckMachineName_Invoke_ReturnsExpected(string? value, bool expected) { Assert.Equal(expected, SyntaxCheck.CheckMachineName(value)); } @@ -28,7 +28,7 @@ public void CheckMachineName_Invoke_ReturnsExpected(string value, bool expected) [InlineData("\\\\", true)] [InlineData("\\\\path", true)] [InlineData(" \\\\path", true)] - public void CheckPath_Invoke_ReturnsExpected(string value, bool expected) + public void CheckPath_Invoke_ReturnsExpected(string? value, bool expected) { Assert.Equal(expected, SyntaxCheck.CheckPath(value)); } @@ -38,7 +38,7 @@ public void CheckPath_Invoke_ReturnsExpected(string value, bool expected) [InlineData("", false)] [InlineData(" ", false)] [InlineData("path", false)] - public void CheckRootedPath_Invoke_ReturnsExpected(string value, bool expected) + public void CheckRootedPath_Invoke_ReturnsExpected(string? value, bool expected) { Assert.Equal(expected, SyntaxCheck.CheckRootedPath(value)); } diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/ToolboxItemFilterAttributeTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/ToolboxItemFilterAttributeTests.cs index 516cd8222f6ebf..0fa9870d460a5c 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/ToolboxItemFilterAttributeTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/ToolboxItemFilterAttributeTests.cs @@ -12,7 +12,7 @@ public class ToolboxItemFilterAttributeTests [InlineData(null)] [InlineData("")] [InlineData("filterString")] - public void Ctor_String(string filterString) + public void Ctor_String(string? filterString) { var attribute = new ToolboxItemFilterAttribute(filterString); Assert.Equal(filterString ?? string.Empty, attribute.FilterString); @@ -26,7 +26,7 @@ public void Ctor_String(string filterString) [InlineData("filterString", ToolboxItemFilterType.Require)] [InlineData("filterString", ToolboxItemFilterType.Allow - 1)] [InlineData("filterString", ToolboxItemFilterType.Require + 1)] - public void Ctor_String_ToolboxItemFilterType(string filterString, ToolboxItemFilterType filterType) + public void Ctor_String_ToolboxItemFilterType(string? filterString, ToolboxItemFilterType filterType) { var attribute = new ToolboxItemFilterAttribute(filterString, filterType); Assert.Equal(filterString ?? string.Empty, attribute.FilterString); @@ -37,7 +37,7 @@ public void Ctor_String_ToolboxItemFilterType(string filterString, ToolboxItemFi [InlineData(null, "System.ComponentModel.ToolboxItemFilterAttribute")] [InlineData("", "System.ComponentModel.ToolboxItemFilterAttribute")] [InlineData("filterString", "System.ComponentModel.ToolboxItemFilterAttributefilterString")] - public void TypeId_ValidEditorBaseTypeName_ReturnsExcepted(string filterType, object expected) + public void TypeId_ValidEditorBaseTypeName_ReturnsExcepted(string? filterType, object expected) { var attribute = new ToolboxItemFilterAttribute(filterType); Assert.Equal(expected, attribute.TypeId); @@ -98,7 +98,7 @@ public void Match_Object_ReturnsExpected(ToolboxItemFilterAttribute attribute, o [InlineData("filterString", ToolboxItemFilterType.Require, "filterString,Require")] [InlineData("filterString", ToolboxItemFilterType.Allow - 1, "filterString,")] [InlineData("filterString", ToolboxItemFilterType.Require + 1, "filterString,")] - public void ToString_Invoke_ReturnsExpected(string filterString, ToolboxItemFilterType filterType, string expected) + public void ToString_Invoke_ReturnsExpected(string? filterString, ToolboxItemFilterType filterType, string expected) { var attribute = new ToolboxItemFilterAttribute(filterString, filterType); Assert.Equal(expected, attribute.ToString()); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/TypeDescriptionProviderTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/TypeDescriptionProviderTests.cs index 5e840c0a4476e0..884ec70f878e30 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/TypeDescriptionProviderTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/TypeDescriptionProviderTests.cs @@ -340,7 +340,7 @@ public void GetFullComponentName_NullComponent_ReturnsNull() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] [InlineData(null)] [InlineData(typeof(int))] - public void GetReflectionType_InvokeTypeWithoutParent_ReturnsExpected(Type objectType) + public void GetReflectionType_InvokeTypeWithoutParent_ReturnsExpected(Type? objectType) { var provider = new SubTypeDescriptionProvider(); Assert.Same(objectType, provider.GetReflectionType(objectType)); @@ -353,7 +353,7 @@ public void GetReflectionType_InvokeTypeWithoutParent_ReturnsExpected(Type objec [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] [InlineData(null)] [InlineData(typeof(int))] - public void GetReflectionType_InvokeTypeWithoutParent_CallsTypeObjectOverload_ByType(Type objectType) + public void GetReflectionType_InvokeTypeWithoutParent_CallsTypeObjectOverload_ByType(Type? objectType) { var mockProvider = new Mock(MockBehavior.Strict); mockProvider @@ -430,7 +430,7 @@ public void GetReflectionType_InvokeTypeWithoutParent_CallsTypeObjectOverload_By [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] [InlineData(1, null)] [InlineData(1, typeof(object))] - public void GetReflectionType_InvokeObjectWithParent_ReturnsExpected(object instance, Type result) + public void GetReflectionType_InvokeObjectWithParent_ReturnsExpected(object instance, Type? result) { var mockParentProvider = new Mock(MockBehavior.Strict); mockParentProvider @@ -452,7 +452,7 @@ public void GetReflectionType_InvokeObjectWithParent_ReturnsExpected(object inst [InlineData(null, 1)] [InlineData(typeof(object), null)] [InlineData(typeof(object), 1)] - public void GetReflectionType_InvokeTypeObjectWithoutParent_ReturnsExpected(Type objectType, object instance) + public void GetReflectionType_InvokeTypeObjectWithoutParent_ReturnsExpected(Type? objectType, object? instance) { var provider = new SubTypeDescriptionProvider(); Assert.Same(objectType, provider.GetReflectionType(objectType, instance)); @@ -475,7 +475,7 @@ public static IEnumerable GetReflectionType_TypeObjectWithParent_TestD // Moq heavily utilizes RefEmit, which does not work on most aot workloads [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] [MemberData(nameof(GetReflectionType_TypeObjectWithParent_TestData))] - public void GetReflectionType_InvokeTypeObjectWithParent_ReturnsExpected(Type objectType, object instance, Type result) + public void GetReflectionType_InvokeTypeObjectWithParent_ReturnsExpected(Type? objectType, object? instance, Type? result) { var mockParentProvider = new Mock(MockBehavior.Strict); mockParentProvider @@ -524,7 +524,7 @@ public void GetRuntimeType_InvokeWithoutParentSystemDefinedType_ReturnsSame(Type [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] [InlineData(null)] [InlineData(typeof(int))] - public void GetRuntimeType_InvokeWithoutParentWithUserDefinedType_RetunsUnderlyingSystemType(Type result) + public void GetRuntimeType_InvokeWithoutParentWithUserDefinedType_RetunsUnderlyingSystemType(Type? result) { var mockType = new Mock(MockBehavior.Strict); mockType @@ -580,7 +580,7 @@ public void GetRuntimeType_NullReflectionType_ThrowsArgumentNullException() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] [InlineData(null)] [InlineData(typeof(int))] - public void GetTypeDescriptor_InvokeTypeWithoutParent_ReturnsExpected(Type objectType) + public void GetTypeDescriptor_InvokeTypeWithoutParent_ReturnsExpected(Type? objectType) { var provider = new SubTypeDescriptionProvider(); CustomTypeDescriptor result1 = Assert.IsAssignableFrom(provider.GetTypeDescriptor(objectType)); @@ -595,7 +595,7 @@ public void GetTypeDescriptor_InvokeTypeWithoutParent_ReturnsExpected(Type objec [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsReflectionEmitSupported))] [InlineData(null)] [InlineData(typeof(int))] - public void GetTypeDescriptor_InvokeTypeWithoutParent_CallsTypeObjectOverload_Type(Type objectType) + public void GetTypeDescriptor_InvokeTypeWithoutParent_CallsTypeObjectOverload_Type(Type? objectType) { var mockProvider = new Mock(MockBehavior.Strict); mockProvider @@ -713,7 +713,7 @@ public void GetTypeDescriptor_InvokeObjectWithParent_ReturnsExpected(object inst [InlineData(null, 1)] [InlineData(typeof(object), null)] [InlineData(typeof(object), 1)] - public void GetTypeDescriptor_InvokeTypeObjectWithoutParent_ReturnsExpected(Type objectType, object instance) + public void GetTypeDescriptor_InvokeTypeObjectWithoutParent_ReturnsExpected(Type? objectType, object? instance) { var provider = new SubTypeDescriptionProvider(); CustomTypeDescriptor result1 = Assert.IsAssignableFrom(provider.GetTypeDescriptor(objectType, instance)); diff --git a/src/libraries/System.ComponentModel.TypeConverter/tests/WarningExceptionTests.cs b/src/libraries/System.ComponentModel.TypeConverter/tests/WarningExceptionTests.cs index 0940a0b7497198..61bbe30898205b 100644 --- a/src/libraries/System.ComponentModel.TypeConverter/tests/WarningExceptionTests.cs +++ b/src/libraries/System.ComponentModel.TypeConverter/tests/WarningExceptionTests.cs @@ -50,7 +50,7 @@ public void Ctor_String_Exception(string message) [InlineData("message", null)] [InlineData("message", "")] [InlineData("message", "helpUrl")] - public void Ctor_String_String(string message, string helpUrl) + public void Ctor_String_String(string message, string? helpUrl) { var exception = new WarningException(message, helpUrl); Assert.Null(exception.InnerException); @@ -64,7 +64,7 @@ public void Ctor_String_String(string message, string helpUrl) [InlineData("message", null, null)] [InlineData("message", "", "")] [InlineData("message", "helpUrl", "helpTopic")] - public void Ctor_String_String_String(string message, string helpUrl, string helpTopic) + public void Ctor_String_String_String(string message, string? helpUrl, string? helpTopic) { var exception = new WarningException(message, helpUrl, helpTopic); Assert.Null(exception.InnerException); diff --git a/src/libraries/System.Composition.AttributedModel/tests/ExportAttributeTests.cs b/src/libraries/System.Composition.AttributedModel/tests/ExportAttributeTests.cs index 7b937721973c38..4d01ae58799eaf 100644 --- a/src/libraries/System.Composition.AttributedModel/tests/ExportAttributeTests.cs +++ b/src/libraries/System.Composition.AttributedModel/tests/ExportAttributeTests.cs @@ -18,7 +18,7 @@ public void Ctor_Default() [Theory] [InlineData(null)] [InlineData("ContractName")] - public void Ctor_ContractName(string contractName) + public void Ctor_ContractName(string? contractName) { var attribute = new ExportAttribute(contractName); Assert.Equal(contractName, attribute.ContractName); @@ -28,7 +28,7 @@ public void Ctor_ContractName(string contractName) [Theory] [InlineData(null)] [InlineData(typeof(string))] - public void Ctor_ContractType(Type contractType) + public void Ctor_ContractType(Type? contractType) { var attribute = new ExportAttribute(contractType); Assert.Null(attribute.ContractName); @@ -38,7 +38,7 @@ public void Ctor_ContractType(Type contractType) [Theory] [InlineData(null, null)] [InlineData("ContractName", typeof(string))] - public void Ctor_ContractName_ContractType(string contractName, Type contractType) + public void Ctor_ContractName_ContractType(string? contractName, Type? contractType) { var attribute = new ExportAttribute(contractName, contractType); Assert.Equal(contractName, attribute.ContractName); diff --git a/src/libraries/System.Composition.AttributedModel/tests/ExportMetadataAttributeTests.cs b/src/libraries/System.Composition.AttributedModel/tests/ExportMetadataAttributeTests.cs index 8fe4616fa560ef..23ef393e4c9d06 100644 --- a/src/libraries/System.Composition.AttributedModel/tests/ExportMetadataAttributeTests.cs +++ b/src/libraries/System.Composition.AttributedModel/tests/ExportMetadataAttributeTests.cs @@ -10,7 +10,7 @@ public class ExportMetadataAttributeTests [Theory] [InlineData(null, null)] [InlineData("Name", "Value")] - public void Ctor_Name_Value(string name, string value) + public void Ctor_Name_Value(string? name, string? value) { var attribute = new ExportMetadataAttribute(name, value); Assert.Equal(name ?? string.Empty, attribute.Name); diff --git a/src/libraries/System.Composition.AttributedModel/tests/ImportAttributeTests.cs b/src/libraries/System.Composition.AttributedModel/tests/ImportAttributeTests.cs index 03bcd3a707593b..3969defcfc1aaa 100644 --- a/src/libraries/System.Composition.AttributedModel/tests/ImportAttributeTests.cs +++ b/src/libraries/System.Composition.AttributedModel/tests/ImportAttributeTests.cs @@ -18,7 +18,7 @@ public void Ctor_Default() [Theory] [InlineData(null)] [InlineData("ContractName")] - public void Ctor_ContractName(string contractName) + public void Ctor_ContractName(string? contractName) { var attribute = new ImportAttribute(contractName); Assert.Equal(contractName, attribute.ContractName); diff --git a/src/libraries/System.Composition.AttributedModel/tests/ImportManyAttributeTests.cs b/src/libraries/System.Composition.AttributedModel/tests/ImportManyAttributeTests.cs index c8217cf83a8738..a94fac3d13e370 100644 --- a/src/libraries/System.Composition.AttributedModel/tests/ImportManyAttributeTests.cs +++ b/src/libraries/System.Composition.AttributedModel/tests/ImportManyAttributeTests.cs @@ -17,7 +17,7 @@ public void Ctor_Default() [Theory] [InlineData(null)] [InlineData("ContractName")] - public void Ctor_ContractName(string contractName) + public void Ctor_ContractName(string? contractName) { var attribute = new ImportManyAttribute(contractName); Assert.Equal(contractName, attribute.ContractName); diff --git a/src/libraries/System.Composition.AttributedModel/tests/ImportMetadataConstraintAttributeTests.cs b/src/libraries/System.Composition.AttributedModel/tests/ImportMetadataConstraintAttributeTests.cs index d737d254d8868e..91185117c580a9 100644 --- a/src/libraries/System.Composition.AttributedModel/tests/ImportMetadataConstraintAttributeTests.cs +++ b/src/libraries/System.Composition.AttributedModel/tests/ImportMetadataConstraintAttributeTests.cs @@ -10,7 +10,7 @@ public class ImportMetadataConstraintAttributeTests [Theory] [InlineData(null, null)] [InlineData("Name", "Value")] - public void Ctor_Name_Value(string name, string value) + public void Ctor_Name_Value(string? name, string? value) { var attribute = new ImportMetadataConstraintAttribute(name, value); Assert.Equal(name, attribute.Name); diff --git a/src/libraries/System.Composition.AttributedModel/tests/PartMetadataAttributeTests.cs b/src/libraries/System.Composition.AttributedModel/tests/PartMetadataAttributeTests.cs index 4c5353345ee2db..41c6f3a3ac4851 100644 --- a/src/libraries/System.Composition.AttributedModel/tests/PartMetadataAttributeTests.cs +++ b/src/libraries/System.Composition.AttributedModel/tests/PartMetadataAttributeTests.cs @@ -10,7 +10,7 @@ public class PartMetadataAttributeTests [Theory] [InlineData("", null)] [InlineData("Name", "Value")] - public void Ctor_Name_Value(string name, string value) + public void Ctor_Name_Value(string name, string? value) { var attribute = new PartMetadataAttribute(name, value); Assert.Equal(name, attribute.Name); diff --git a/src/libraries/System.Composition.AttributedModel/tests/SharedAttributeTests.cs b/src/libraries/System.Composition.AttributedModel/tests/SharedAttributeTests.cs index 374c0ca668644f..013a3fe440c51f 100644 --- a/src/libraries/System.Composition.AttributedModel/tests/SharedAttributeTests.cs +++ b/src/libraries/System.Composition.AttributedModel/tests/SharedAttributeTests.cs @@ -19,7 +19,7 @@ public void Ctor_Default() [Theory] [InlineData(null)] [InlineData("Name")] - public void Ctor_SharingBoundaryName(string sharingBoundaryName) + public void Ctor_SharingBoundaryName(string? sharingBoundaryName) { var attribute = new SharedAttribute(sharingBoundaryName); Assert.Equal(sharingBoundaryName, attribute.SharingBoundary); diff --git a/src/libraries/System.Composition.Hosting/tests/System/Composition/Hosting/Core/CompositionHostTests.cs b/src/libraries/System.Composition.Hosting/tests/System/Composition/Hosting/Core/CompositionHostTests.cs index f703345120442f..3fa0ea0153f339 100644 --- a/src/libraries/System.Composition.Hosting/tests/System/Composition/Hosting/Core/CompositionHostTests.cs +++ b/src/libraries/System.Composition.Hosting/tests/System/Composition/Hosting/Core/CompositionHostTests.cs @@ -105,7 +105,7 @@ public void GetExport_ImoportManyWithMetadataConstraints_ReturnsExpected(Type co [InlineData(typeof(ExportFactory), new string[] { "1", "2", "3" }, new Type[] { typeof(int), typeof(ExportFactory) })] [InlineData(typeof(ExportFactory), null, new Type[] { typeof(int), typeof(ExportFactory) })] [InlineData(typeof(ExportFactory), new string[] { "1", "2", "3" }, new Type[] { typeof(int), typeof(ExportFactory) })] - public void GetExport_ExportFactoryContractWithMetadataConstraints_ReturnsExpected(Type contractType, string[] sharingBoundaryNames, Type[] expectedTypes) + public void GetExport_ExportFactoryContractWithMetadataConstraints_ReturnsExpected(Type contractType, string[]? sharingBoundaryNames, Type[] expectedTypes) { var tracker = new TrackingProvider(); using (CompositionHost host = CompositionHost.CreateCompositionHost(tracker)) diff --git a/src/libraries/System.Composition.Runtime/tests/System/Composition/CompositionContextTests.cs b/src/libraries/System.Composition.Runtime/tests/System/Composition/CompositionContextTests.cs index 06776d04fb3f63..6793ff92e6bc80 100644 --- a/src/libraries/System.Composition.Runtime/tests/System/Composition/CompositionContextTests.cs +++ b/src/libraries/System.Composition.Runtime/tests/System/Composition/CompositionContextTests.cs @@ -15,7 +15,7 @@ public class CompositionContextTests [InlineData(false, null)] [InlineData(true, "contractName")] [InlineData(false, "contractName")] - public void GetExport_Invoke_ReturnsExpected(bool success, string contractName) + public void GetExport_Invoke_ReturnsExpected(bool success, string? contractName) { var context = new SubContext(contract => { @@ -82,7 +82,7 @@ public void GetExport_Invoke_ReturnsExpected(bool success, string contractName) [InlineData(false, null)] [InlineData(true, "contractName")] [InlineData(false, "contractName")] - public void GetExports_Invoke_ReturnsExpected(bool success, string contractName) + public void GetExports_Invoke_ReturnsExpected(bool success, string? contractName) { var context = new SubContext(contract => { diff --git a/src/libraries/System.Composition.Runtime/tests/System/Composition/Hosting/Core/CompositionContractTests.cs b/src/libraries/System.Composition.Runtime/tests/System/Composition/Hosting/Core/CompositionContractTests.cs index 7784bad7ba48f3..43bec2c02171cd 100644 --- a/src/libraries/System.Composition.Runtime/tests/System/Composition/Hosting/Core/CompositionContractTests.cs +++ b/src/libraries/System.Composition.Runtime/tests/System/Composition/Hosting/Core/CompositionContractTests.cs @@ -24,7 +24,7 @@ public void Ctor_ContractType(Type contractType) [Theory] [InlineData(typeof(int), null)] [InlineData(typeof(object), "contractName")] - public void Ctor_ContractType_ContractName(Type contractType, string contractName) + public void Ctor_ContractType_ContractName(Type contractType, string? contractName) { var contract = new CompositionContract(contractType, contractName); Assert.Equal(contractType, contract.ContractType); @@ -40,7 +40,7 @@ public static IEnumerable Ctor_ContractType_ContractName_MetadataConst [Theory] [MemberData(nameof(Ctor_ContractType_ContractName_MetadataConstraints_TestData))] - public void Ctor_ContractType_MetadataConstraints(Type contractType, string contractName, IDictionary metadataConstraints) + public void Ctor_ContractType_MetadataConstraints(Type contractType, string? contractName, IDictionary metadataConstraints) { var contract = new CompositionContract(contractType, contractName, metadataConstraints); Assert.Equal(contractType, contract.ContractType); diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigPathUtilityTests.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigPathUtilityTests.cs index 1cdf9b0fe46890..313fd690ddf7a8 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigPathUtilityTests.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ConfigPathUtilityTests.cs @@ -29,7 +29,7 @@ public class ConfigPathUtilityTests InlineData(@"a/../c", false), InlineData(@"a/./c", false) ] - public void IsValid(string configPath, bool expected) + public void IsValid(string? configPath, bool expected) { Assert.Equal(expected, ConfigPathUtility.IsValid(configPath)); } diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/StringUtilTests.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/StringUtilTests.cs index ef87ec2517d92e..cad07166e90f0d 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/StringUtilTests.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/StringUtilTests.cs @@ -20,7 +20,7 @@ public class StringUtilTests InlineData(@"A", @"a", false), InlineData(@"a", @"a", true) ] - public void EqualsOrBothNullOrEmpty(string s1, string s2, bool expected) + public void EqualsOrBothNullOrEmpty(string? s1, string? s2, bool expected) { Assert.Equal(expected, StringUtil.EqualsOrBothNullOrEmpty(s1, s2)); } @@ -37,7 +37,7 @@ public void EqualsOrBothNullOrEmpty(string s1, string s2, bool expected) InlineData(@"A", @"a", true), InlineData(@"a", @"a", true) ] - public void EqualsIgnoreCase(string s1, string s2, bool expected) + public void EqualsIgnoreCase(string? s1, string? s2, bool expected) { Assert.Equal(expected, StringUtil.EqualsIgnoreCase(s1, s2)); } @@ -58,7 +58,7 @@ public void EqualsIgnoreCase(string s1, string s2, bool expected) InlineData(@"abba", @"abba", true), InlineData(@"ABBA", @"abba", false) ] - public void StartsWithOrdinal(string s1, string s2, bool expected) + public void StartsWithOrdinal(string? s1, string? s2, bool expected) { Assert.Equal(expected, StringUtil.StartsWithOrdinal(s1, s2)); } @@ -79,7 +79,7 @@ public void StartsWithOrdinal(string s1, string s2, bool expected) InlineData(@"abba", @"abba", true), InlineData(@"ABBA", @"abba", true) ] - public void StartsWithOrdinalIgnoreCase(string s1, string s2, bool expected) + public void StartsWithOrdinalIgnoreCase(string? s1, string? s2, bool expected) { Assert.Equal(expected, StringUtil.StartsWithOrdinalIgnoreCase(s1, s2)); } diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/SubclassTypeValidatorAttributeTests.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/SubclassTypeValidatorAttributeTests.cs index 2772a2bd1fa61d..bf226ce60b6783 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/SubclassTypeValidatorAttributeTests.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/SubclassTypeValidatorAttributeTests.cs @@ -11,7 +11,7 @@ public class SubclassTypeValidatorAttributeTests [Theory] [InlineData(null)] [InlineData(typeof(string))] - public void GetBaseClass_FlowFromConstructor_Equals(Type expected) + public void GetBaseClass_FlowFromConstructor_Equals(Type? expected) { SubclassTypeValidatorAttribute attr = new SubclassTypeValidatorAttribute(expected); Assert.Equal(expected, attr.BaseClass); diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ValidatiorUtilsTests.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ValidatiorUtilsTests.cs index 66f6c3a198e767..dfcf861eb9eee6 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ValidatiorUtilsTests.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Configuration/ValidatiorUtilsTests.cs @@ -14,7 +14,7 @@ public class ValidatiorUtilsTests InlineData(@"a", typeof(int), true), InlineData(1, typeof(string), true), ] - public void HelperParamValidation(object value, Type allowedType, bool shouldThrow) + public void HelperParamValidation(object? value, Type allowedType, bool shouldThrow) { Action action = () => ValidatorUtils.HelperParamValidation(value, allowedType); if (!shouldThrow) @@ -43,7 +43,7 @@ public void HelperParamValidation(object value, Type allowedType, bool shouldThr InlineData(2, 1, 1, 1, false, true, "Validation_scalar_range_violation_not_equal"), InlineData(3, 1, 2, 1, false, true, "Validation_scalar_range_violation_not_in_range"), ] - public void ValidateIntScalar(int value, int min, int max, int resolution, bool exclusiveRange, bool shouldThrow, string message) + public void ValidateIntScalar(int value, int min, int max, int resolution, bool exclusiveRange, bool shouldThrow, string? message) { Action action = () => ValidatorUtils.ValidateScalar(value, min, max, resolution, exclusiveRange); if (!shouldThrow) @@ -62,7 +62,7 @@ public void ValidateIntScalar(int value, int min, int max, int resolution, bool InlineData(1, 1, 1, 1, false, false, null), InlineData(1, 1, 1, 2, false, true, "Validator_scalar_resolution_violation") ] - public void ValidateIntBadResolution(int value, int min, int max, int resolution, bool exclusiveRange, bool shouldThrow, string message) + public void ValidateIntBadResolution(int value, int min, int max, int resolution, bool exclusiveRange, bool shouldThrow, string? message) { Action action = () => ValidatorUtils.ValidateScalar(value, min, max, resolution, exclusiveRange); if (!shouldThrow) diff --git a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Drawing/Configuration/SystemDrawingSectionTests.cs b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Drawing/Configuration/SystemDrawingSectionTests.cs index 5a2cc69197f2c2..31a7c4547c74fa 100644 --- a/src/libraries/System.Configuration.ConfigurationManager/tests/System/Drawing/Configuration/SystemDrawingSectionTests.cs +++ b/src/libraries/System.Configuration.ConfigurationManager/tests/System/Drawing/Configuration/SystemDrawingSectionTests.cs @@ -19,7 +19,7 @@ public void Ctor_Default() [InlineData(null)] [InlineData("")] [InlineData("BitmapSuffix")] - public void BitmapSuffix_Set_GetReturnsExpected(string bitmapSuffix) + public void BitmapSuffix_Set_GetReturnsExpected(string? bitmapSuffix) { var section = new SystemDrawingSection { BitmapSuffix = bitmapSuffix }; Assert.Equal(bitmapSuffix, section.BitmapSuffix); diff --git a/src/libraries/System.Console/tests/Color.cs b/src/libraries/System.Console/tests/Color.cs index 238075e7f09d20..0c43c50c03b424 100644 --- a/src/libraries/System.Console/tests/Color.cs +++ b/src/libraries/System.Console/tests/Color.cs @@ -84,7 +84,7 @@ public static bool TermIsSetAndRemoteExecutorIsSupported [InlineData("tRuE")] [InlineData("0")] [InlineData("false")] - public static void RedirectedOutput_EnvVarSet_EmitsAnsiCodes(string envVar) + public static void RedirectedOutput_EnvVarSet_EmitsAnsiCodes(string? envVar) { var psi = new ProcessStartInfo { RedirectStandardOutput = true }; psi.Environment["DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION"] = envVar; diff --git a/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs b/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs index ace36d95253df0..dc0eadbd60a0af 100644 --- a/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs +++ b/src/libraries/System.Diagnostics.DiagnosticSource/tests/ActivityTests.cs @@ -1878,7 +1878,7 @@ public void TestGetTagItem() [InlineData("key2", null, false, 0)] [InlineData("key3", "v1", true, 1)] [InlineData("key4", "v2", false, 1)] - public void TestInsertingFirstTag(string key, object value, bool add, int resultCount) + public void TestInsertingFirstTag(string key, object? value, bool add, int resultCount) { Activity a = new Activity("SetFirstTag"); if (add) diff --git a/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceDataTests.cs b/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceDataTests.cs index a48b07878b4d09..39c46e3ad87192 100644 --- a/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceDataTests.cs +++ b/src/libraries/System.Diagnostics.PerformanceCounter/tests/PerformanceDataTests.cs @@ -138,7 +138,7 @@ public void PerformanceCounter_PerformanceData_CounterSet_AlreadyRegistered() [ConditionalTheory(typeof(Helpers), nameof(Helpers.IsElevatedAndCanWriteToPerfCounters))] [InlineData("", typeof(ArgumentException))] [InlineData(null, typeof(ArgumentNullException))] - public void PerformanceCounter_PerformanceData_CounterSet_InvalidInstanceName(string instanceName, Type exceptionType) + public void PerformanceCounter_PerformanceData_CounterSet_InvalidInstanceName(string? instanceName, Type exceptionType) { using (CounterSet typingCounterSet = new CounterSet(_fixture._providerId, _fixture._typingCounterSetId, CounterSetInstanceType.Single)) { @@ -151,7 +151,7 @@ public void PerformanceCounter_PerformanceData_CounterSet_InvalidInstanceName(st [ConditionalTheory(typeof(Helpers), nameof(Helpers.IsElevatedAndCanWriteToPerfCounters))] [InlineData("", "counterName", "counterName", typeof(ArgumentException))] [InlineData(null, "counterName", "CounterName", typeof(ArgumentNullException))] - public void PerformanceCounter_PerformanceData_AddCounter_InvalidCounterName(string counterName, string netCoreParameterName, string netfxParameterName, Type exceptionType) + public void PerformanceCounter_PerformanceData_AddCounter_InvalidCounterName(string? counterName, string netCoreParameterName, string netfxParameterName, Type exceptionType) { using (CounterSet typingCounterSet = new CounterSet(_fixture._providerId, _fixture._typingCounterSetId, CounterSetInstanceType.Single)) { @@ -163,7 +163,7 @@ public void PerformanceCounter_PerformanceData_AddCounter_InvalidCounterName(str [ConditionalTheory(typeof(Helpers), nameof(Helpers.IsElevatedAndCanWriteToPerfCounters))] [InlineData("")] [InlineData(null)] - public void PerformanceCounter_PerformanceData_InvalidCounterName_Indexer(string counterName) + public void PerformanceCounter_PerformanceData_InvalidCounterName_Indexer(string? counterName) { using (CounterSet typingCounterSet = new CounterSet(_fixture._providerId, _fixture._typingCounterSetId, CounterSetInstanceType.Single)) { diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs index 2e896862d638b5..5a7cf2c5c01be6 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessStartInfoTests.cs @@ -933,7 +933,7 @@ public void CreateNewProcessGroup_GetSetUnix_ThrowsPlatformNotSupportedException [InlineData("")] [InlineData("domain")] [PlatformSpecific(TestPlatforms.Windows)] - public void Domain_SetWindows_GetReturnsExpected(string domain) + public void Domain_SetWindows_GetReturnsExpected(string? domain) { var info = new ProcessStartInfo { Domain = domain }; Assert.Equal(domain ?? string.Empty, info.Domain); @@ -952,7 +952,7 @@ public void Domain_GetSetUnix_ThrowsPlatformNotSupportedException() [InlineData(null)] [InlineData("")] [InlineData("filename")] - public void FileName_Set_GetReturnsExpected(string fileName) + public void FileName_Set_GetReturnsExpected(string? fileName) { var info = new ProcessStartInfo { FileName = fileName }; Assert.Equal(fileName ?? string.Empty, info.FileName); @@ -1001,7 +1001,7 @@ public void UseCredentialsForNetworkingOnly_GetSetUnix_ThrowsPlatformNotSupporte [InlineData("")] [InlineData("passwordInClearText")] [PlatformSpecific(TestPlatforms.Windows)] - public void PasswordInClearText_SetWindows_GetReturnsExpected(string passwordInClearText) + public void PasswordInClearText_SetWindows_GetReturnsExpected(string? passwordInClearText) { var info = new ProcessStartInfo { PasswordInClearText = passwordInClearText }; Assert.Equal(passwordInClearText, info.PasswordInClearText); @@ -1041,7 +1041,7 @@ public void Password_GetSetUnix_ThrowsPlatformNotSupportedException() [InlineData(null)] [InlineData("")] [InlineData("domain")] - public void UserName_Set_GetReturnsExpected(string userName) + public void UserName_Set_GetReturnsExpected(string? userName) { var info = new ProcessStartInfo { UserName = userName }; Assert.Equal(userName ?? string.Empty, info.UserName); @@ -1051,7 +1051,7 @@ public void UserName_Set_GetReturnsExpected(string userName) [InlineData(null)] [InlineData("")] [InlineData("verb")] - public void Verb_Set_GetReturnsExpected(string verb) + public void Verb_Set_GetReturnsExpected(string? verb) { var info = new ProcessStartInfo { Verb = verb }; Assert.Equal(verb ?? string.Empty, info.Verb); @@ -1081,7 +1081,7 @@ public void WindowStyle_Set_GetReturnsExpected(ProcessWindowStyle style) [InlineData(null)] [InlineData("")] [InlineData("workingdirectory")] - public void WorkingDirectory_Set_GetReturnsExpected(string workingDirectory) + public void WorkingDirectory_Set_GetReturnsExpected(string? workingDirectory) { var info = new ProcessStartInfo { WorkingDirectory = workingDirectory }; Assert.Equal(workingDirectory ?? string.Empty, info.WorkingDirectory); diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs index 47c5ce05870287..a02cc15c3a6626 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.Unix.cs @@ -306,7 +306,7 @@ public void ProcessStart_UseShellExecute_OnUnix_Executable_PassesArguments() [InlineData("Open", true)] [InlineData("invalid", false)] [PlatformSpecific(TestPlatforms.Linux)] // s_allowedProgramsToRun is Linux specific - public void ProcessStart_UseShellExecute_OnUnix_ValidVerbs(string verb, bool isValid) + public void ProcessStart_UseShellExecute_OnUnix_ValidVerbs(string? verb, bool isValid) { // Create a script that we'll use to 'open' the file by putting it on PATH // with the appropriate name. diff --git a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs index 59f010f1941792..88d8c78073ebb8 100644 --- a/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs +++ b/src/libraries/System.Diagnostics.Process/tests/ProcessTests.cs @@ -1322,7 +1322,7 @@ public void GetProcesses_RemoteMachinePath_ReturnsExpected() [InlineData(null)] [InlineData("")] [SkipOnPlatform(TestPlatforms.iOS | TestPlatforms.tvOS, "libproc is not supported on iOS/tvOS")] - public void GetProcessesByName_NullEmpty_ReturnsAllProcesses(string name) + public void GetProcessesByName_NullEmpty_ReturnsAllProcesses(string? name) { Process currentProcess = Process.GetCurrentProcess(); Process[] processes = Process.GetProcessesByName(name); diff --git a/src/libraries/System.Diagnostics.StackTrace/tests/StackFrameTests.cs b/src/libraries/System.Diagnostics.StackTrace/tests/StackFrameTests.cs index 72664b38685b4e..58984e678e8f04 100644 --- a/src/libraries/System.Diagnostics.StackTrace/tests/StackFrameTests.cs +++ b/src/libraries/System.Diagnostics.StackTrace/tests/StackFrameTests.cs @@ -76,7 +76,7 @@ public void SkipFrames_ManyFrames_HasNoMethod(int skipFrames) [InlineData(null, StackFrame.OFFSET_UNKNOWN)] [InlineData("", 0)] [InlineData("FileName", 1)] - public void Ctor_Filename_LineNumber(string fileName, int lineNumber) + public void Ctor_Filename_LineNumber(string? fileName, int lineNumber) { var stackFrame = new StackFrame(fileName, lineNumber); Assert.Equal(fileName, stackFrame.GetFileName()); @@ -91,7 +91,7 @@ public void Ctor_Filename_LineNumber(string fileName, int lineNumber) [InlineData(null, StackFrame.OFFSET_UNKNOWN, 0)] [InlineData("", 0, StackFrame.OFFSET_UNKNOWN)] [InlineData("FileName", 1, 2)] - public void Ctor_Filename_LineNumber_ColNumber(string fileName, int lineNumber, int columnNumber) + public void Ctor_Filename_LineNumber_ColNumber(string? fileName, int lineNumber, int columnNumber) { var stackFrame = new StackFrame(fileName, lineNumber, columnNumber); Assert.Equal(fileName, stackFrame.GetFileName()); diff --git a/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/XmlWriterTraceListenerTests.cs b/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/XmlWriterTraceListenerTests.cs index 20576cc9190b91..b48216eae4f7b9 100644 --- a/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/XmlWriterTraceListenerTests.cs +++ b/src/libraries/System.Diagnostics.TextWriterTraceListener/tests/XmlWriterTraceListenerTests.cs @@ -187,7 +187,7 @@ public void WriteTest(string message, string expectedXml) [Theory] [InlineData("Fail:", null)] [InlineData("Fail:", "the process failed when running")] - public void FailTest(string message, string detailMessage) + public void FailTest(string message, string? detailMessage) { string file = GetTestFilePath(); DateTime date; @@ -213,7 +213,7 @@ public void FailTest(string message, string detailMessage) [Theory] [InlineData("This is a format without args", null)] [InlineData("This is my {0} to {1} a trace with {0} {2} format {3}", new object[] { "test", "try", "", 3 })] - public void TraceEventFormat(string format, object[] args) + public void TraceEventFormat(string format, object[]? args) { string file = GetTestFilePath(); var eventCache = new TraceEventCache(); diff --git a/src/libraries/System.DirectoryServices.AccountManagement/tests/PrincipalContextTests.cs b/src/libraries/System.DirectoryServices.AccountManagement/tests/PrincipalContextTests.cs index 29fe1ba217dfc6..b81a7847b54ce0 100644 --- a/src/libraries/System.DirectoryServices.AccountManagement/tests/PrincipalContextTests.cs +++ b/src/libraries/System.DirectoryServices.AccountManagement/tests/PrincipalContextTests.cs @@ -30,7 +30,7 @@ public void Ctor_ContextType() [InlineData(ContextType.Machine, "")] [InlineData(ContextType.Machine, "\0")] [InlineData(ContextType.Machine, "name")] - public void Ctor_ContextType_Name(ContextType contextType, string name) + public void Ctor_ContextType_Name(ContextType contextType, string? name) { var context = new PrincipalContext(contextType, name); Assert.Equal(contextType, context.ContextType); @@ -57,7 +57,7 @@ public void Ctor_ContextType_Name(ContextType contextType, string name) [InlineData(ContextType.Machine, "", null)] [InlineData(ContextType.Machine, "\0", null)] [InlineData(ContextType.Machine, "name", null)] - public void Ctor_ContextType_Name_Container(ContextType contextType, string name, string container) + public void Ctor_ContextType_Name_Container(ContextType contextType, string? name, string? container) { var context = new PrincipalContext(contextType, name, container); Assert.Equal(contextType, context.ContextType); @@ -84,7 +84,7 @@ public void Ctor_ContextType_Name_Container(ContextType contextType, string name [InlineData(ContextType.Machine, "", null, ContextOptions.Negotiate)] [InlineData(ContextType.Machine, "\0", null, ContextOptions.Negotiate)] [InlineData(ContextType.Machine, "name", null, ContextOptions.Negotiate)] - public void Ctor_ContextType_Name_Container_Options(ContextType contextType, string name, string container, ContextOptions options) + public void Ctor_ContextType_Name_Container_Options(ContextType contextType, string? name, string? container, ContextOptions options) { var context = new PrincipalContext(contextType, name, container, options); Assert.Equal(contextType, context.ContextType); @@ -111,7 +111,7 @@ public void Ctor_ContextType_Name_Container_Options(ContextType contextType, str [InlineData(ContextType.Machine, "", "", "")] [InlineData(ContextType.Machine, "\0", "userName", "")] [InlineData(ContextType.Machine, "name", "\0", "\0")] - public void Ctor_ContextType_Name_UserName_Password(ContextType contextType, string name, string userName, string password) + public void Ctor_ContextType_Name_UserName_Password(ContextType contextType, string? name, string userName, string password) { var context = new PrincipalContext(contextType, name, userName, password); Assert.Equal(contextType, context.ContextType); @@ -137,7 +137,7 @@ public void Ctor_ContextType_Name_UserName_Password(ContextType contextType, str [InlineData(ContextType.Machine, "", null, "", "")] [InlineData(ContextType.Machine, "\0", null, "userName", "")] [InlineData(ContextType.Machine, "name", null, "\0", "\0")] - public void Ctor_ContextType_Name_Container_UserName_Password(ContextType contextType, string name, string container, string userName, string password) + public void Ctor_ContextType_Name_Container_UserName_Password(ContextType contextType, string? name, string? container, string userName, string password) { var context = new PrincipalContext(contextType, name, container, userName, password); Assert.Equal(contextType, context.ContextType); @@ -230,7 +230,7 @@ public void Ctor_MachineContextTypeWithContainer_ThrowsArgumentException() [Theory] [InlineData(null, "password")] [InlineData("userName", null)] - public void Ctor_InconsistentUserNameAndPassword_ThrowsArgumentException(string userName, string password) + public void Ctor_InconsistentUserNameAndPassword_ThrowsArgumentException(string? userName, string? password) { AssertExtensions.Throws(null, () => new PrincipalContext(ContextType.Machine, "name", userName, password)); AssertExtensions.Throws(null, () => new PrincipalContext(ContextType.Machine, "name", null, userName, password)); @@ -295,7 +295,7 @@ public void UserName_GetWhenDisposed_ThrowsObjectDisposedException() [ActiveIssue("https://github.com/dotnet/runtime/issues/34442", TestPlatforms.Windows, TargetFrameworkMonikers.Netcoreapp, TestRuntimes.Mono)] [InlineData(null, null, true)] [InlineData("", "", false)] - public void ValidateCredentials_Invoke_ReturnsExpected(string userName, string password, bool expected) + public void ValidateCredentials_Invoke_ReturnsExpected(string? userName, string? password, bool expected) { var context = new PrincipalContext(ContextType.Machine); Assert.Equal(expected, context.ValidateCredentials(userName, password)); @@ -323,7 +323,7 @@ public void ValidateCredentials_IncorrectUserNamePassword_ThrowsException() [Theory] [InlineData(null, "password")] [InlineData("userName", null)] - public void ValidateCredentials_InvalidUsernamePasswordCombo_ThrowsArgumentException(string userName, string password) + public void ValidateCredentials_InvalidUsernamePasswordCombo_ThrowsArgumentException(string? userName, string? password) { var context = new PrincipalContext(ContextType.Machine); AssertExtensions.Throws(null, () => context.ValidateCredentials(userName, password)); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/AddRequestTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/AddRequestTests.cs index 80d27d83e1c158..5ce9444a1b67db 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/AddRequestTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/AddRequestTests.cs @@ -28,7 +28,7 @@ public static IEnumerable Ctor_DistinguishedName_Attributes_TestData() [Theory] [MemberData(nameof(Ctor_DistinguishedName_Attributes_TestData))] - public void Ctor_DistinguishedString_Attributes(string distinguishedName, DirectoryAttribute[] attributes) + public void Ctor_DistinguishedString_Attributes(string? distinguishedName, DirectoryAttribute[] attributes) { var request = new AddRequest(distinguishedName, attributes); Assert.Equal(attributes ?? Enumerable.Empty(), request.Attributes.Cast()); @@ -46,7 +46,7 @@ public void Ctor_NullObjectInAttributes_ThrowsArgumentException() [Theory] [InlineData(null, "")] [InlineData("DistinguishedName", "ObjectClass")] - public void Ctor_DistinguishedName_ObjectClass(string distinguishedName, string objectClass) + public void Ctor_DistinguishedName_ObjectClass(string? distinguishedName, string objectClass) { var request = new AddRequest(distinguishedName, objectClass); DirectoryAttribute attribute = (DirectoryAttribute)Assert.Single(request.Attributes); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/CompareRequestTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/CompareRequestTests.cs index 8180eaf230a9a5..fa6878ed760a60 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/CompareRequestTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/CompareRequestTests.cs @@ -21,7 +21,7 @@ public void Ctor_Default() [Theory] [InlineData(null, "", "")] [InlineData("DistinguishedName", "AttributeName", "value")] - public void Ctor_DistinguishedName_AttributeName_StringValue(string distinguishedName, string attributeName, string value) + public void Ctor_DistinguishedName_AttributeName_StringValue(string? distinguishedName, string attributeName, string value) { var request = new CompareRequest(distinguishedName, attributeName, value); Assert.Equal(attributeName, request.Assertion.Name); @@ -35,7 +35,7 @@ public void Ctor_DistinguishedName_AttributeName_StringValue(string distinguishe [Theory] [InlineData(null, "", new byte[0])] [InlineData("DistinguishedName", "AttributeName", new byte[] { 1, 2, 3 })] - public void Ctor_DistinguishedName_AttributeName_ByteArrayValue(string distinguishedName, string attributeName, byte[] value) + public void Ctor_DistinguishedName_AttributeName_ByteArrayValue(string? distinguishedName, string attributeName, byte[] value) { var request = new CompareRequest(distinguishedName, attributeName, value); Assert.Equal(attributeName, request.Assertion.Name); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/CrossDomainMoveControlTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/CrossDomainMoveControlTests.cs index 3841782d96b1d2..063d7f92a156b3 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/CrossDomainMoveControlTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/CrossDomainMoveControlTests.cs @@ -23,7 +23,7 @@ public void Ctor_Default() [InlineData(null, new byte[0])] [InlineData("", new byte[] { 0, 0 })] [InlineData("A", new byte[] { 65, 0, 0 })] - public void Ctor_String(string targetDomainController, byte[] expectedValue) + public void Ctor_String(string? targetDomainController, byte[] expectedValue) { var control = new CrossDomainMoveControl(targetDomainController); Assert.True(control.IsCritical); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/DeleteRequestTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/DeleteRequestTests.cs index 98ccfc10e535fb..2e70bdcc135789 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/DeleteRequestTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/DeleteRequestTests.cs @@ -19,7 +19,7 @@ public void Ctor_Default() [Theory] [InlineData(null)] [InlineData("DistinguishedName")] - public void Ctor_DistinguishedName(string distinguishedName) + public void Ctor_DistinguishedName(string? distinguishedName) { var request = new DeleteRequest(distinguishedName); Assert.Empty(request.Controls); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryAttributeTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryAttributeTests.cs index c1d117cbdfecb0..55e9cb2da00c19 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryAttributeTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryAttributeTests.cs @@ -139,7 +139,7 @@ public void GetValues_ContainsUri_ThrowsNotSupportedException() [InlineData(null)] [InlineData(typeof(Uri))] [InlineData(typeof(int))] - public void GetValues_InvalidType_ThrowsArgumentException(Type valuesType) + public void GetValues_InvalidType_ThrowsArgumentException(Type? valuesType) { var attribute = new DirectoryAttribute(); AssertExtensions.Throws("valuesType", () => attribute.GetValues(valuesType)); @@ -331,7 +331,7 @@ public void Remove_NullValue_ThrowsArgumentNullException() [Theory] [InlineData("vaLue", null)] [InlineData(1, "value")] - public void Remove_InvalidValue_ThrowsArgumentException(object value, string paramName) + public void Remove_InvalidValue_ThrowsArgumentException(object value, string? paramName) { var attribute = new DirectoryAttribute { "value" }; AssertExtensions.Throws(paramName, () => attribute.Remove(value)); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryControlTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryControlTests.cs index 32d2b36f062493..51eb7424e5b589 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryControlTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/DirectoryControlTests.cs @@ -10,7 +10,7 @@ public class DirectoryControlTests [Theory] [InlineData("", null, false, false)] [InlineData("Type", new byte[] { 1, 2, 3 }, true, true)] - public void Ctor_Type_Value_IsCritical_ServerSide(string type, byte[] value, bool isCritical, bool serverSide) + public void Ctor_Type_Value_IsCritical_ServerSide(string type, byte[]? value, bool isCritical, bool serverSide) { var control = new DirectoryControl(type, value, isCritical, serverSide); Assert.Equal(type, control.Type); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/DsmlAuthRequestTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/DsmlAuthRequestTests.cs index 408e4e57e45f36..5e9c432e9d0778 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/DsmlAuthRequestTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/DsmlAuthRequestTests.cs @@ -19,7 +19,7 @@ public void Ctor_Default() [Theory] [InlineData(null)] [InlineData("Principal")] - public void Ctor_Principal(string principal) + public void Ctor_Principal(string? principal) { var request = new DsmlAuthRequest(principal); Assert.Empty(request.Controls); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/ExtendedRequestTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/ExtendedRequestTests.cs index 74fccf9dd6d02a..e7cfc064a3fdb8 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/ExtendedRequestTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/ExtendedRequestTests.cs @@ -20,7 +20,7 @@ public void Ctor_Default() [Theory] [InlineData(null)] [InlineData("RequestName")] - public void Ctor_RequestName(string requestName) + public void Ctor_RequestName(string? requestName) { var request = new ExtendedRequest(requestName); Assert.Empty(request.Controls); @@ -32,7 +32,7 @@ public void Ctor_RequestName(string requestName) [Theory] [InlineData(null, null)] [InlineData("RequestName", new byte[] { 1, 2, 3 })] - public void Ctor_RequestName_RequestValue(string requestName, byte[] requestValue) + public void Ctor_RequestName_RequestValue(string? requestName, byte[]? requestValue) { var request = new ExtendedRequest(requestName, requestValue); Assert.Empty(request.Controls); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/LdapConnectionTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/LdapConnectionTests.cs index 413c61724b7ec7..bab7e8291f183f 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/LdapConnectionTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/LdapConnectionTests.cs @@ -15,7 +15,7 @@ public class LdapConnectionTests [Theory] [InlineData(null, new string[0])] [InlineData("server", new string[] { "server" })] - public void Ctor_String(string server, string[] expectedServer) + public void Ctor_String(string? server, string[] expectedServer) { var connection = new LdapConnection(server); Assert.Equal(AuthType.Negotiate, connection.AuthType); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/LdapDirectoryIdentifierTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/LdapDirectoryIdentifierTests.cs index 7699a932f74b14..c17d028421f916 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/LdapDirectoryIdentifierTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/LdapDirectoryIdentifierTests.cs @@ -11,7 +11,7 @@ public class LdapDirectoryIdentifierTests [InlineData(null, new string[0])] [InlineData("", new string[] { "" })] [InlineData("server", new string[] { "server" })] - public void Ctor_Server(string server, string[] expectedServers) + public void Ctor_Server(string? server, string[] expectedServers) { var identifier = new LdapDirectoryIdentifier(server); Assert.False(identifier.Connectionless); @@ -24,7 +24,7 @@ public void Ctor_Server(string server, string[] expectedServers) [InlineData(null, 389, new string[0])] [InlineData("", -1, new string[] { "" })] [InlineData("server", int.MaxValue, new string[] { "server" })] - public void Ctor_Server_PortNumber(string server, int portNumber, string[] expectedServers) + public void Ctor_Server_PortNumber(string? server, int portNumber, string[] expectedServers) { var identifier = new LdapDirectoryIdentifier(server, portNumber); Assert.False(identifier.Connectionless); @@ -37,7 +37,7 @@ public void Ctor_Server_PortNumber(string server, int portNumber, string[] expec [InlineData(null, true, false, new string[0])] [InlineData("", false, true, new string[] { "" })] [InlineData("server", true, true, new string[] { "server" })] - public void Ctor_Server_FullQualifiedDnsHostName_Conectionless(string server, bool fullyQualifiedDnsHostName, bool connectionless, string[] expectedServers) + public void Ctor_Server_FullQualifiedDnsHostName_Conectionless(string? server, bool fullyQualifiedDnsHostName, bool connectionless, string[] expectedServers) { var identifier = new LdapDirectoryIdentifier(server, fullyQualifiedDnsHostName, connectionless); Assert.Equal(connectionless, identifier.Connectionless); @@ -50,7 +50,7 @@ public void Ctor_Server_FullQualifiedDnsHostName_Conectionless(string server, bo [InlineData(null, -1, true, false, new string[0])] [InlineData("", 389, false, true, new string[] { "" })] [InlineData("server", int.MaxValue, true, true, new string[] { "server" })] - public void Ctor_PortNumber_Server_FullQualifiedDnsHostName_Conectionless(string server, int portNumber, bool fullyQualifiedDnsHostName, bool connectionless, string[] expectedServers) + public void Ctor_PortNumber_Server_FullQualifiedDnsHostName_Conectionless(string? server, int portNumber, bool fullyQualifiedDnsHostName, bool connectionless, string[] expectedServers) { var identifier = new LdapDirectoryIdentifier(server, portNumber, fullyQualifiedDnsHostName, connectionless); Assert.Equal(connectionless, identifier.Connectionless); @@ -64,7 +64,7 @@ public void Ctor_PortNumber_Server_FullQualifiedDnsHostName_Conectionless(string [InlineData(new string[0], true, false)] [InlineData(new string[] { "server" }, true, true)] [InlineData(new string[] { "server", null }, false, false)] - public void Ctor_Servers_FullQualifiedDnsHostName_Conectionless(string[] servers, bool fullyQualifiedDnsHostName, bool connectionless) + public void Ctor_Servers_FullQualifiedDnsHostName_Conectionless(string[]? servers, bool fullyQualifiedDnsHostName, bool connectionless) { var identifier = new LdapDirectoryIdentifier(servers, fullyQualifiedDnsHostName, connectionless); Assert.Equal(connectionless, identifier.Connectionless); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/ModifyDNRequestTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/ModifyDNRequestTests.cs index 8ef842f3c4a6ed..535a95326623c0 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/ModifyDNRequestTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/ModifyDNRequestTests.cs @@ -24,7 +24,7 @@ public void Ctor_Default() [Theory] [InlineData(null, null, null)] [InlineData("DistinguishedName", "NewParentDistinguishedName", "NewName")] - public void Ctor_DistinguishedName_NewParentDistinguishedName_NewName(string distinguishedName, string newParentDistinguishedName, string newName) + public void Ctor_DistinguishedName_NewParentDistinguishedName_NewName(string? distinguishedName, string? newParentDistinguishedName, string? newName) { var request = new ModifyDNRequest(distinguishedName, newParentDistinguishedName, newName); Assert.Empty(request.Controls); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/SearchRequestTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/SearchRequestTests.cs index eed8af0891ad29..5c948b34824679 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/SearchRequestTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/SearchRequestTests.cs @@ -31,7 +31,7 @@ public void Ctor_Default() [InlineData("", "", SearchScope.OneLevel, new string[0])] [InlineData("DistinguishedName", "LdapFilter", SearchScope.Base, new string[] { "attribute" })] [InlineData("DistinguishedName", "LdapFilter", SearchScope.OneLevel, new string[] { null })] - public void Ctor_DistinguishedName_LdapFilter_SearchScope_AttributeList(string distinguishedName, string ldapFilter, SearchScope searchScope, string[] attributeList) + public void Ctor_DistinguishedName_LdapFilter_SearchScope_AttributeList(string? distinguishedName, string? ldapFilter, SearchScope searchScope, string[]? attributeList) { var request = new SearchRequest(distinguishedName, ldapFilter, searchScope, attributeList); Assert.Equal(DereferenceAlias.Never, request.Aliases); diff --git a/src/libraries/System.DirectoryServices.Protocols/tests/SortKeyTests.cs b/src/libraries/System.DirectoryServices.Protocols/tests/SortKeyTests.cs index 69ccc4c53261b5..5146c4d979f7b9 100644 --- a/src/libraries/System.DirectoryServices.Protocols/tests/SortKeyTests.cs +++ b/src/libraries/System.DirectoryServices.Protocols/tests/SortKeyTests.cs @@ -19,7 +19,7 @@ public void Ctor_Default() [Theory] [InlineData("", null, false)] [InlineData("AttributeName", null, false)] - public void Ctor_AttributeName_MatchingRule_ReverseOrder(string attributeName, string matchingRule, bool reverseOrder) + public void Ctor_AttributeName_MatchingRule_ReverseOrder(string attributeName, string? matchingRule, bool reverseOrder) { var sortKey = new SortKey(attributeName, matchingRule, reverseOrder); Assert.Equal(attributeName, sortKey.AttributeName); diff --git a/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/DirectoryContextTests.cs b/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/DirectoryContextTests.cs index b665e02976922c..c8288e2c974570 100644 --- a/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/DirectoryContextTests.cs +++ b/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/ActiveDirectory/DirectoryContextTests.cs @@ -23,7 +23,7 @@ public void Ctor_ContextType(DirectoryContextType contextType) [Theory] [InlineData(DirectoryContextType.Domain, null, null)] [InlineData(DirectoryContextType.Forest, "UserName", "Password")] - public void Ctor_ContextType_UserName_Password(DirectoryContextType contextType, string userName, string password) + public void Ctor_ContextType_UserName_Password(DirectoryContextType contextType, string? userName, string? password) { var context = new DirectoryContext(contextType, userName, password); Assert.Equal(contextType, context.ContextType); @@ -61,7 +61,7 @@ public void Ctor_ContextType_Name(DirectoryContextType contextType, string name) [InlineData(DirectoryContextType.DirectoryServer, "Name", "UserName", "Password")] [InlineData(DirectoryContextType.Domain, "Name", "UserName", "Password")] [InlineData(DirectoryContextType.Forest, "Name", "UserName", "Password")] - public void Ctor_ContextType_Name_UserName_Password(DirectoryContextType contextType, string name, string userName, string password) + public void Ctor_ContextType_Name_UserName_Password(DirectoryContextType contextType, string name, string? userName, string? password) { var context = new DirectoryContext(contextType, name, userName, password); Assert.Equal(contextType, context.ContextType); diff --git a/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/DirectoryEntryTests.cs b/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/DirectoryEntryTests.cs index baae5ef11681c5..0c0f0b36c1362c 100644 --- a/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/DirectoryEntryTests.cs +++ b/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/DirectoryEntryTests.cs @@ -25,7 +25,7 @@ public void Ctor_Default() [InlineData(null)] [InlineData("")] [InlineData("Path")] - public void Ctor_Path(string path) + public void Ctor_Path(string? path) { var entry = new DirectoryEntry(path); Assert.Equal(path ?? string.Empty, entry.Path); @@ -41,7 +41,7 @@ public void Ctor_Path(string path) [InlineData(null, null, null)] [InlineData("", "", "")] [InlineData("Path", "UserName", "Password")] - public void Ctor_Path_UserName_Password(string path, string userName, string password) + public void Ctor_Path_UserName_Password(string? path, string? userName, string? password) { var entry = new DirectoryEntry(path, userName, password); Assert.Equal(path ?? string.Empty, entry.Path); @@ -57,7 +57,7 @@ public void Ctor_Path_UserName_Password(string path, string userName, string pas [InlineData(null, null, null, (AuthenticationTypes)int.MinValue)] [InlineData("", "", "", AuthenticationTypes.Anonymous)] [InlineData("Path", "UserName", "Password", AuthenticationTypes.None)] - public void Ctor_Path_UserName_Password_AuthenticationType(string path, string userName, string password, AuthenticationTypes authenticationType) + public void Ctor_Path_UserName_Password_AuthenticationType(string? path, string? userName, string? password, AuthenticationTypes authenticationType) { var entry = new DirectoryEntry(path, userName, password, authenticationType); Assert.Equal(path ?? string.Empty, entry.Path); @@ -72,7 +72,7 @@ public void Ctor_Path_UserName_Password_AuthenticationType(string path, string u [Theory] [InlineData(null)] [InlineData(1)] - public void Ctor_InvalidAdsObject_ThrowsArgumentException(object adsObject) + public void Ctor_InvalidAdsObject_ThrowsArgumentException(object? adsObject) { AssertExtensions.Throws(null, () => new DirectoryEntry(adsObject)); } diff --git a/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/DirectorySynchronizationTests.cs b/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/DirectorySynchronizationTests.cs index deec45477d05f0..80578d4037a77d 100644 --- a/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/DirectorySynchronizationTests.cs +++ b/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/DirectorySynchronizationTests.cs @@ -33,7 +33,7 @@ public void Ctor_Option(DirectorySynchronizationOptions option) [InlineData(null)] [InlineData(new byte[0])] [InlineData(new byte[] { 1, 2, 3, })] - public void Ctor_Cookie(byte[] cookie) + public void Ctor_Cookie(byte[]? cookie) { var synchronization = new DirectorySynchronization(cookie); Assert.Equal(DirectorySynchronizationOptions.None, synchronization.Option); @@ -47,7 +47,7 @@ public void Ctor_Cookie(byte[] cookie) [InlineData(DirectorySynchronizationOptions.None, null)] [InlineData(DirectorySynchronizationOptions.IncrementalValues, new byte[0])] [InlineData(DirectorySynchronizationOptions.IncrementalValues | DirectorySynchronizationOptions.ObjectSecurity, new byte[] { 1, 2, 3 })] - public void Ctor_Option_Cookie(DirectorySynchronizationOptions option, byte[] cookie) + public void Ctor_Option_Cookie(DirectorySynchronizationOptions option, byte[]? cookie) { var synchronization = new DirectorySynchronization(option, cookie); Assert.Equal(option, synchronization.Option); @@ -106,7 +106,7 @@ public void ResetDirectorySynchronizationCookie_Parameterless_SetsToEmpty() [InlineData(null)] [InlineData(new byte[0])] [InlineData(new byte[] { 1, 2, 3 })] - public void ResetDirectorySynchronizationCookie_Cookie_SetsToEmpty(byte[] cookie) + public void ResetDirectorySynchronizationCookie_Cookie_SetsToEmpty(byte[]? cookie) { var synchronization = new DirectorySynchronization(new byte[] { 255, 255, 255 }); synchronization.ResetDirectorySynchronizationCookie(cookie); diff --git a/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/DirectoryVirtualListViewTests.cs b/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/DirectoryVirtualListViewTests.cs index 962d7cf340c765..3ca8129f3b4093 100644 --- a/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/DirectoryVirtualListViewTests.cs +++ b/src/libraries/System.DirectoryServices/tests/System/DirectoryServices/DirectoryVirtualListViewTests.cs @@ -55,7 +55,7 @@ public void Ctor_BeforeCount_AfterCount_Offset(int beforeCount, int afterCount, [InlineData(0, 0, null)] [InlineData(1, 2, "")] [InlineData(1, 2, "target")] - public void Ctor_BeforeCount_AfterCount_Target(int beforeCount, int afterCount, string target) + public void Ctor_BeforeCount_AfterCount_Target(int beforeCount, int afterCount, string? target) { var listView = new DirectoryVirtualListView(beforeCount, afterCount, target); Assert.Equal(afterCount, listView.AfterCount); diff --git a/src/libraries/System.Formats.Nrbf/tests/ReadExactTypesTests.cs b/src/libraries/System.Formats.Nrbf/tests/ReadExactTypesTests.cs index 027293bce05a68..ed6db2790aeb53 100644 --- a/src/libraries/System.Formats.Nrbf/tests/ReadExactTypesTests.cs +++ b/src/libraries/System.Formats.Nrbf/tests/ReadExactTypesTests.cs @@ -173,7 +173,7 @@ public class CustomTypeWithStringArrayField [InlineData("Hello", ", ", "World!")] [InlineData("Single ", "null", null)] [InlineData("Multiple ", null, null)] - public void CanRead_CustomTypeWithStringsArrayField(string value0, string value1, string value2) + public void CanRead_CustomTypeWithStringsArrayField(string value0, string? value1, string? value2) { CustomTypeWithStringArrayField input = new() { diff --git a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectory.File.Roundtrip.cs b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectory.File.Roundtrip.cs index 84d94cbcb1acfc..eebac48379569a 100644 --- a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectory.File.Roundtrip.cs +++ b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectory.File.Roundtrip.cs @@ -14,7 +14,7 @@ public class TarFile_CreateFromDirectory_Roundtrip_Tests : TarTestsBase [InlineData("../file.txt", "subDirectory1/subDirectory1.1")] [InlineData("./file.txt", "subDirectory1/subDirectory1.1")] [InlineData("./file.txt", null)] - public void SymlinkRelativeTargets_InsideTheArchive_RoundtripsSuccessfully(string symlinkTargetPath, string subDirectory) + public void SymlinkRelativeTargets_InsideTheArchive_RoundtripsSuccessfully(string symlinkTargetPath, string? subDirectory) { using TempDirectory root = new TempDirectory(); @@ -51,7 +51,7 @@ public void SymlinkRelativeTargets_InsideTheArchive_RoundtripsSuccessfully(strin [ConditionalTheory(typeof(MountHelper), nameof(MountHelper.CanCreateSymbolicLinks))] [InlineData("../file.txt", null)] [InlineData("../../file.txt", "subDirectory")] - public void SymlinkRelativeTargets_OutsideTheArchive_Fails(string symlinkTargetPath, string subDirectory) + public void SymlinkRelativeTargets_OutsideTheArchive_Fails(string symlinkTargetPath, string? subDirectory) { using TempDirectory root = new TempDirectory(); diff --git a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectoryAsync.File.Roundtrip.cs b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectoryAsync.File.Roundtrip.cs index d36745c5f0fddc..ddad755cad6e17 100644 --- a/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectoryAsync.File.Roundtrip.cs +++ b/src/libraries/System.Formats.Tar/tests/TarFile/TarFile.CreateFromDirectoryAsync.File.Roundtrip.cs @@ -15,7 +15,7 @@ public class TarFile_CreateFromDirectoryAsync_Roundtrip_Tests : TarTestsBase [InlineData("../file.txt", "subDirectory1/subDirectory1.1")] [InlineData("./file.txt", "subDirectory1/subDirectory1.1")] [InlineData("./file.txt", null)] - public async Task SymlinkRelativeTargets_InsideTheArchive_RoundtripsSuccessfully_Async(string symlinkTargetPath, string subDirectory) + public async Task SymlinkRelativeTargets_InsideTheArchive_RoundtripsSuccessfully_Async(string symlinkTargetPath, string? subDirectory) { using TempDirectory root = new TempDirectory(); @@ -52,7 +52,7 @@ public async Task SymlinkRelativeTargets_InsideTheArchive_RoundtripsSuccessfully [ConditionalTheory(typeof(MountHelper), nameof(MountHelper.CanCreateSymbolicLinks))] [InlineData("../file.txt", null)] [InlineData("../../file.txt", "subDirectory")] - public async Task SymlinkRelativeTargets_OutsideTheArchive_Fails_Async(string symlinkTargetPath, string subDirectory) + public async Task SymlinkRelativeTargets_OutsideTheArchive_Fails_Async(string symlinkTargetPath, string? subDirectory) { using TempDirectory root = new TempDirectory(); diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/Args.FileSystemEventArgs.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/Args.FileSystemEventArgs.cs index 39e95c72c838ac..81cb55ce1dbc22 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/Args.FileSystemEventArgs.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/Args.FileSystemEventArgs.cs @@ -12,7 +12,7 @@ public class FileSystemEventArgsTests [InlineData(WatcherChangeTypes.All, "C:", "foo.txt")] [InlineData((WatcherChangeTypes)0, "", "")] [InlineData((WatcherChangeTypes)0, "", null)] - public static void FileSystemEventArgs_ctor_NonPathPropertiesAreSetCorrectly(WatcherChangeTypes changeType, string directory, string name) + public static void FileSystemEventArgs_ctor_NonPathPropertiesAreSetCorrectly(WatcherChangeTypes changeType, string directory, string? name) { FileSystemEventArgs args = new FileSystemEventArgs(changeType, directory, name); @@ -31,7 +31,7 @@ public static void FileSystemEventArgs_ctor_NonPathPropertiesAreSetCorrectly(Wat [InlineData("E:\\bar\\", null, "E:\\bar\\")] [InlineData("E:\\bar\\", "", "E:\\bar\\")] [InlineData("E:\\bar\\", "foo.txt", "E:\\bar\\foo.txt")] - public static void FileSystemEventArgs_ctor_DirectoryIsAbsolutePath_Windows(string directory, string name, string expectedFullPath) + public static void FileSystemEventArgs_ctor_DirectoryIsAbsolutePath_Windows(string directory, string? name, string expectedFullPath) { FileSystemEventArgs args = new FileSystemEventArgs(WatcherChangeTypes.All, directory, name); @@ -50,7 +50,7 @@ public static void FileSystemEventArgs_ctor_DirectoryIsAbsolutePath_Windows(stri [InlineData("/bar/", null, "/bar/")] [InlineData("/bar/", "", "/bar/")] [InlineData("/bar/", "foo.txt", "/bar/foo.txt")] - public static void FileSystemEventArgs_ctor_DirectoryIsAbsolutePath_Unix(string directory, string name, string expectedFullPath) + public static void FileSystemEventArgs_ctor_DirectoryIsAbsolutePath_Unix(string directory, string? name, string expectedFullPath) { FileSystemEventArgs args = new FileSystemEventArgs(WatcherChangeTypes.All, directory, name); @@ -89,7 +89,7 @@ public static void FileSystemEventArgs_ctor_DirectoryIsRelativePath_Unix(string [PlatformSpecific(TestPlatforms.Windows)] [InlineData("bar", "", "bar\\")] [InlineData("bar", null, "bar\\")] - public static void FileSystemEventArgs_ctor_EmptyFileName_Windows(string directory, string name, string expectedFullPath) + public static void FileSystemEventArgs_ctor_EmptyFileName_Windows(string directory, string? name, string expectedFullPath) { FileSystemEventArgs args = new FileSystemEventArgs(WatcherChangeTypes.All, directory, name); @@ -100,7 +100,7 @@ public static void FileSystemEventArgs_ctor_EmptyFileName_Windows(string directo [PlatformSpecific(TestPlatforms.AnyUnix)] [InlineData("bar", "", "bar/")] [InlineData("bar", null, "bar/")] - public static void FileSystemEventArgs_ctor_EmptyFileName_Unix(string directory, string name, string expectedFullPath) + public static void FileSystemEventArgs_ctor_EmptyFileName_Unix(string directory, string? name, string expectedFullPath) { FileSystemEventArgs args = new FileSystemEventArgs(WatcherChangeTypes.All, directory, name); diff --git a/src/libraries/System.IO.FileSystem.Watcher/tests/Args.RenamedEventArgs.cs b/src/libraries/System.IO.FileSystem.Watcher/tests/Args.RenamedEventArgs.cs index d92324fc53291b..57fc85e9d1f586 100644 --- a/src/libraries/System.IO.FileSystem.Watcher/tests/Args.RenamedEventArgs.cs +++ b/src/libraries/System.IO.FileSystem.Watcher/tests/Args.RenamedEventArgs.cs @@ -12,7 +12,7 @@ public class RenamedEventArgsTests [InlineData(WatcherChangeTypes.All, "bar", "foo.txt", "bar.txt")] [InlineData((WatcherChangeTypes)0, "bar", "", "")] [InlineData((WatcherChangeTypes)0, "bar", null, null)] - public static void RenamedEventArgs_ctor_NonPathPropertiesAreSetCorrectly(WatcherChangeTypes changeType, string directory, string name, string oldName) + public static void RenamedEventArgs_ctor_NonPathPropertiesAreSetCorrectly(WatcherChangeTypes changeType, string directory, string? name, string? oldName) { RenamedEventArgs args = new RenamedEventArgs(changeType, directory, name, oldName); @@ -76,7 +76,7 @@ public static void RenamedEventArgs_ctor_OldFullPath_DirectoryIsRelativePath_Uni [InlineData("bar", "", "", "bar\\")] [InlineData("bar", null, null, "bar\\")] [InlineData("bar", "foo.txt", null, "bar\\")] - public static void RenamedEventArgs_ctor_EmptyOldFileName_Windows(string directory, string name, string oldName, string expectedOldFullPath) + public static void RenamedEventArgs_ctor_EmptyOldFileName_Windows(string directory, string? name, string? oldName, string expectedOldFullPath) { RenamedEventArgs args = new RenamedEventArgs(WatcherChangeTypes.All, directory, name, oldName); @@ -88,7 +88,7 @@ public static void RenamedEventArgs_ctor_EmptyOldFileName_Windows(string directo [InlineData("bar", "", "", "bar/")] [InlineData("bar", null, null, "bar/")] [InlineData("bar", "foo.txt", null, "bar/")] - public static void RenamedEventArgs_ctor_EmptyOldFileName_Unix(string directory, string name, string oldName, string expectedOldFullPath) + public static void RenamedEventArgs_ctor_EmptyOldFileName_Unix(string directory, string? name, string? oldName, string expectedOldFullPath) { RenamedEventArgs args = new RenamedEventArgs(WatcherChangeTypes.All, directory, name, oldName); diff --git a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs index fa238061a2c8ff..7b7b15a0fe5c8d 100644 --- a/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs +++ b/src/libraries/System.IO.MemoryMappedFiles/tests/MemoryMappedFile.CreateNew.Tests.cs @@ -142,7 +142,7 @@ public void MapNamesNotSupported_Unix(string mapName) [Theory] [MemberData(nameof(CreateValidMapNames))] [InlineData(null)] - public void ValidMapNames_Windows(string name) + public void ValidMapNames_Windows(string? name) { using (MemoryMappedFile mmf = MemoryMappedFile.CreateNew(name, 4096)) { @@ -261,7 +261,7 @@ public static IEnumerable MemberData_ValidArgumentCombinations( [Theory] [MemberData(nameof(CreateValidMapNames))] [InlineData(null)] - public void DataNotPersistedBetweenMaps_Windows(string name) + public void DataNotPersistedBetweenMaps_Windows(string? name) { // Write some data to a map newly created with the specified name using (MemoryMappedFile mmf = MemoryMappedFile.CreateNew(name, 4096)) diff --git a/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Assignment/Assign.cs b/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Assignment/Assign.cs index 17dd7c7b340f0b..dfa0f5a7086046 100644 --- a/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Assignment/Assign.cs +++ b/src/libraries/System.Linq.Expressions/tests/BinaryOperators/Assignment/Assign.cs @@ -231,7 +231,7 @@ public void RightNull_ThrowsArgumentNullException() [InlineData(typeof(SubClass), null, typeof(BaseClass))] [InlineData(typeof(int), null, typeof(BaseClass))] [InlineData(typeof(BaseClass), 1, typeof(int))] - public void MismatchTypes(Type variableType, object constantValue, Type constantType) + public void MismatchTypes(Type variableType, object? constantValue, Type constantType) { AssertExtensions.Throws(null, () => Expression.Assign(Expression.Variable(variableType), Expression.Constant(constantValue, constantType))); } diff --git a/src/libraries/System.Memory/tests/ParsersAndFormatters/StandardFormatTests.cs b/src/libraries/System.Memory/tests/ParsersAndFormatters/StandardFormatTests.cs index d45a4a455111f6..582e71ba8b3e7c 100644 --- a/src/libraries/System.Memory/tests/ParsersAndFormatters/StandardFormatTests.cs +++ b/src/libraries/System.Memory/tests/ParsersAndFormatters/StandardFormatTests.cs @@ -23,7 +23,7 @@ public static void StandardFormatCtorNegative() [InlineData("x99", 'x', StandardFormat.MaxPrecision)] [InlineData(null, default(char), default(byte))] [InlineData("", default(char), default(byte))] - public static void StandardFormatParseString(string formatString, char expectedSymbol, byte expectedPrecision) + public static void StandardFormatParseString(string? formatString, char expectedSymbol, byte expectedPrecision) { StandardFormat format = StandardFormat.Parse(formatString); Assert.Equal(expectedSymbol, format.Symbol); @@ -63,7 +63,7 @@ public static void StandardFormatParseNegative(string badFormatString) [InlineData("G$", default(char), default(byte), false)] [InlineData("Ga", default(char), default(byte), false)] [InlineData("G100", default(char), default(byte), false)] - public static void StandardFormatTryParse(string formatString, char expectedSymbol, byte expectedPrecision, bool expectedResult) + public static void StandardFormatTryParse(string? formatString, char expectedSymbol, byte expectedPrecision, bool expectedResult) { bool result = StandardFormat.TryParse(formatString, out StandardFormat format); Assert.Equal(expectedSymbol, format.Symbol); diff --git a/src/libraries/System.Memory/tests/Span/EnumerateLines.cs b/src/libraries/System.Memory/tests/Span/EnumerateLines.cs index e0abfbc97e38e4..3734f9a7acf3b4 100644 --- a/src/libraries/System.Memory/tests/Span/EnumerateLines.cs +++ b/src/libraries/System.Memory/tests/Span/EnumerateLines.cs @@ -138,7 +138,7 @@ static void TestI(TEnumerator enumerator) where TEnumerator : IEnum [InlineData("xyz", new[] { "..3", "^0.." })] // sequence at end produces empty string [InlineData("xyz", new[] { "..0", "^3.." })] // sequence at beginning produces empty string [InlineData("abc%def", new[] { ".." })] // we don't recognize EBCDIC encodings for LF (see Unicode Standard, Sec. 5.8, Table 5-1) - public static void EnumerateLines_Battery(string input, string[] expectedRanges) + public static void EnumerateLines_Battery(string? input, string[] expectedRanges) { // This test is similar to the string.ReplaceLineEndings test, but it checks ranges instead of substrings, // as we want to ensure that the method under test points to very specific slices within the original input string. diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs index 1a24fe7e0832ad..e96eb1fe25dc25 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientHandlerTest.Http2.cs @@ -254,7 +254,7 @@ public async Task Http2_DataFrameOnlyPadding_Success() [InlineData("Client content", "Server content")] [InlineData(null, null)] [InlineData(null, "Server content")] - public async Task Http2ClearText_SendAsync_Success(string clientContent, string serverContent) + public async Task Http2ClearText_SendAsync_Success(string? clientContent, string? serverContent) { await Http2LoopbackServer.CreateClientAndServerAsync(async uri => { diff --git a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs index 52e5900376fcdb..27666715f97847 100644 --- a/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs +++ b/src/libraries/System.Net.Http/tests/FunctionalTests/HttpClientTest.cs @@ -246,7 +246,7 @@ public async Task Properties_CantChangeAfterOperation_Throws() [Theory] [InlineData(null)] [InlineData("/something.html")] - public void GetAsync_NoBaseAddress_InvalidUri_ThrowsException(string uri) + public void GetAsync_NoBaseAddress_InvalidUri_ThrowsException(string? uri) { using (var client = new HttpClient(new CustomResponseHandler((r, c) => Task.FromResult(new HttpResponseMessage())))) { @@ -257,7 +257,7 @@ public void GetAsync_NoBaseAddress_InvalidUri_ThrowsException(string uri) [Theory] [InlineData(null)] [InlineData("/")] - public async Task GetAsync_BaseAddress_ValidUri_Success(string uri) + public async Task GetAsync_BaseAddress_ValidUri_Success(string? uri) { using (var client = new HttpClient(new CustomResponseHandler((r, c) => Task.FromResult(new HttpResponseMessage())))) { diff --git a/src/libraries/System.Net.Http/tests/UnitTests/Headers/CacheControlHeaderValueTest.cs b/src/libraries/System.Net.Http/tests/UnitTests/Headers/CacheControlHeaderValueTest.cs index 6d9d50acde4d3a..8a5a2b99057b7f 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/Headers/CacheControlHeaderValueTest.cs +++ b/src/libraries/System.Net.Http/tests/UnitTests/Headers/CacheControlHeaderValueTest.cs @@ -643,7 +643,7 @@ public void Parse_SetOfInvalidValueStrings_Throws() [InlineData(",")] [InlineData(",,")] [InlineData(" , , ")] - public void CacheControlHeaderValue_EmptyValue_Parsed(string value) + public void CacheControlHeaderValue_EmptyValue_Parsed(string? value) { Assert.NotNull(CacheControlHeaderValue.Parse(value)); diff --git a/src/libraries/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs b/src/libraries/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs index 44495c9593c66c..70615e7b8ad527 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs +++ b/src/libraries/System.Net.Http/tests/UnitTests/Headers/HttpHeadersTest.cs @@ -85,7 +85,7 @@ public void TryAddWithoutValidation_AddInvalidViaHeaderValue_ValuePassed() [Theory] [InlineData(null)] [InlineData("")] - public void TryAddWithoutValidation_UseEmptyHeaderName_False(string headerName) + public void TryAddWithoutValidation_UseEmptyHeaderName_False(string? headerName) { MockHeaders headers = new MockHeaders(); Assert.False(headers.TryAddWithoutValidation(headerName, "value")); @@ -1149,7 +1149,7 @@ public void Remove_RemoveNonExistingHeader_ReturnsFalse() [Theory] [InlineData(null)] [InlineData("")] - public void TryGetValues_UseEmptyHeaderName_False(string headerName) + public void TryGetValues_UseEmptyHeaderName_False(string? headerName) { MockHeaders headers = new MockHeaders(); diff --git a/src/libraries/System.Net.Http/tests/UnitTests/Headers/NameValueHeaderValueTest.cs b/src/libraries/System.Net.Http/tests/UnitTests/Headers/NameValueHeaderValueTest.cs index f9078d3736d1ca..dea8b38d6fd332 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/Headers/NameValueHeaderValueTest.cs +++ b/src/libraries/System.Net.Http/tests/UnitTests/Headers/NameValueHeaderValueTest.cs @@ -44,7 +44,7 @@ public void Ctor_NameInvalidFormat_ThrowFormatException(string value) [InlineData("host", "server.example.com:80")] [InlineData("quoted", "\"value\"")] [InlineData("empty", "")] - public void Ctor_NameValidFormat_SuccessfullyCreated(string name, string value) + public void Ctor_NameValidFormat_SuccessfullyCreated(string name, string? value) { NameValueHeaderValue nameValue = new NameValueHeaderValue(name, value); Assert.Equal(name, nameValue.Name); diff --git a/src/libraries/System.Net.Http/tests/UnitTests/HttpEnvironmentProxyTest.cs b/src/libraries/System.Net.Http/tests/UnitTests/HttpEnvironmentProxyTest.cs index a263f95bb27d85..9e91d2743e8b92 100644 --- a/src/libraries/System.Net.Http/tests/UnitTests/HttpEnvironmentProxyTest.cs +++ b/src/libraries/System.Net.Http/tests/UnitTests/HttpEnvironmentProxyTest.cs @@ -145,7 +145,7 @@ await RemoteExecutor.Invoke(() => [InlineData("socks5://1.2.3.4:8888/foo", "1.2.3.4", "8888", null, null)] [InlineData("https://1.1.1.5:3005", "1.1.1.5", "3005", null, null)] [InlineData("https://1.1.1.5", "1.1.1.5", "443", null, null)] - public async Task HttpProxy_Uri_Parsing(string _input, string _host, string _port, string _user, string _password) + public async Task HttpProxy_Uri_Parsing(string _input, string _host, string _port, string? _user, string? _password) { await RemoteExecutor.Invoke((input, host, port, user, password) => { diff --git a/src/libraries/System.Net.HttpListener/tests/HttpListenerAuthenticationTests.cs b/src/libraries/System.Net.HttpListener/tests/HttpListenerAuthenticationTests.cs index 900fea85114181..0e947993237bf5 100644 --- a/src/libraries/System.Net.HttpListener/tests/HttpListenerAuthenticationTests.cs +++ b/src/libraries/System.Net.HttpListener/tests/HttpListenerAuthenticationTests.cs @@ -111,7 +111,7 @@ public static IEnumerable BasicAuthenticationHeader_TestData() [InlineData(" ExampleRealm ")] [InlineData("")] [InlineData(null)] - public async Task BasicAuthentication_RealmSet_SendsChallengeToClient(string realm) + public async Task BasicAuthentication_RealmSet_SendsChallengeToClient(string? realm) { _listener.Realm = realm; _listener.AuthenticationSchemes = AuthenticationSchemes.Basic; diff --git a/src/libraries/System.Net.HttpListener/tests/HttpListenerRequestTests.cs b/src/libraries/System.Net.HttpListener/tests/HttpListenerRequestTests.cs index 1f2057a9480536..d55eaf48a5845d 100644 --- a/src/libraries/System.Net.HttpListener/tests/HttpListenerRequestTests.cs +++ b/src/libraries/System.Net.HttpListener/tests/HttpListenerRequestTests.cs @@ -35,7 +35,7 @@ public void Dispose() [InlineData("Accept: Test, Test2,Test3 , Test4", new string[] { "Test", "Test2", "Test3 ", " Test4" })] [InlineData("Accept: ", new string[] { "" })] [InlineData("Unknown-Header: ", null)] - public async Task AcceptTypes_GetProperty_ReturnsExpected(string acceptString, string[] expected) + public async Task AcceptTypes_GetProperty_ReturnsExpected(string acceptString, string[]? expected) { HttpListenerRequest request = await GetRequest("POST", "", new string[] { acceptString }); Assert.Equal(request.AcceptTypes, request.AcceptTypes); @@ -164,7 +164,7 @@ public async Task ContentLength_SetInHeadersAfterAccessingProperty_DoesNothing() [InlineData("Referer: ", "")] [InlineData("Referer: http://microsoft.com<>", null)] [InlineData("Unknown-Header: ", null)] - public async Task Referer_GetProperty_ReturnsExpected(string refererString, string expected) + public async Task Referer_GetProperty_ReturnsExpected(string refererString, string? expected) { HttpListenerRequest request = await GetRequest("POST", "", new string[] { refererString }); Assert.Equal(expected, request.UrlReferrer?.ToString()); @@ -175,7 +175,7 @@ public async Task Referer_GetProperty_ReturnsExpected(string refererString, stri [InlineData("user-agent: Test", "Test")] [InlineData("User-Agent: ", "")] [InlineData("Unknown-Header: Test", null)] - public async Task UserAgent_GetProperty_ReturnsExpected(string userAgentString, string expected) + public async Task UserAgent_GetProperty_ReturnsExpected(string userAgentString, string? expected) { HttpListenerRequest request = await GetRequest("POST", "", new string[] { userAgentString }); Assert.Equal(expected, request.UserAgent); @@ -246,7 +246,7 @@ public async Task IsWebSocketRequest_GetProperty_ReturnsExpected(string webSocke [InlineData("Accept-Language:", new string[] { "" })] [InlineData("Accept-Language: ", new string[] { "" })] [InlineData("Unknown-Header: Test", null)] - public async Task UserLanguages_GetProperty_ReturnsExpected(string userLanguageString, string[] expected) + public async Task UserLanguages_GetProperty_ReturnsExpected(string userLanguageString, string[]? expected) { HttpListenerRequest request = await GetRequest("POST", "", new string[] { userLanguageString }); Assert.Equal(request.UserLanguages, request.UserLanguages); diff --git a/src/libraries/System.Net.HttpListener/tests/HttpListenerResponseTests.Headers.cs b/src/libraries/System.Net.HttpListener/tests/HttpListenerResponseTests.Headers.cs index 36327b28998075..356add431e6140 100644 --- a/src/libraries/System.Net.HttpListener/tests/HttpListenerResponseTests.Headers.cs +++ b/src/libraries/System.Net.HttpListener/tests/HttpListenerResponseTests.Headers.cs @@ -159,7 +159,7 @@ public async Task ContentType_SetAndSend_Success(string contentType, int expecte [InlineData(null, null)] [InlineData("", null)] [InlineData("\r \t \n", "")] - public async Task ContentType_SetNullEmptyOrWhitespace_ResetsContentType(string contentType, string expectedContentType) + public async Task ContentType_SetNullEmptyOrWhitespace_ResetsContentType(string? contentType, string? expectedContentType) { using (HttpListenerResponse response = await GetResponse()) { @@ -232,7 +232,7 @@ public async Task RedirectLocation_SetAndSend_Success(string redirectLocation, i [InlineData(null, null)] [InlineData("", null)] [InlineData("\r \t \n", "")] - public async Task RedirectLocation_SetNullOrEmpty_ResetsRedirectLocation(string redirectLocation, string expectedRedirectLocation) + public async Task RedirectLocation_SetNullOrEmpty_ResetsRedirectLocation(string? redirectLocation, string? expectedRedirectLocation) { using (HttpListenerResponse response = await GetResponse()) { diff --git a/src/libraries/System.Net.HttpListener/tests/HttpListenerResponseTests.cs b/src/libraries/System.Net.HttpListener/tests/HttpListenerResponseTests.cs index 75baedd07e4a11..e8c731a55abaa8 100644 --- a/src/libraries/System.Net.HttpListener/tests/HttpListenerResponseTests.cs +++ b/src/libraries/System.Net.HttpListener/tests/HttpListenerResponseTests.cs @@ -113,7 +113,7 @@ public async Task CopyFrom_NullTemplateResponse_ThrowsNullReferenceException() [InlineData(" \r \t \n", 123)] [InlineData("http://microsoft.com", 155)] [InlineData(" http://microsoft.com ", 155)] - public async Task Redirect_Invoke_SetsRedirectionProperties(string url, int expectedNumberOfBytes) + public async Task Redirect_Invoke_SetsRedirectionProperties(string? url, int expectedNumberOfBytes) { string expectedUrl = url?.Trim() ?? ""; diff --git a/src/libraries/System.Net.Mail/tests/Functional/ContentDispositionTest.cs b/src/libraries/System.Net.Mail/tests/Functional/ContentDispositionTest.cs index 2f25ed2bf8f12e..ff77e380603992 100644 --- a/src/libraries/System.Net.Mail/tests/Functional/ContentDispositionTest.cs +++ b/src/libraries/System.Net.Mail/tests/Functional/ContentDispositionTest.cs @@ -50,7 +50,7 @@ public void ConstructorWithOtherPropertyValues_ShouldSetAppropriately() [InlineData(typeof(ArgumentNullException), null)] [InlineData(typeof(FormatException), "inline; creation-date=\"" + InvalidDate + "\";")] [InlineData(typeof(FormatException), "inline; size=\"notANumber\"")] - public static void Ctor_InvalidThrows(Type exceptionType, string contentDisposition) + public static void Ctor_InvalidThrows(Type exceptionType, string? contentDisposition) { Assert.Throws(exceptionType, () => new ContentDisposition(contentDisposition)); } @@ -58,7 +58,7 @@ public static void Ctor_InvalidThrows(Type exceptionType, string contentDisposit [Theory] [InlineData(typeof(ArgumentNullException), null)] [InlineData(typeof(ArgumentException), "")] - public static void DispositionType_SetValue_InvalidThrows(Type exceptionType, string contentDisposition) + public static void DispositionType_SetValue_InvalidThrows(Type exceptionType, string? contentDisposition) { Assert.Throws(exceptionType, () => new ContentDisposition().DispositionType = contentDisposition); } diff --git a/src/libraries/System.Net.Mail/tests/Functional/ContentTypeTest.cs b/src/libraries/System.Net.Mail/tests/Functional/ContentTypeTest.cs index 603b910696c64d..97a52b85bfaac0 100644 --- a/src/libraries/System.Net.Mail/tests/Functional/ContentTypeTest.cs +++ b/src/libraries/System.Net.Mail/tests/Functional/ContentTypeTest.cs @@ -27,7 +27,7 @@ public static void DefaultCtor_ExpectedDefaultPropertyValues() [InlineData("text/plain; boundary=hello; charset=us-ascii; name=world", "text/plain", "us-ascii", "hello", "world")] [InlineData("text/plain; charset=us-ascii; name=world", "text/plain", "us-ascii", null, "world")] public static void Ctor_ContentString_ParsedValueMatchesExpected( - string contentType, string expectedMediaType, string expectedCharSet, string expectedBoundary, string expectedName) + string contentType, string expectedMediaType, string? expectedCharSet, string? expectedBoundary, string? expectedName) { var ct = new ContentType(contentType); Assert.Equal(expectedMediaType, ct.MediaType); @@ -58,7 +58,7 @@ public static void Ctor_ContentString_ParsedValueMatchesExpected( [InlineData(typeof(FormatException), "text/plain; charset=iso-8859-1; q=1.0, */xml; charset=utf-8; q=0.5")] [InlineData(typeof(FormatException), " , */xml; charset=utf-8; q=0.5 ")] [InlineData(typeof(FormatException), "text/plain; charset=iso-8859-1; q=1.0 , ")] - public static void Ctor_InvalidContentType_Throws(Type exceptionType, string contentType) + public static void Ctor_InvalidContentType_Throws(Type exceptionType, string? contentType) { Assert.Throws(exceptionType, () => new ContentType(contentType)); } diff --git a/src/libraries/System.Net.Mail/tests/Functional/SmtpClientSendMailTest.cs b/src/libraries/System.Net.Mail/tests/Functional/SmtpClientSendMailTest.cs index a65a4d63d05dcb..1f08beefa410af 100644 --- a/src/libraries/System.Net.Mail/tests/Functional/SmtpClientSendMailTest.cs +++ b/src/libraries/System.Net.Mail/tests/Functional/SmtpClientSendMailTest.cs @@ -42,7 +42,7 @@ public async Task ServerDoesntExist_Throws() [InlineData(null)] [SkipOnCoreClr("System.Net.Tests are flaky and/or long running: https://github.com/dotnet/runtime/issues/131", ~RuntimeConfiguration.Release)] [ActiveIssue("https://github.com/dotnet/runtime/issues/131", TestRuntimes.Mono)] // System.Net.Tests are flaky and/or long running - public async Task MailDelivery(string body) + public async Task MailDelivery(string? body) { Smtp.Credentials = new NetworkCredential("foo", "bar"); MailMessage msg = new MailMessage("foo@example.com", "bar@example.com", "hello", body); diff --git a/src/libraries/System.Net.Mail/tests/Functional/SmtpClientSpecifiedPickupDirectoryTest.cs b/src/libraries/System.Net.Mail/tests/Functional/SmtpClientSpecifiedPickupDirectoryTest.cs index 595cb2eecdf0ef..16279b7a116aea 100644 --- a/src/libraries/System.Net.Mail/tests/Functional/SmtpClientSpecifiedPickupDirectoryTest.cs +++ b/src/libraries/System.Net.Mail/tests/Functional/SmtpClientSpecifiedPickupDirectoryTest.cs @@ -82,7 +82,7 @@ public async Task Send_SpecifiedPickupDirectory_MessageBodyDoesNotEncodeForTrans [InlineData("")] [InlineData(null)] [InlineData("\0abc")] - public async Task Send_SpecifiedPickupDirectoryInvalid(string location) + public async Task Send_SpecifiedPickupDirectoryInvalid(string? location) { Smtp.DeliveryMethod = SmtpDeliveryMethod.SpecifiedPickupDirectory; Smtp.PickupDirectoryLocation = location; diff --git a/src/libraries/System.Net.Mail/tests/Functional/SmtpClientTest.cs b/src/libraries/System.Net.Mail/tests/Functional/SmtpClientTest.cs index a7f80b45a61691..7acc7195fa70ab 100644 --- a/src/libraries/System.Net.Mail/tests/Functional/SmtpClientTest.cs +++ b/src/libraries/System.Net.Mail/tests/Functional/SmtpClientTest.cs @@ -163,7 +163,7 @@ public void ServicePoint_ReflectsHostAndPortChange() [InlineData("shouldnotexist")] [InlineData("\0")] [InlineData("C:\\some\\path\\like\\string")] - public void PickupDirectoryLocationTest(string folder) + public void PickupDirectoryLocationTest(string? folder) { Smtp.PickupDirectoryLocation = folder; Assert.Equal(folder, Smtp.PickupDirectoryLocation); diff --git a/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs b/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs index ff7a955282a5c4..98403c5570e9d2 100644 --- a/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs +++ b/src/libraries/System.Net.Ping/tests/FunctionalTests/PingTest.cs @@ -885,7 +885,7 @@ public void SendPingWithIPAddressAndTimeoutAndBufferAndPingOptions_ElevatedUnix( [InlineData(AddressFamily.InterNetworkV6, "ja_JP.UTF8", null, null)] [InlineData(AddressFamily.InterNetworkV6, "en_US.UTF8", "ja_JP.UTF8", null)] [InlineData(AddressFamily.InterNetworkV6, "en_US.UTF8", null, "ja_JP.UTF8")] - public async Task SendPing_LocaleEnvVarsMustBeIgnored(AddressFamily addressFamily, string envVar_LANG, string envVar_LC_MESSAGES, string envVar_LC_ALL) + public async Task SendPing_LocaleEnvVarsMustBeIgnored(AddressFamily addressFamily, string envVar_LANG, string? envVar_LC_MESSAGES, string? envVar_LC_ALL) { IPAddress localIpAddress = TestSettings.GetLocalIPAddress(addressFamily); if (localIpAddress == null) @@ -919,7 +919,7 @@ await RemoteExecutor.Invoke(address => [InlineData(AddressFamily.InterNetworkV6, "ja_JP.UTF8", null, null)] [InlineData(AddressFamily.InterNetworkV6, "en_US.UTF8", "ja_JP.UTF8", null)] [InlineData(AddressFamily.InterNetworkV6, "en_US.UTF8", null, "ja_JP.UTF8")] - public async Task SendPingAsync_LocaleEnvVarsMustBeIgnored(AddressFamily addressFamily, string envVar_LANG, string envVar_LC_MESSAGES, string envVar_LC_ALL) + public async Task SendPingAsync_LocaleEnvVarsMustBeIgnored(AddressFamily addressFamily, string envVar_LANG, string? envVar_LC_MESSAGES, string? envVar_LC_ALL) { IPAddress localIpAddress = TestSettings.GetLocalIPAddress(addressFamily); diff --git a/src/libraries/System.Net.Primitives/tests/FunctionalTests/CookieTest.cs b/src/libraries/System.Net.Primitives/tests/FunctionalTests/CookieTest.cs index 6a31011d3ca77a..e01a78b70c5f9c 100644 --- a/src/libraries/System.Net.Primitives/tests/FunctionalTests/CookieTest.cs +++ b/src/libraries/System.Net.Primitives/tests/FunctionalTests/CookieTest.cs @@ -166,7 +166,7 @@ public static void Name_GetSet_Success() [InlineData("hello=")] [InlineData("hello;")] [InlineData("hello,")] - public static void Name_Set_Invalid(string name) + public static void Name_Set_Invalid(string? name) { Cookie c = new Cookie(); Assert.Throws(() => c.Name = name); diff --git a/src/libraries/System.Net.Requests/tests/AuthorizationTest.cs b/src/libraries/System.Net.Requests/tests/AuthorizationTest.cs index 866ce373dae672..c89d3d2c6b531a 100644 --- a/src/libraries/System.Net.Requests/tests/AuthorizationTest.cs +++ b/src/libraries/System.Net.Requests/tests/AuthorizationTest.cs @@ -26,7 +26,7 @@ public void Ctor_Token_ExpectDefaultValues() [Theory] [InlineData(null)] [InlineData("")] - public void Ctor_TokenNullOrEmpty_ExpectMessageNull(string token) + public void Ctor_TokenNullOrEmpty_ExpectMessageNull(string? token) { Authorization authorization = new Authorization(token); Assert.Null(authorization.Message); @@ -35,7 +35,7 @@ public void Ctor_TokenNullOrEmpty_ExpectMessageNull(string token) [Theory] [InlineData(null)] [InlineData("")] - public void Ctor_ConnectionGroupIdNullOrEmpty_ExpectConnectionGroupIdNull(string connectionGroupId) + public void Ctor_ConnectionGroupIdNullOrEmpty_ExpectConnectionGroupIdNull(string? connectionGroupId) { Authorization authorization = new Authorization(null, true, connectionGroupId); Assert.Null(authorization.ConnectionGroupId); @@ -44,7 +44,7 @@ public void Ctor_ConnectionGroupIdNullOrEmpty_ExpectConnectionGroupIdNull(string [Theory] [InlineData(null)] [InlineData(new object[] { new string[0] { } })] - public void ProtectionRealm_SetNullOrEmptyGet_ExpectNullValue(string[] protectionRealm) + public void ProtectionRealm_SetNullOrEmptyGet_ExpectNullValue(string[]? protectionRealm) { Authorization authorization = new Authorization(null); authorization.ProtectionRealm = protectionRealm; diff --git a/src/libraries/System.Net.Security/tests/UnitTests/SslAuthenticationOptionsTests.cs b/src/libraries/System.Net.Security/tests/UnitTests/SslAuthenticationOptionsTests.cs index 22c8bcfffae93d..69874a0e85bf4b 100644 --- a/src/libraries/System.Net.Security/tests/UnitTests/SslAuthenticationOptionsTests.cs +++ b/src/libraries/System.Net.Security/tests/UnitTests/SslAuthenticationOptionsTests.cs @@ -80,7 +80,7 @@ public void LocalCertificateSelectionCallback_Get_Set_Succeeds() [InlineData("hello")] [InlineData(" \t")] [InlineData(null)] - public void TargetHost_Get_Set_Succeeds(string expected) + public void TargetHost_Get_Set_Succeeds(string? expected) { Assert.Null(_clientOptions.TargetHost); _clientOptions.TargetHost = expected; diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/KeepAliveTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/KeepAliveTest.cs index 1ce2ecc707dec7..48921474afdea3 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/KeepAliveTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/KeepAliveTest.cs @@ -144,7 +144,7 @@ public void Socket_Get_KeepAlive_Time_AsByteArray_OptionLengthZero_Failure() [InlineData(null)] [InlineData(new byte[0])] [InlineData(new byte[3] { 0, 0, 0 })] - public void Socket_Get_KeepAlive_Time_AsByteArray_BufferNullOrTooSmall_Failure(byte[] buffer) + public void Socket_Get_KeepAlive_Time_AsByteArray_BufferNullOrTooSmall_Failure(byte[]? buffer) { if (PlatformDetection.IsQemuLinux && (buffer == null || buffer.Length == 0)) { diff --git a/src/libraries/System.Net.WebClient/tests/WebClientTest.cs b/src/libraries/System.Net.WebClient/tests/WebClientTest.cs index e314088be3f9f0..7457d053171147 100644 --- a/src/libraries/System.Net.WebClient/tests/WebClientTest.cs +++ b/src/libraries/System.Net.WebClient/tests/WebClientTest.cs @@ -512,7 +512,7 @@ public abstract class WebClientTestBase [InlineData(null)] [InlineData("text/html; charset=utf-8")] [InlineData("text/html; charset=us-ascii")] - public async Task DownloadString_Success(string contentType) + public async Task DownloadString_Success(string? contentType) { await LoopbackServer.CreateServerAsync(async (server, url) => { diff --git a/src/libraries/System.Net.WebHeaderCollection/tests/WebHeaderCollectionTest.cs b/src/libraries/System.Net.WebHeaderCollection/tests/WebHeaderCollectionTest.cs index f4ad906fd78f54..256f3d43853553 100644 --- a/src/libraries/System.Net.WebHeaderCollection/tests/WebHeaderCollectionTest.cs +++ b/src/libraries/System.Net.WebHeaderCollection/tests/WebHeaderCollectionTest.cs @@ -135,7 +135,7 @@ public void Setter_ValidName_Success() [Theory] [InlineData(null)] [InlineData("")] - public void Setter_NullOrEmptyName_Throws(string name) + public void Setter_NullOrEmptyName_Throws(string? name) { WebHeaderCollection w = new WebHeaderCollection(); AssertExtensions.Throws("name", () => w[name] = "test"); @@ -222,7 +222,7 @@ public void Remove_HeaderExists_RemovesFromCollection(string name) [Theory] [InlineData(null)] [InlineData("")] - public void Remove_NullOrEmptyHeader_ThrowsArgumentNullException(string name) + public void Remove_NullOrEmptyHeader_ThrowsArgumentNullException(string? name) { var headers = new WebHeaderCollection(); AssertExtensions.Throws("name", () => headers.Remove(name)); @@ -342,7 +342,7 @@ public void ToString_Empty_Success() [Theory] [InlineData(null)] [InlineData("")] - public void ToString_SingleHeaderWithEmptyValue_Success(string value) + public void ToString_SingleHeaderWithEmptyValue_Success(string? value) { WebHeaderCollection w = new WebHeaderCollection(); w["name"] = value; @@ -515,7 +515,7 @@ public void Add_ValidHeader_AddsToHeaders() [Theory] [InlineData(null)] [InlineData("")] - public void Add_NullHeader_ThrowsArgumentNullException(string header) + public void Add_NullHeader_ThrowsArgumentNullException(string? header) { var headers = new WebHeaderCollection(); AssertExtensions.Throws("header", () => headers.Add(header)); diff --git a/src/libraries/System.ObjectModel/tests/System/Collections/Specialized/NotifyCollectionChangedEventArgsTests.cs b/src/libraries/System.ObjectModel/tests/System/Collections/Specialized/NotifyCollectionChangedEventArgsTests.cs index c0afe20a448254..235697eed47a64 100644 --- a/src/libraries/System.ObjectModel/tests/System/Collections/Specialized/NotifyCollectionChangedEventArgsTests.cs +++ b/src/libraries/System.ObjectModel/tests/System/Collections/Specialized/NotifyCollectionChangedEventArgsTests.cs @@ -189,7 +189,7 @@ public void Ctor_InvalidActionForChanged_ThrowsArgumentException(NotifyCollectio [InlineData(NotifyCollectionChangedAction.Replace, "oldItem", "oldItem")] [InlineData(NotifyCollectionChangedAction.Replace, null, "item")] [InlineData(NotifyCollectionChangedAction.Replace, "item", null)] - public void Ctor_NotifyCollectionChangedAction_Object_Object(NotifyCollectionChangedAction action, object newItem, object oldItem) + public void Ctor_NotifyCollectionChangedAction_Object_Object(NotifyCollectionChangedAction action, object? newItem, object? oldItem) { var e = new NotifyCollectionChangedEventArgs(action, newItem, oldItem); Assert.Equal(action, e.Action); @@ -204,7 +204,7 @@ public void Ctor_NotifyCollectionChangedAction_Object_Object(NotifyCollectionCha [InlineData(NotifyCollectionChangedAction.Replace, "oldItem", "oldItem", 0)] [InlineData(NotifyCollectionChangedAction.Replace, null, "item", -10)] [InlineData(NotifyCollectionChangedAction.Replace, "item", null, -1)] - public void Ctor_NotifyCollectionChangedAction_Object_Object_Int(NotifyCollectionChangedAction action, object newItem, object oldItem, int index) + public void Ctor_NotifyCollectionChangedAction_Object_Object_Int(NotifyCollectionChangedAction action, object? newItem, object? oldItem, int index) { var e = new NotifyCollectionChangedEventArgs(action, newItem, oldItem, index); Assert.Equal(action, e.Action); @@ -291,7 +291,7 @@ public void Ctor_NullOldItemsForReplace_ThrowsArgumentNullException() [InlineData(NotifyCollectionChangedAction.Move, "item", 1, 1)] [InlineData(NotifyCollectionChangedAction.Move, "item", 1, -2)] [InlineData(NotifyCollectionChangedAction.Move, null, 1, 2)] - public void Ctor_NotifyCollectionChangedAction_Object_Int_Int(NotifyCollectionChangedAction action, object changedItem, int index, int oldIndex) + public void Ctor_NotifyCollectionChangedAction_Object_Int_Int(NotifyCollectionChangedAction action, object? changedItem, int index, int oldIndex) { var e = new NotifyCollectionChangedEventArgs(action, changedItem, index, oldIndex); Assert.Equal(action, e.Action); @@ -306,7 +306,7 @@ public void Ctor_NotifyCollectionChangedAction_Object_Int_Int(NotifyCollectionCh [InlineData(NotifyCollectionChangedAction.Move, new object[] { "item" }, 1, 1)] [InlineData(NotifyCollectionChangedAction.Move, new object[0], 1, -2)] [InlineData(NotifyCollectionChangedAction.Move, null, 1, 2)] - public void Ctor_NotifyCollectionChangedAction_IList_Int_Int(NotifyCollectionChangedAction action, IList changedItems, int index, int oldIndex) + public void Ctor_NotifyCollectionChangedAction_IList_Int_Int(NotifyCollectionChangedAction action, IList? changedItems, int index, int oldIndex) { var e = new NotifyCollectionChangedEventArgs(action, changedItems, index, oldIndex); Assert.Equal(action, e.Action); @@ -386,7 +386,7 @@ public void List_Clear_ThrowsNotSupportedException() [InlineData("item", true)] [InlineData(1, false)] [InlineData(null, false)] - public void List_Contains_ReturnsExpected(object value, bool expected) + public void List_Contains_ReturnsExpected(object? value, bool expected) { var e = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, new object[] { "item" }, new object[0]); IList list = e.NewItems; @@ -407,7 +407,7 @@ public void List_CopyToInvoke_Success() [InlineData("item", 0)] [InlineData(1, -1)] [InlineData(null, -1)] - public void List_IndexOf_ReturnsExpected(object value, int expected) + public void List_IndexOf_ReturnsExpected(object? value, int expected) { var e = new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Replace, new object[] { "item" }, new object[0]); IList list = e.NewItems; diff --git a/src/libraries/System.ObjectModel/tests/System/ComponentModel/DataErrorsChangedEventArgsTests.cs b/src/libraries/System.ObjectModel/tests/System/ComponentModel/DataErrorsChangedEventArgsTests.cs index b87dd83c8da04c..0a7ce6dfe6e4dc 100644 --- a/src/libraries/System.ObjectModel/tests/System/ComponentModel/DataErrorsChangedEventArgsTests.cs +++ b/src/libraries/System.ObjectModel/tests/System/ComponentModel/DataErrorsChangedEventArgsTests.cs @@ -11,7 +11,7 @@ public class DataErrorsChangedEventArgsTests [InlineData(null)] [InlineData("")] [InlineData("propertyName")] - public void Ctor_String(string propertyName) + public void Ctor_String(string? propertyName) { var e = new DataErrorsChangedEventArgs(propertyName); Assert.Equal(propertyName, e.PropertyName); diff --git a/src/libraries/System.ObjectModel/tests/System/ComponentModel/PropertyChangedEventArgsTests.cs b/src/libraries/System.ObjectModel/tests/System/ComponentModel/PropertyChangedEventArgsTests.cs index 697665bcd14b21..fcb48e38ca3c12 100644 --- a/src/libraries/System.ObjectModel/tests/System/ComponentModel/PropertyChangedEventArgsTests.cs +++ b/src/libraries/System.ObjectModel/tests/System/ComponentModel/PropertyChangedEventArgsTests.cs @@ -11,7 +11,7 @@ public class PropertyChangedEventArgsTests [InlineData(null)] [InlineData("")] [InlineData("propertyName")] - public void Ctor_String(string propertyName) + public void Ctor_String(string? propertyName) { var e = new PropertyChangedEventArgs(propertyName); Assert.Equal(propertyName, e.PropertyName); diff --git a/src/libraries/System.ObjectModel/tests/System/ComponentModel/PropertyChangingEventArgsTests.cs b/src/libraries/System.ObjectModel/tests/System/ComponentModel/PropertyChangingEventArgsTests.cs index 4e18bd5282a3b5..9921e4bb6aafc0 100644 --- a/src/libraries/System.ObjectModel/tests/System/ComponentModel/PropertyChangingEventArgsTests.cs +++ b/src/libraries/System.ObjectModel/tests/System/ComponentModel/PropertyChangingEventArgsTests.cs @@ -11,7 +11,7 @@ public class PropertyChangingEventArgsTests [InlineData(null)] [InlineData("")] [InlineData("propertyName")] - public void Ctor_String(string propertyName) + public void Ctor_String(string? propertyName) { var e = new PropertyChangingEventArgs(propertyName); Assert.Equal(propertyName, e.PropertyName); diff --git a/src/libraries/System.ObjectModel/tests/System/Windows/Markup/ValueSerializerAttributeTests.cs b/src/libraries/System.ObjectModel/tests/System/Windows/Markup/ValueSerializerAttributeTests.cs index 23b513e798a303..8c4f5838a01985 100644 --- a/src/libraries/System.ObjectModel/tests/System/Windows/Markup/ValueSerializerAttributeTests.cs +++ b/src/libraries/System.ObjectModel/tests/System/Windows/Markup/ValueSerializerAttributeTests.cs @@ -13,7 +13,7 @@ public class ValueSerializerAttributeTests [InlineData("propertyName", null)] [InlineData("System.Int32", typeof(int))] [InlineData("System.int32", null)] - public void Ctor_String(string valueSerializerTypeName, Type expectedValueSerializerType) + public void Ctor_String(string? valueSerializerTypeName, Type? expectedValueSerializerType) { var attribute = new ValueSerializerAttribute(valueSerializerTypeName); Assert.Equal(valueSerializerTypeName, attribute.ValueSerializerTypeName); @@ -23,7 +23,7 @@ public void Ctor_String(string valueSerializerTypeName, Type expectedValueSerial [Theory] [InlineData(null)] [InlineData(typeof(int))] - public void Ctor_Type(Type valueSerializerType) + public void Ctor_Type(Type? valueSerializerType) { var attribute = new ValueSerializerAttribute(valueSerializerType); Assert.Equal(valueSerializerType?.AssemblyQualifiedName, attribute.ValueSerializerTypeName); diff --git a/src/libraries/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs b/src/libraries/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs index b070957e834e21..5e35c4c1e146c7 100644 --- a/src/libraries/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs +++ b/src/libraries/System.Private.Uri/tests/FunctionalTests/UriBuilderTests.cs @@ -97,7 +97,7 @@ public void Ctor_Uri_Null() [InlineData("http", null, "http", "")] [InlineData(null, "", "", "")] [InlineData(null, null, "", "")] - public void Ctor_String_String(string schemeName, string hostName, string expectedScheme, string expectedHost) + public void Ctor_String_String(string? schemeName, string? hostName, string expectedScheme, string expectedHost) { var uriBuilder = new UriBuilder(schemeName, hostName); VerifyUriBuilder(uriBuilder, expectedScheme, "", "", expectedHost, -1, "/", "", ""); @@ -116,7 +116,7 @@ public void Ctor_String_String(string schemeName, string hostName, string expect [InlineData("http", null, 180, "http", "")] [InlineData(null, "", -1, "", "")] [InlineData(null, null, 65535, "", "")] - public void Ctor_String_String_Int(string scheme, string host, int port, string expectedScheme, string expectedHost) + public void Ctor_String_String_Int(string? scheme, string? host, int port, string expectedScheme, string expectedHost) { var uriBuilder = new UriBuilder(scheme, host, port); VerifyUriBuilder(uriBuilder, expectedScheme, "", "", expectedHost, port, "/", "", ""); @@ -135,7 +135,7 @@ public void Ctor_String_String_Int(string scheme, string host, int port, string [InlineData("http", null, 180, @"path1\path2\", "http", "", "path1/path2/")] [InlineData(null, "", -1, "\u1234", "", "", "%E1%88%B4")] [InlineData(null, null, 65535, "\u1234\u2345", "", "", "%E1%88%B4%E2%8D%85")] - public void Ctor_String_String_Int_String(string schemeName, string hostName, int port, string pathValue, string expectedScheme, string expectedHost, string expectedPath) + public void Ctor_String_String_Int_String(string? schemeName, string? hostName, int port, string? pathValue, string expectedScheme, string expectedHost, string expectedPath) { var uriBuilder = new UriBuilder(schemeName, hostName, port, pathValue); VerifyUriBuilder(uriBuilder, expectedScheme, "", "", expectedHost, port, expectedPath, "", ""); @@ -153,7 +153,7 @@ public void Ctor_String_String_Int_String(string schemeName, string hostName, in [InlineData("http", null, 180, @"path1\path2\", "?\u1234#\u2345", "http", "", "path1/path2/", "?\u1234", "#\u2345")] [InlineData(null, "", -1, "\u1234", "", "", "", "%E1%88%B4", "", "")] [InlineData(null, null, 65535, "\u1234\u2345", null, "", "", "%E1%88%B4%E2%8D%85", "", "")] - public void Ctor_String_String_Int_String_String(string schemeName, string hostName, int port, string pathValue, string extraValue, string expectedScheme, string expectedHost, string expectedPath, string expectedQuery, string expectedFragment) + public void Ctor_String_String_Int_String_String(string? schemeName, string? hostName, int port, string? pathValue, string? extraValue, string expectedScheme, string expectedHost, string expectedPath, string expectedQuery, string expectedFragment) { var uriBuilder = new UriBuilder(schemeName, hostName, port, pathValue, extraValue); VerifyUriBuilder(uriBuilder, expectedScheme, "", "", expectedHost, port, expectedPath, expectedQuery, expectedFragment); @@ -171,7 +171,7 @@ public void Ctor_InvalidExtraValue_ThrowsArgumentException(string extraValue) [InlineData("https", "https")] [InlineData("", "")] [InlineData(null, "")] - public void Scheme_Get_Set(string value, string expected) + public void Scheme_Get_Set(string? value, string expected) { var uriBuilder = new UriBuilder("http://userinfo@domain/path?query#fragment"); uriBuilder.Scheme = value; @@ -196,7 +196,7 @@ public void InvalidScheme_ThrowsArgumentException(string schemeName) [InlineData("username", "username")] [InlineData("", "")] [InlineData(null, "")] - public void UserName_Get_Set(string value, string expected) + public void UserName_Get_Set(string? value, string expected) { var uriBuilder = new UriBuilder("http://userinfo@domain/path?query#fragment"); uriBuilder.UserName = value; @@ -212,7 +212,7 @@ public void UserName_Get_Set(string value, string expected) [InlineData("password", "password")] [InlineData("", "")] [InlineData(null, "")] - public void Password_Get_Set(string value, string expected) + public void Password_Get_Set(string? value, string expected) { var uriBuilder = new UriBuilder("http://userinfo1:PLACEHOLDER@domain/path?query#fragment"); uriBuilder.Password = value; @@ -227,7 +227,7 @@ public void Password_Get_Set(string value, string expected) [InlineData("host", "host")] [InlineData("", "")] [InlineData(null, "")] - public void Host_Get_Set(string value, string expected) + public void Host_Get_Set(string? value, string expected) { var uriBuilder = new UriBuilder("http://userinfo@domain/path?query#fragment"); uriBuilder.Host = value; @@ -264,7 +264,7 @@ public void InvalidPort_ThrowsArgumentOutOfRangeException(int portNumber) [InlineData(@"\path1\path2", "/path1/path2")] [InlineData("", "/")] [InlineData(null, "/")] - public void Path_Get_Set(string value, string expected) + public void Path_Get_Set(string? value, string expected) { var uriBuilder = new UriBuilder("http://userinfo@domain/path?query#fragment"); uriBuilder.Path = value; @@ -275,7 +275,7 @@ public void Path_Get_Set(string value, string expected) [InlineData("query", "?query")] [InlineData("", "")] [InlineData(null, "")] - public void Query_Get_Set(string value, string expected) + public void Query_Get_Set(string? value, string expected) { var uriBuilder = new UriBuilder(); uriBuilder.Query = value; @@ -306,7 +306,7 @@ public void Fragment_Get_Set_StartsWithPound(string value, string expected) [InlineData("fragment", "#fragment")] [InlineData("", "")] [InlineData(null, "")] - public void Fragment_Get_Set(string value, string expected) + public void Fragment_Get_Set(string? value, string expected) { var uriBuilder = new UriBuilder(); uriBuilder.Fragment = value; diff --git a/src/libraries/System.Private.Uri/tests/FunctionalTests/UriTests.cs b/src/libraries/System.Private.Uri/tests/FunctionalTests/UriTests.cs index 5697e803a76da9..bf1a31d6c7927d 100644 --- a/src/libraries/System.Private.Uri/tests/FunctionalTests/UriTests.cs +++ b/src/libraries/System.Private.Uri/tests/FunctionalTests/UriTests.cs @@ -491,7 +491,7 @@ public static void TestMakeRelative() [InlineData("1.2.3.4", UriHostNameType.IPv4)] [InlineData(null, UriHostNameType.Unknown)] [InlineData("!@*(@#&*#$&*#", UriHostNameType.Unknown)] - public static void TestCheckHostName(string hostName, UriHostNameType expected) + public static void TestCheckHostName(string? hostName, UriHostNameType expected) { Assert.Equal(expected, Uri.CheckHostName(hostName)); } @@ -500,7 +500,7 @@ public static void TestCheckHostName(string hostName, UriHostNameType expected) [InlineData("http", true)] [InlineData(null, false)] [InlineData("!", false)] - public static void TestCheckSchemeName(string scheme, bool expected) + public static void TestCheckSchemeName(string? scheme, bool expected) { Assert.Equal(expected, Uri.CheckSchemeName(scheme)); } diff --git a/src/libraries/System.Private.Xml.Linq/tests/Properties/NamespaceAccessors.cs b/src/libraries/System.Private.Xml.Linq/tests/Properties/NamespaceAccessors.cs index 076e9df7de1708..3b2d78762ebe48 100644 --- a/src/libraries/System.Private.Xml.Linq/tests/Properties/NamespaceAccessors.cs +++ b/src/libraries/System.Private.Xml.Linq/tests/Properties/NamespaceAccessors.cs @@ -82,7 +82,7 @@ public void GetDefaultNamespaceDMLSanity() [InlineData("", "xml", "http://www.w3.org/XML/1998/namespace")] [InlineData("", "xmlns", "http://www.w3.org/2000/xmlns/")] [InlineData("", "X", null)] - public void NamespaceForPrefix(string xml, string prefix, string ns) + public void NamespaceForPrefix(string xml, string prefix, string? ns) { XNamespace NS = ns == null ? null : XNamespace.Get(ns); XElement e = XElement.Parse(xml); @@ -97,7 +97,7 @@ public void NamespaceForPrefix(string xml, string prefix, string ns) [Theory] [InlineData("", null, typeof(ArgumentNullException))] [InlineData("", "", typeof(ArgumentException))] - public void NamespaceForPrefixNull(string xml, string prefix, Type expectedException) + public void NamespaceForPrefixNull(string xml, string? prefix, Type expectedException) { XElement e = XElement.Parse(xml); Assert.Throws(expectedException, () => (e.FirstNode as XElement).GetNamespaceOfPrefix(prefix)); @@ -155,7 +155,7 @@ public void NamespaceForPrefixDMLSanity() [InlineData("", "xml", "http://www.w3.org/XML/1998/namespace")] [InlineData("", "xmlns", "http://www.w3.org/2000/xmlns/")] [InlineData("", null, "nonexisting")] - public void PrefixOfNamespace(string xml, string prefix, string ns) + public void PrefixOfNamespace(string xml, string? prefix, string ns) { XElement e = XElement.Parse(xml); string pref = (e.FirstNode as XElement).GetPrefixOfNamespace(XNamespace.Get(ns)); @@ -164,7 +164,7 @@ public void PrefixOfNamespace(string xml, string prefix, string ns) [Theory] [InlineData("", null)] - public void PrefixOfNamespaceNull(string xml, string ns) + public void PrefixOfNamespaceNull(string xml, string? ns) { XElement e = XElement.Parse(xml); Assert.Throws(() => (e.FirstNode as XElement).GetPrefixOfNamespace(ns)); diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_AllowXmlAttributes.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_AllowXmlAttributes.cs index 2d5ffe75de7f5a..b1050c8851651a 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_AllowXmlAttributes.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_AllowXmlAttributes.cs @@ -264,7 +264,7 @@ private XmlReader CreateReader(string xmlFile, XmlSchemaSet ss, bool allowXml) [InlineData("v1-1.xml", "v1.xsd", true, 0, 0, 2)] //[Variation(Desc = "v1.1.1- Custom XML namespace System.Xml.XmlSchemaTests in the set, particle has reference to custom attribute, allowXmlAttribute=false", Priority = 1, id = 1, Params = new object[] { "v1-1.xml", "v1.xsd", false, 0, 1, 2 })] [InlineData("v1-1.xml", "v1.xsd", false, 0, 1, 2)] - public void v1(string xmlFile, string xsdFile, bool allowXmlAttributes, int expectedWarningCount, int expectedErrorCount, int expectedSchemaSetCount) + public void v1(string xmlFile, string? xsdFile, bool allowXmlAttributes, int expectedWarningCount, int expectedErrorCount, int expectedSchemaSetCount) { Initialize(); XmlSchemaSet xss = new XmlSchemaSet(); diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Imports.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Imports.cs index b878e2f5b89348..1997acdb459e36 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Imports.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaSet/TC_SchemaSet_Imports.cs @@ -27,7 +27,7 @@ public TC_SchemaSet_Imports(ITestOutputHelper output) //[Variation(Desc = "v1.1 - Import: A with NS imports B with no NS", Priority = 0, Params = new object[] { "import_v1_a.xsd", "include_v1_b.xsd", 2, null })] [InlineData("import_v1_a.xsd", "include_v1_b.xsd", 2, null)] [Theory] - public void v1(object param0, object param1, object param2, object param3) + public void v1(object param0, object param1, object param2, object? param3) { XmlSchemaSet sc = new XmlSchemaSet(); sc.XmlResolver = new XmlUrlResolver(); @@ -54,7 +54,7 @@ public void v1(object param0, object param1, object param2, object param3) //[Variation(Desc = "v2.1 - Import: Add B(ns-b) , then A(ns-a) which improts B (ns-b)", Priority = 1, Params = new object[] { "import_v2_a.xsd", "import_v2_b.xsd", 2, null, "ns-b" })] [InlineData("import_v2_a.xsd", "import_v2_b.xsd", 2, null, "ns-b")] [Theory] - public void v3(object param0, object param1, object param2, object param3, object param4) + public void v3(object param0, object param1, object param2, object? param3, object? param4) { XmlSchemaSet sc = new XmlSchemaSet(); sc.XmlResolver = new XmlUrlResolver(); @@ -527,7 +527,7 @@ public void v100() //[Variation(Desc = "v101.1 - Improt: A with NS imports B with no NS", Priority = 0, Params = new object[] { "import_v1_a.xsd", "include_v1_b.xsd", 2, null })] [InlineData("import_v1_a.xsd", "include_v1_b.xsd", 2, null)] [Theory] - public void v101(object param0, object param1, object param2, object param3) + public void v101(object param0, object param1, object param2, object? param3) { XmlSchemaSet sc = new XmlSchemaSet(); sc.XmlResolver = new XmlUrlResolver(); @@ -557,7 +557,7 @@ public void v101(object param0, object param1, object param2, object param3) //[Variation(Desc = "v102.1 - Import: Add B(ns-b) , then A(ns-a) which improts B (ns-b)", Priority = 1, Params = new object[] { "import_v2_a.xsd", "import_v2_b.xsd", 2, null, "ns-b" })] [InlineData("import_v2_a.xsd", "import_v2_b.xsd", 2, null, "ns-b")] [Theory] - public void v102(object param0, object param1, object param2, object param3, object param4) + public void v102(object param0, object param1, object param2, object? param3, object param4) { XmlSchemaSet sc = new XmlSchemaSet(); sc.XmlResolver = new XmlUrlResolver(); @@ -1225,7 +1225,7 @@ public void v120() //[Variation(Desc = "v201.1 - Improt: A with NS imports B with no NS", Priority = 0, Params = new object[] { "import_v1_a.xsd", "include_v1_b.xsd", 2, null })] [InlineData("import_v1_a.xsd", "include_v1_b.xsd", 2, null)] [Theory] - public void v201(object param0, object param1, object param2, object param3) + public void v201(object param0, object param1, object param2, object? param3) { XmlSchemaSet sc = new XmlSchemaSet(); sc.XmlResolver = new XmlUrlResolver(); @@ -1253,7 +1253,7 @@ public void v201(object param0, object param1, object param2, object param3) //[Variation(Desc = "v202.1 - Import: Add B(ns-b) , then A(ns-a) which improts B (ns-b)", Priority = 1, Params = new object[] { "import_v2_a.xsd", "import_v2_b.xsd", 2, null, "ns-b" })] [InlineData("import_v2_a.xsd", "import_v2_b.xsd", 2, null, "ns-b")] [Theory] - public void v202(object param0, object param1, object param2, object param3, object param4) + public void v202(object param0, object param1, object param2, object? param3, object param4) { XmlSchemaSet sc = new XmlSchemaSet(); sc.XmlResolver = new XmlUrlResolver(); diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateAttribute.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateAttribute.cs index 9e4ad966f41936..5a7d8820e25154 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateAttribute.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateAttribute.cs @@ -26,7 +26,7 @@ public TCValidateAttribute(ITestOutputHelper output) : base(output) [Theory] [InlineData(null, "")] [InlineData("attr", null)] - public void PassNull_LocalName_NameSpace__Invalid(string localName, string nameSpace) + public void PassNull_LocalName_NameSpace__Invalid(string? localName, string? nameSpace) { XmlSchemaValidator val = CreateValidator(XSDFILE_VALIDATE_ATTRIBUTE); XmlSchemaInfo info = new XmlSchemaInfo(); diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateAttribute_String.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateAttribute_String.cs index a3eeff42b26011..828f6a2133cd53 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateAttribute_String.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateAttribute_String.cs @@ -26,7 +26,7 @@ public TCValidateAttribute_String(ITestOutputHelper output) : base(output) [Theory] [InlineData(null, "")] [InlineData("attr", null)] - public void PassNull_LocalName_Namespace__Invalid(string localName, string nameSpace) + public void PassNull_LocalName_Namespace__Invalid(string? localName, string? nameSpace) { XmlSchemaValidator val = CreateValidator(XSDFILE_VALIDATE_ATTRIBUTE); XmlSchemaInfo info = new XmlSchemaInfo(); diff --git a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateElement.cs b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateElement.cs index 543c92c9ca4eb1..cc3217a910c776 100644 --- a/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateElement.cs +++ b/src/libraries/System.Private.Xml/tests/XmlSchema/XmlSchemaValidatorApi/ValidateElement.cs @@ -242,7 +242,7 @@ public void CheckNoNamespaceSchemaLocationIs_UsedWhenSpecified_NotUsedWhenFlagIs [Theory] [InlineData(null)] [InlineData("false")] - public void CallWith_Null_False_XsiNil(string xsiNil) + public void CallWith_Null_False_XsiNil(string? xsiNil) { XmlSchemaValidator val; XmlSchemaInfo info = new XmlSchemaInfo(); diff --git a/src/libraries/System.Reflection.Emit.ILGeneration/tests/CustomAttributeBuilderTests.cs b/src/libraries/System.Reflection.Emit.ILGeneration/tests/CustomAttributeBuilderTests.cs index cef38b3f9ac73d..a7fec8201c6dc8 100644 --- a/src/libraries/System.Reflection.Emit.ILGeneration/tests/CustomAttributeBuilderTests.cs +++ b/src/libraries/System.Reflection.Emit.ILGeneration/tests/CustomAttributeBuilderTests.cs @@ -886,7 +886,7 @@ public static void DynamicTypeInPropertyValues_ThrowsFileNotFoundExceptionOnCrea [InlineData(new string[] { nameof(TestAttribute.TestInt) }, new object[] { "TestString", 10 }, "namedFields, fieldValues")] [InlineData(new string[] { nameof(TestAttribute.TestInt), nameof(TestAttribute.TestStringField) }, new object[] { "TestString", 10 }, null)] [InlineData(new string[] { nameof(TestAttribute.TestStringField) }, new object[] { 10 }, null)] - public void NamedFieldAndFieldValuesDifferentLengths_ThrowsArgumentException(string[] fieldNames, object[] fieldValues, string paramName) + public void NamedFieldAndFieldValuesDifferentLengths_ThrowsArgumentException(string[] fieldNames, object[] fieldValues, string? paramName) { ConstructorInfo con = typeof(TestAttribute).GetConstructor(new Type[0]); FieldInfo[] namedFields = Helpers.GetFields(typeof(TestAttribute), fieldNames); @@ -1054,7 +1054,7 @@ public static void DynamicTypeInFieldValues_ThrowsFileNotFoundExceptionOnCreatio [InlineData(new string[] { nameof(TestAttribute.GetOnlyInt32) }, new object[] { "TestString" }, null)] [InlineData(new string[] { nameof(TestAttribute.GetOnlyString) }, new object[] { "TestString" }, null)] [InlineData(new string[] { nameof(TestAttribute.TestInt32) }, new object[] { "TestString" }, null)] - public void NamedPropertyAndPropertyValuesDifferentLengths_ThrowsArgumentException(string[] propertyNames, object[] propertyValues, string paramName) + public void NamedPropertyAndPropertyValuesDifferentLengths_ThrowsArgumentException(string[] propertyNames, object[] propertyValues, string? paramName) { ConstructorInfo con = typeof(TestAttribute).GetConstructor(new Type[0]); PropertyInfo[] namedProperties = Helpers.GetProperties(typeof(TestAttribute), propertyNames); diff --git a/src/libraries/System.Reflection.Emit.ILGeneration/tests/Label/LabelEquals.cs b/src/libraries/System.Reflection.Emit.ILGeneration/tests/Label/LabelEquals.cs index cb1579cf94ee77..0652a3720f26be 100644 --- a/src/libraries/System.Reflection.Emit.ILGeneration/tests/Label/LabelEquals.cs +++ b/src/libraries/System.Reflection.Emit.ILGeneration/tests/Label/LabelEquals.cs @@ -35,7 +35,7 @@ public void Equals_DifferentLabel_ReturnsFalse() [InlineData("label")] [InlineData(" ")] [InlineData(null)] - public void Equals_ObjectNotLabel_ReturnsFalse(object obj) + public void Equals_ObjectNotLabel_ReturnsFalse(object? obj) { Label label = new Label(); Assert.False(label.Equals(obj)); diff --git a/src/libraries/System.Reflection.Emit.ILGeneration/tests/SignatureHelper/SignatureHelperAddArgument.cs b/src/libraries/System.Reflection.Emit.ILGeneration/tests/SignatureHelper/SignatureHelperAddArgument.cs index d17e18c4130644..9fd85e63de64bd 100644 --- a/src/libraries/System.Reflection.Emit.ILGeneration/tests/SignatureHelper/SignatureHelperAddArgument.cs +++ b/src/libraries/System.Reflection.Emit.ILGeneration/tests/SignatureHelper/SignatureHelperAddArgument.cs @@ -36,7 +36,7 @@ public void AddArgument_Type_Bool(bool pinned, int expectedLength) [InlineData(new Type[] { typeof(int) }, null, 4)] [InlineData(null, new Type[] { typeof(Type) }, 4)] [InlineData(new Type[] { typeof(int) }, new Type[] { typeof(Type) }, 6)] - public void AddArgument_Type_TypeArray_TypeArray(Type[] requiredCustomModifiers, Type[] optionalCustomModifiers, int expectedLength) + public void AddArgument_Type_TypeArray_TypeArray(Type[]? requiredCustomModifiers, Type[]? optionalCustomModifiers, int expectedLength) { ModuleBuilder module = Helpers.DynamicModule(); SignatureHelper helper = SignatureHelper.GetFieldSigHelper(module); diff --git a/src/libraries/System.Reflection.Emit.Lightweight/tests/DynamicMethodCtor.cs b/src/libraries/System.Reflection.Emit.Lightweight/tests/DynamicMethodCtor.cs index 6844ffa0c8ee49..8dfd5b73751456 100644 --- a/src/libraries/System.Reflection.Emit.Lightweight/tests/DynamicMethodCtor.cs +++ b/src/libraries/System.Reflection.Emit.Lightweight/tests/DynamicMethodCtor.cs @@ -26,7 +26,7 @@ public class DynamicMethodctor1 [InlineData("method", typeof(string), new Type[] { typeof(char?) })] [InlineData("Method", typeof(string), new Type[] { typeof(GenericClass2<,>), typeof(GenericClass2<,>) })] [InlineData("Method", typeof(string), new Type[] { typeof(TestInterface) })] - public void String_Type_TypeArray_Module(string name, Type returnType, Type[] parameterTypes) + public void String_Type_TypeArray_Module(string name, Type? returnType, Type[]? parameterTypes) { Module module = typeof(TestClass).GetTypeInfo().Module; @@ -52,7 +52,7 @@ public void String_Type_TypeArray_Module(string name, Type returnType, Type[] pa [InlineData("Method", typeof(string), null, typeof(TestClass))] [InlineData("Method", typeof(string), new Type[] { typeof(int), typeof(string) }, typeof(TestClass))] [InlineData("", typeof(string), new Type[] { typeof(int), typeof(string) }, typeof(TestClass))] - public void String_Type_TypeArray_Type(string name, Type returnType, Type[] parameterTypes, Type owner) + public void String_Type_TypeArray_Type(string name, Type returnType, Type[]? parameterTypes, Type owner) { DynamicMethod method1 = new DynamicMethod(name, returnType, parameterTypes, owner); Helpers.VerifyMethod(method1, name, MethodAttributes.Public | MethodAttributes.Static, CallingConventions.Standard, returnType, parameterTypes, owner.GetTypeInfo().Module); diff --git a/src/libraries/System.Reflection.Emit.Lightweight/tests/DynamicMethodToString.cs b/src/libraries/System.Reflection.Emit.Lightweight/tests/DynamicMethodToString.cs index e3592e9a0bbe62..8f5a0052df3c72 100644 --- a/src/libraries/System.Reflection.Emit.Lightweight/tests/DynamicMethodToString.cs +++ b/src/libraries/System.Reflection.Emit.Lightweight/tests/DynamicMethodToString.cs @@ -11,7 +11,7 @@ public class DynamicMethodToString [InlineData(typeof(string), new Type[] { typeof(string), typeof(int), typeof(TestClass) }, "System.String MethodName(System.String, Int32, System.Reflection.Emit.Tests.TestClass)")] [InlineData(typeof(string), new Type[] { typeof(GenericClass<>) }, "System.String MethodName(System.Reflection.Emit.Tests.GenericClass`1[T])")] [InlineData(null, null, "Void MethodName()")] - public void ToStringTest(Type returnType, Type[] parameterTypes, string expected) + public void ToStringTest(Type? returnType, Type[]? parameterTypes, string expected) { DynamicMethod method = new DynamicMethod("MethodName", returnType, parameterTypes, typeof(TestClass).GetTypeInfo().Module); Assert.Equal(expected, method.ToString()); diff --git a/src/libraries/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTyepParameterBuilderSetBaseTypeConstraint.cs b/src/libraries/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTyepParameterBuilderSetBaseTypeConstraint.cs index b29c41c681c475..6d104f75a082da 100644 --- a/src/libraries/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTyepParameterBuilderSetBaseTypeConstraint.cs +++ b/src/libraries/System.Reflection.Emit/tests/GenericTypeParameterBuilder/GenericTyepParameterBuilderSetBaseTypeConstraint.cs @@ -10,7 +10,7 @@ public class GenericTypeParameterBuilderSetBaseTypeConstraint [Theory] [InlineData(typeof(string), typeof(string))] [InlineData(null, typeof(object))] - public void SetBaseTypeConstraint(Type baseTypeConstraint, Type expectedBaseType) + public void SetBaseTypeConstraint(Type? baseTypeConstraint, Type expectedBaseType) { TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public); string[] typeParamNames = new string[] { "TFirst" }; diff --git a/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs b/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs index 4e1f762cae074d..942420c973583e 100644 --- a/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs +++ b/src/libraries/System.Reflection.Emit/tests/ModuleBuilder/ModuleBuilderDefineEnum.cs @@ -178,7 +178,7 @@ public void DefineEnum_EmptyName_ThrowsArgumentNullException(string name) [InlineData(TypeAttributes.NestedFamORAssem, null)] [InlineData(TypeAttributes.NestedPrivate, null)] [InlineData(TypeAttributes.NestedPublic, null)] - public void DefineEnum_IncorrectVisibilityAttributes_ThrowsArgumentException(TypeAttributes visibility, string paramName) + public void DefineEnum_IncorrectVisibilityAttributes_ThrowsArgumentException(TypeAttributes visibility, string? paramName) { ModuleBuilder module = Helpers.DynamicModule(); AssertExtensions.Throws(paramName, () => module.DefineEnum("Enum", visibility, typeof(int))); diff --git a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineEvent.cs b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineEvent.cs index 05cda03a777379..0751512da510aa 100644 --- a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineEvent.cs +++ b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineEvent.cs @@ -97,7 +97,7 @@ public void DefineEvent_TypeCreated_ThrowsInvalidOperationException() [InlineData("TestEvent", null, typeof(ArgumentNullException))] [InlineData("", typeof(int), typeof(ArgumentException))] [InlineData("\0TestEvent", typeof(int), typeof(ArgumentException))] - public void DefineEvent_Invalid(string name, Type eventType, Type exceptionType) + public void DefineEvent_Invalid(string? name, Type? eventType, Type exceptionType) { TypeBuilder type = Helpers.DynamicType(TypeAttributes.Class | TypeAttributes.Public); type.DefineGenericParameters("T"); diff --git a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs index 188d273a558389..0cb627ca6b7f44 100644 --- a/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs +++ b/src/libraries/System.Reflection.Emit/tests/TypeBuilder/TypeBuilderDefineNestedType.cs @@ -160,7 +160,7 @@ public void DefineNestedType_LongName_ThrowsArgumentException() [InlineData((TypeAttributes)0x00040800, "attr")] [InlineData((TypeAttributes)(-1), null)] [InlineData((TypeAttributes)(-5000), "attr")] - public void DefineNestedType_InvalidAttributes_ThrowsArgumentException(TypeAttributes attributes, string paramName) + public void DefineNestedType_InvalidAttributes_ThrowsArgumentException(TypeAttributes attributes, string? paramName) { TypeBuilder type = Helpers.DynamicType(TypeAttributes.Public); AssertExtensions.Throws(paramName, () => type.DefineNestedType("Name", attributes)); diff --git a/src/libraries/System.Reflection.Metadata/tests/Metadata/TypeNameParserHelpersTests.cs b/src/libraries/System.Reflection.Metadata/tests/Metadata/TypeNameParserHelpersTests.cs index bab040273028f1..eec36ea51ec4bd 100644 --- a/src/libraries/System.Reflection.Metadata/tests/Metadata/TypeNameParserHelpersTests.cs +++ b/src/libraries/System.Reflection.Metadata/tests/Metadata/TypeNameParserHelpersTests.cs @@ -102,7 +102,7 @@ public void IsBeginningOfGenericAgsHandlesAllCasesProperly(string input, bool ex [InlineData("A+B`1+C1`2+DD2`3+E", true, new int[] { 1, 3, 4, 5 }, 18)] [InlineData("Integer`2147483646+NoOverflow`1", true, new int[] { 18 }, 31)] [InlineData("Integer`2147483647+Overflow`1", true, new int[] { 18 }, 29)] - public void TryGetTypeNameInfoGetsAllTheInfo(string input, bool expectedResult, int[] expectedNestedNameLengths, int expectedTotalLength) + public void TryGetTypeNameInfoGetsAllTheInfo(string input, bool expectedResult, int[]? expectedNestedNameLengths, int expectedTotalLength) { List? nestedNameLengths = null; ReadOnlySpan span = input.AsSpan(); diff --git a/src/libraries/System.Runtime.Caching/tests/System.Runtime.Caching/MemoryCacheTest.cs b/src/libraries/System.Runtime.Caching/tests/System.Runtime.Caching/MemoryCacheTest.cs index 5550b59c4d88ef..545b1ef5a951e8 100644 --- a/src/libraries/System.Runtime.Caching/tests/System.Runtime.Caching/MemoryCacheTest.cs +++ b/src/libraries/System.Runtime.Caching/tests/System.Runtime.Caching/MemoryCacheTest.cs @@ -72,7 +72,7 @@ public static bool SupportsPhysicalMemoryMonitor private bool IsFullFramework = RuntimeInformation.FrameworkDescription.StartsWith(".NET Framework", StringComparison.OrdinalIgnoreCase); - private PokerMemoryCache CreatePokerMemoryCache(string name, string throwOnDisposed) + private PokerMemoryCache CreatePokerMemoryCache(string name, string? throwOnDisposed) { if (throwOnDisposed == null) { @@ -259,7 +259,7 @@ public void ConstructorValues() } [Theory, InlineData("true"), InlineData("false"), InlineData(null)] - public void Indexer(string throwOnDisposed) + public void Indexer(string? throwOnDisposed) { var mc = CreatePokerMemoryCache("MyCache", throwOnDisposed); @@ -305,7 +305,7 @@ public void Indexer(string throwOnDisposed) [Theory, InlineData("true"), InlineData("false"), InlineData(null)] //[ActiveIssue("https://github.com/dotnet/runtime/issues/1429")] - public void Contains(string throwOnDisposed) + public void Contains(string? throwOnDisposed) { var mc = CreatePokerMemoryCache("MyCache", throwOnDisposed); @@ -402,7 +402,7 @@ public void CreateCacheEntryChangeMonitor() } [Theory, InlineData("true"), InlineData("false"), InlineData(null)] - public void AddOrGetExisting_String_Object_DateTimeOffset_String(string throwOnDisposed) + public void AddOrGetExisting_String_Object_DateTimeOffset_String(string? throwOnDisposed) { var mc = CreatePokerMemoryCache("MyCache", throwOnDisposed); @@ -676,7 +676,7 @@ public void AddOrGetExisting_CacheItem_CacheItemPolicy() } [Theory, InlineData("true"), InlineData("false"), InlineData(null)] - public void Set_String_Object_CacheItemPolicy_String(string throwOnDisposed) + public void Set_String_Object_CacheItemPolicy_String(string? throwOnDisposed) { var mc = CreatePokerMemoryCache("MyCache", throwOnDisposed); @@ -902,7 +902,7 @@ public void Set_CacheItem_CacheItemPolicy() } [Theory, InlineData("true"), InlineData("false"), InlineData(null)] - public void Remove(string throwOnDisposed) + public void Remove(string? throwOnDisposed) { var mc = CreatePokerMemoryCache("MyCache", throwOnDisposed); @@ -1011,7 +1011,7 @@ public void Remove(string throwOnDisposed) } [Theory, InlineData("true"), InlineData("false"), InlineData(null)] - public void GetValues(string throwOnDisposed) + public void GetValues(string? throwOnDisposed) { var mc = CreatePokerMemoryCache("MyCache", throwOnDisposed); @@ -1113,7 +1113,7 @@ public void ChangeMonitors() // ActiveIssue: https://github.com/dotnet/runtime/issues/36488 [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsNotArm64Process))] [InlineData("true"), InlineData("false"), InlineData(null)] - public void Trim(string throwOnDisposed) + public void Trim(string? throwOnDisposed) { var config = new NameValueCollection(); config["__MonoEmulateOneCPU"] = "true"; diff --git a/src/libraries/System.Runtime.CompilerServices.VisualC/tests/System/Runtime/CompilerServices/RequiredAttributeAttributeTests.cs b/src/libraries/System.Runtime.CompilerServices.VisualC/tests/System/Runtime/CompilerServices/RequiredAttributeAttributeTests.cs index e1788cd1426e78..36b045aac858ab 100644 --- a/src/libraries/System.Runtime.CompilerServices.VisualC/tests/System/Runtime/CompilerServices/RequiredAttributeAttributeTests.cs +++ b/src/libraries/System.Runtime.CompilerServices.VisualC/tests/System/Runtime/CompilerServices/RequiredAttributeAttributeTests.cs @@ -10,7 +10,7 @@ public class RequiredAttributeAttributeTests [Theory] [InlineData(null)] [InlineData(typeof(int))] - public void Ctor_RequiredContract(Type requiredContract) + public void Ctor_RequiredContract(Type? requiredContract) { var attribute = new RequiredAttributeAttribute(requiredContract); Assert.Equal(requiredContract, attribute.RequiredContract); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ArrayWithOffsetTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ArrayWithOffsetTests.cs index 34002d533071f6..7dc89847607acb 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ArrayWithOffsetTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ArrayWithOffsetTests.cs @@ -43,7 +43,7 @@ public void Ctor_MultidimensionalArray_ThrowsArgumentException() [InlineData(null, 1)] [InlineData(new int[] { 1 }, 5)] [InlineData(new int[] { 2 }, -1)] - public void Ctor_InvalidOffset_ThrowsIndexOutOfRangeException(object array, int offset) + public void Ctor_InvalidOffset_ThrowsIndexOutOfRangeException(object? array, int offset) { Assert.Throws(() => new ArrayWithOffset(array, offset)); } diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/BStrWrapperTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/BStrWrapperTests.cs index 6115d945a7d5a9..3d02b60da14405 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/BStrWrapperTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/BStrWrapperTests.cs @@ -10,7 +10,7 @@ public class BStrWrapperTests [Theory] [InlineData(null)] [InlineData("Value")] - public void Ctor_StringValue(string value) + public void Ctor_StringValue(string? value) { var wrapper = new BStrWrapper(value); Assert.Equal(value, wrapper.WrappedObject); @@ -19,7 +19,7 @@ public void Ctor_StringValue(string value) [Theory] [InlineData(null)] [InlineData("Value")] - public void Ctor_ObjectValue(object value) + public void Ctor_ObjectValue(object? value) { var wrapper = new BStrWrapper(value); Assert.Equal(value, wrapper.WrappedObject); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/CoClassAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/CoClassAttributeTests.cs index 6fa062a6c6f02c..6f3b6a5c5dc3ca 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/CoClassAttributeTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/CoClassAttributeTests.cs @@ -10,7 +10,7 @@ public class CoClassAttributeTests [Theory] [InlineData(null)] [InlineData(typeof(int))] - public void Ctor_CoClass(Type coClass) + public void Ctor_CoClass(Type? coClass) { var attribute = new CoClassAttribute(coClass); Assert.Equal(coClass, attribute.CoClass); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComAliasNameAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComAliasNameAttributeTests.cs index 19f9a20bd00a98..cfe2c38c5f0a56 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComAliasNameAttributeTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComAliasNameAttributeTests.cs @@ -26,7 +26,7 @@ public void Exists() [InlineData(null)] [InlineData("")] [InlineData("value")] - public void Ctor_Alias(string alias) + public void Ctor_Alias(string? alias) { var attribute = new ComAliasNameAttribute(alias); Assert.Equal(alias, attribute.Value); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComDefaultInterfaceAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComDefaultInterfaceAttributeTests.cs index 71e7848b6c27e5..0d8c930ea8bb14 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComDefaultInterfaceAttributeTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComDefaultInterfaceAttributeTests.cs @@ -10,7 +10,7 @@ public class ComDefaultInterfaceAttributeTests [Theory] [InlineData(null)] [InlineData(typeof(int))] - public void Ctor_DefaultInterface(Type defaultInterface) + public void Ctor_DefaultInterface(Type? defaultInterface) { var attribute = new ComDefaultInterfaceAttribute(defaultInterface); Assert.Equal(defaultInterface, attribute.Value); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComEventInterfaceAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComEventInterfaceAttributeTests.cs index 1bef996153287c..2fe79c8fa686b1 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComEventInterfaceAttributeTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComEventInterfaceAttributeTests.cs @@ -10,7 +10,7 @@ public class ComEventInterfaceAttributeTests [Theory] [InlineData(null, null)] [InlineData(typeof(int), typeof(string))] - public void Ctor_DefaultInterface(Type sourceInterface, Type eventProvider) + public void Ctor_DefaultInterface(Type? sourceInterface, Type? eventProvider) { var attribute = new ComEventInterfaceAttribute(sourceInterface, eventProvider); Assert.Equal(sourceInterface, attribute.SourceInterface); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComSourceInterfacesAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComSourceInterfacesAttributeTests.cs index 7b98247864f192..88b59aa6d2becc 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComSourceInterfacesAttributeTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComSourceInterfacesAttributeTests.cs @@ -10,7 +10,7 @@ public class ComSourceInterfacesAttributeTests [Theory] [InlineData(null)] [InlineData("SourceInterfaces")] - public void Ctor_SourceInterfaces(string sourceInterfaces) + public void Ctor_SourceInterfaces(string? sourceInterfaces) { var attribute = new ComSourceInterfacesAttribute(sourceInterfaces); Assert.Equal(sourceInterfaces, attribute.Value); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComVariantMarshallerTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComVariantMarshallerTests.cs index 4a9163d824588e..cb0760b7caec2b 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComVariantMarshallerTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ComVariantMarshallerTests.cs @@ -34,7 +34,7 @@ public void DBNull_Marshals_To_Null() [InlineData(null, VarEnum.VT_EMPTY)] // Null strings are _not_ BSTRs, compare to BStrWrapper. [InlineData("", VarEnum.VT_BSTR)] [InlineData("Hello", VarEnum.VT_BSTR)] - public void String_Marshals_To_BStr(string value, VarEnum expected) + public void String_Marshals_To_BStr(string? value, VarEnum expected) { ComVariant variant = ComVariantMarshaller.ConvertToUnmanaged(value); Assert.Equal(expected, variant.VarType); @@ -46,7 +46,7 @@ public void String_Marshals_To_BStr(string value, VarEnum expected) [InlineData(null)] [InlineData("")] [InlineData("Hello")] - public void BStrWrapper_Marshals_To_BStr(string value) + public void BStrWrapper_Marshals_To_BStr(string? value) { ComVariant variant = ComVariantMarshaller.ConvertToUnmanaged(new BStrWrapper(value)); Assert.Equal(VarEnum.VT_BSTR, variant.VarType); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/DefaultParameterValueAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/DefaultParameterValueAttributeTests.cs index 68255c14ef24a2..aa92527269cd27 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/DefaultParameterValueAttributeTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/DefaultParameterValueAttributeTests.cs @@ -14,7 +14,7 @@ public class DefaultParameterValueAttributeTests [InlineData(5.0f)] [InlineData("ExpectedValue")] [InlineData(null)] - public static void Ctor_Value(object value) + public static void Ctor_Value(object? value) { var attribute = new DefaultParameterValueAttribute(value); Assert.Equal(value, attribute.Value); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/DllImportAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/DllImportAttributeTests.cs index f664314669609f..fd55e737f77ca3 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/DllImportAttributeTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/DllImportAttributeTests.cs @@ -10,7 +10,7 @@ public class DllImportAttributeTests [Theory] [InlineData(null)] [InlineData("DllName")] - public void Ctor_SourceInterfaces(string dllName) + public void Ctor_SourceInterfaces(string? dllName) { var attribute = new DllImportAttribute(dllName); Assert.Equal(dllName, attribute.Value); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/GuidAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/GuidAttributeTests.cs index f5b3ea83123296..9d906e3d2a20d1 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/GuidAttributeTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/GuidAttributeTests.cs @@ -10,7 +10,7 @@ public class GuidAttributeTests [Theory] [InlineData(null)] [InlineData("Guid")] - public void Ctor_Guid(string guid) + public void Ctor_Guid(string? guid) { var attribute = new GuidAttribute(guid); Assert.Equal(guid, attribute.Value); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/HandleCollectorTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/HandleCollectorTests.cs index 979867bc1efd7f..252049e9dbc795 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/HandleCollectorTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/HandleCollectorTests.cs @@ -15,7 +15,7 @@ public class HandleCollectorTests [InlineData(null, 0)] [InlineData("", 10)] [InlineData("InitialThreshold", int.MaxValue)] - public void Ctor_Name_InitialThreshold(string name, int initialThreshold) + public void Ctor_Name_InitialThreshold(string? name, int initialThreshold) { var handleCollector = new HandleCollector(name, initialThreshold); Assert.Equal(0, handleCollector.Count); @@ -28,7 +28,7 @@ public void Ctor_Name_InitialThreshold(string name, int initialThreshold) [InlineData(null, 0, 0)] [InlineData("", 10, 15)] [InlineData("InitialThreshold", 1, 2)] - public void Ctor_Name_InitialThreshold_MaximumThreshold(string name, int initialThreshold, int maximumThreshold) + public void Ctor_Name_InitialThreshold_MaximumThreshold(string? name, int initialThreshold, int maximumThreshold) { var handleCollector = new HandleCollector(name, initialThreshold, maximumThreshold); Assert.Equal(0, handleCollector.Count); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/HandleRefTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/HandleRefTests.cs index d5a6f2aa7df8a9..a14152b0cf3db6 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/HandleRefTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/HandleRefTests.cs @@ -20,7 +20,7 @@ public void Ctor_Default() [Theory] [InlineData(null, 0)] [InlineData("Wrapper", 1337)] - public void Ctor_Wrapper_Handle(object wrapper, int handle) + public void Ctor_Wrapper_Handle(object? wrapper, int handle) { var handleRef = new HandleRef(wrapper, (IntPtr)handle); Assert.Same(wrapper, handleRef.Wrapper); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ImportedFromTypeLibAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ImportedFromTypeLibAttributeTests.cs index 463b98487cbbc1..671ed27d0d7b0d 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ImportedFromTypeLibAttributeTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ImportedFromTypeLibAttributeTests.cs @@ -10,7 +10,7 @@ public class ImportedFromTypeLibAttributeTests [Theory] [InlineData(null)] [InlineData("Value")] - public void Ctor_TlbFile(string tlbFile) + public void Ctor_TlbFile(string? tlbFile) { var attribute = new ImportedFromTypeLibAttribute(tlbFile); Assert.Equal(tlbFile, attribute.Value); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/LibraryImportAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/LibraryImportAttributeTests.cs index 1ebda2c88832a8..20088c05261e66 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/LibraryImportAttributeTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/LibraryImportAttributeTests.cs @@ -10,7 +10,7 @@ public class LibraryImportAttributeTests [Theory] [InlineData(null)] [InlineData("LibraryName")] - public void Ctor(string libraryName) + public void Ctor(string? libraryName) { var attribute = new LibraryImportAttribute(libraryName); Assert.Equal(libraryName, attribute.LibraryName); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ManagedToNativeComInteropStubAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ManagedToNativeComInteropStubAttributeTests.cs index 70b375d5a1dc5c..4701562db44b01 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ManagedToNativeComInteropStubAttributeTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ManagedToNativeComInteropStubAttributeTests.cs @@ -10,7 +10,7 @@ public class ManagedToNativeComInteropStubAttributeTests [Theory] [InlineData(null, null)] [InlineData(typeof(int), "MethodName")] - public void Ctor_ClassType_MethodName(Type classType, string methodName) + public void Ctor_ClassType_MethodName(Type? classType, string? methodName) { var attribute = new ManagedToNativeComInteropStubAttribute(classType, methodName); Assert.Equal(classType, attribute.ClassType); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/BindToMonikerTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/BindToMonikerTests.cs index 1a4cfea3326138..87f5b83dc914bc 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/BindToMonikerTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/Marshal/BindToMonikerTests.cs @@ -19,7 +19,7 @@ public void BindToMoniker_Unix_ThrowsPlatformNotSupportedException() [InlineData(null)] [InlineData("")] [InlineData("invalidName")] - public void BindToMoniker_InvalidArgument_ThrowsAnyException(string monikerName) + public void BindToMoniker_InvalidArgument_ThrowsAnyException(string? monikerName) { Assert.ThrowsAny(() => Marshal.BindToMoniker(monikerName)); } diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ProgIdAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ProgIdAttributeTests.cs index b61fa92d7eb8a4..12817ba34e0510 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ProgIdAttributeTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/ProgIdAttributeTests.cs @@ -19,7 +19,7 @@ public void Exists() [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsBuiltInComEnabled))] [InlineData(null)] [InlineData("ProgId")] - public void Ctor_ProgId(string progId) + public void Ctor_ProgId(string? progId) { var attribute = new ProgIdAttribute(progId); Assert.Equal(progId, attribute.Value); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/TypeIdentifierAttributeTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/TypeIdentifierAttributeTests.cs index c2c9d56c5408f2..d58df203a04951 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/TypeIdentifierAttributeTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/TypeIdentifierAttributeTests.cs @@ -18,7 +18,7 @@ public void Ctor_Default() [Theory] [InlineData(null, null)] [InlineData("scope", "identifier")] - public void Ctor_Scope_Identifier(string scope, string identifier) + public void Ctor_Scope_Identifier(string? scope, string? identifier) { var attribute = new TypeIdentifierAttribute(scope, identifier); Assert.Equal(scope, attribute.Scope); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/UnknownWrapperTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/UnknownWrapperTests.cs index ba50559dc11a76..d2cb84945ca066 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/UnknownWrapperTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/UnknownWrapperTests.cs @@ -11,7 +11,7 @@ public class UnknownWrapperTests [InlineData(null)] [InlineData(1)] [InlineData("Value")] - public void Ctor_Value(object value) + public void Ctor_Value(object? value) { var wrapper = new UnknownWrapper(value); Assert.Equal(value, wrapper.WrappedObject); diff --git a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/VariantWrapperTests.cs b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/VariantWrapperTests.cs index 2100c665b5a811..f07af78ceae77a 100644 --- a/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/VariantWrapperTests.cs +++ b/src/libraries/System.Runtime.InteropServices/tests/System.Runtime.InteropServices.UnitTests/System/Runtime/InteropServices/VariantWrapperTests.cs @@ -11,7 +11,7 @@ public class VariantWrappedTests [InlineData(null)] [InlineData(1)] [InlineData("Value")] - public void Ctor_Value(object value) + public void Ctor_Value(object? value) { var wrapper = new VariantWrapper(value); Assert.Equal(value, wrapper.WrappedObject); diff --git a/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/ContractNamespaceAttributeTests.cs b/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/ContractNamespaceAttributeTests.cs index dd120902df3d6b..cbcdef118ff120 100644 --- a/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/ContractNamespaceAttributeTests.cs +++ b/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/ContractNamespaceAttributeTests.cs @@ -11,7 +11,7 @@ public class ContractNamespaceAttributeTests [InlineData(null)] [InlineData("")] [InlineData("contractNamespace")] - public void Ctor_String(string contractNamespace) + public void Ctor_String(string? contractNamespace) { var attribute = new ContractNamespaceAttribute(contractNamespace); Assert.Equal(contractNamespace, attribute.ContractNamespace); @@ -22,7 +22,7 @@ public void Ctor_String(string contractNamespace) [InlineData(null)] [InlineData("")] [InlineData("value")] - public void ClrNamespace_Set_GetReturnsExpected(string value) + public void ClrNamespace_Set_GetReturnsExpected(string? value) { var attribute = new ContractNamespaceAttribute("contractNamespace") { ClrNamespace = value }; Assert.Equal(value, attribute.ClrNamespace); diff --git a/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/DataContractAttributeTests.cs b/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/DataContractAttributeTests.cs index 0186b053cd7501..368e26fcbfc542 100644 --- a/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/DataContractAttributeTests.cs +++ b/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/DataContractAttributeTests.cs @@ -33,7 +33,7 @@ public void IsReference_Set_GetReturnsExpected(bool value) [InlineData(null)] [InlineData("")] [InlineData("value")] - public void Name_Set_GetReturnsExpected(string value) + public void Name_Set_GetReturnsExpected(string? value) { var attribute = new DataContractAttribute() { Name = value }; Assert.Equal(value, attribute.Name); @@ -44,7 +44,7 @@ public void Name_Set_GetReturnsExpected(string value) [InlineData(null)] [InlineData("")] [InlineData("value")] - public void Namespace_Set_GetReturnsExpected(string value) + public void Namespace_Set_GetReturnsExpected(string? value) { var attribute = new DataContractAttribute() { Namespace = value }; Assert.Equal(value, attribute.Namespace); diff --git a/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/DataMemberAttributeTests.cs b/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/DataMemberAttributeTests.cs index 556f7bb06090dd..21050880c1e866 100644 --- a/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/DataMemberAttributeTests.cs +++ b/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/DataMemberAttributeTests.cs @@ -40,7 +40,7 @@ public void IsRequired_Set_GetReturnsExpected(bool value) [InlineData(null)] [InlineData("")] [InlineData("value")] - public void Name_Set_GetReturnsExpected(string value) + public void Name_Set_GetReturnsExpected(string? value) { var attribute = new DataMemberAttribute() { Name = value }; Assert.Equal(value, attribute.Name); diff --git a/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/EnumMemberAttributeTests.cs b/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/EnumMemberAttributeTests.cs index 179d9614393026..7649192737b7fe 100644 --- a/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/EnumMemberAttributeTests.cs +++ b/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/EnumMemberAttributeTests.cs @@ -19,7 +19,7 @@ public void Ctor_Default() [InlineData(null)] [InlineData("")] [InlineData("value")] - public void Value_Set_GetReturnsExpected(string value) + public void Value_Set_GetReturnsExpected(string? value) { var attribute = new EnumMemberAttribute() { Value = value }; Assert.Equal(value, attribute.Value); diff --git a/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/KnownTypeAttributeTests.cs b/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/KnownTypeAttributeTests.cs index b02b2e48e55a10..c5159af8ca7e95 100644 --- a/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/KnownTypeAttributeTests.cs +++ b/src/libraries/System.Runtime.Serialization.Primitives/tests/System/Runtime/Serialization/KnownTypeAttributeTests.cs @@ -11,7 +11,7 @@ public class KnownTypeAttributeTests [InlineData(null)] [InlineData("")] [InlineData("value")] - public void Ctor_String(string methodName) + public void Ctor_String(string? methodName) { var attribute = new KnownTypeAttribute(methodName); Assert.Equal(methodName, attribute.MethodName); @@ -21,7 +21,7 @@ public void Ctor_String(string methodName) [Theory] [InlineData(null)] [InlineData(typeof(int))] - public void Ctor_Type(Type type) + public void Ctor_Type(Type? type) { var attribute = new KnownTypeAttribute(type); Assert.Null(attribute.MethodName); diff --git a/src/libraries/System.Runtime/tests/System.Diagnostics.Debug.Tests/DebuggerDisplayAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Diagnostics.Debug.Tests/DebuggerDisplayAttributeTests.cs index 2d531adca9f4b8..1a941c77c7c938 100644 --- a/src/libraries/System.Runtime/tests/System.Diagnostics.Debug.Tests/DebuggerDisplayAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Diagnostics.Debug.Tests/DebuggerDisplayAttributeTests.cs @@ -11,7 +11,7 @@ public class DebuggerDisplayAttributeTests [InlineData(null)] [InlineData("")] [InlineData("Value")] - public void Ctor_Value(string value) + public void Ctor_Value(string? value) { var attribute = new DebuggerDisplayAttribute(value); Assert.Equal(string.Empty, attribute.Name); @@ -24,7 +24,7 @@ public void Ctor_Value(string value) [Theory] [InlineData(null)] [InlineData("Name")] - public void Name_Set_GetReturnsExpected(string name) + public void Name_Set_GetReturnsExpected(string? name) { var attribute = new DebuggerDisplayAttribute("Value") { Name = name }; Assert.Equal(name, attribute.Name); @@ -33,7 +33,7 @@ public void Name_Set_GetReturnsExpected(string name) [Theory] [InlineData(null)] [InlineData("Type")] - public void Type_Set_GetReturnsExpected(string type) + public void Type_Set_GetReturnsExpected(string? type) { var attribute = new DebuggerDisplayAttribute("Value") { Type = type }; Assert.Equal(type, attribute.Type); @@ -58,7 +58,7 @@ public void Target_SetNull_ThrowsArgumentNullException() [Theory] [InlineData(null)] [InlineData("TargetTypeName")] - public void TargetTypeName_Set_GetReturnsExpected(string targetTypeName) + public void TargetTypeName_Set_GetReturnsExpected(string? targetTypeName) { var attribute = new DebuggerDisplayAttribute("Value") { TargetTypeName = targetTypeName }; Assert.Equal(targetTypeName, attribute.TargetTypeName); diff --git a/src/libraries/System.Runtime/tests/System.Diagnostics.Debug.Tests/DebuggerTypeProxyAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Diagnostics.Debug.Tests/DebuggerTypeProxyAttributeTests.cs index 411c4e9d095059..9128a1045ed757 100644 --- a/src/libraries/System.Runtime/tests/System.Diagnostics.Debug.Tests/DebuggerTypeProxyAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Diagnostics.Debug.Tests/DebuggerTypeProxyAttributeTests.cs @@ -10,7 +10,7 @@ public class DebuggerTypeProxyAttributeTests [Theory] [InlineData(null)] [InlineData("TypeName")] - public void Ctor_TypeName(string typeName) + public void Ctor_TypeName(string? typeName) { var attribute = new DebuggerTypeProxyAttribute(typeName); Assert.Equal(typeName, attribute.ProxyTypeName); @@ -54,7 +54,7 @@ public void Target_SetNull_ThrowsArgumentNullException() [Theory] [InlineData(null)] [InlineData("TargetTypeName")] - public void TargetTypeName_Set_GetReturnsExpected(string targetTypeName) + public void TargetTypeName_Set_GetReturnsExpected(string? targetTypeName) { var attribute = new DebuggerTypeProxyAttribute("TypeName") { TargetTypeName = targetTypeName }; Assert.Equal(targetTypeName, attribute.TargetTypeName); diff --git a/src/libraries/System.Runtime/tests/System.Diagnostics.Debug.Tests/DebuggerVisualizerAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Diagnostics.Debug.Tests/DebuggerVisualizerAttributeTests.cs index ee67bbab078492..f39a8070921179 100644 --- a/src/libraries/System.Runtime/tests/System.Diagnostics.Debug.Tests/DebuggerVisualizerAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Diagnostics.Debug.Tests/DebuggerVisualizerAttributeTests.cs @@ -10,7 +10,7 @@ public class DebuggerVisualizerAttributeTests [Theory] [InlineData(null)] [InlineData("VisualizerTypeName")] - public void Ctor_VisualizerTypeName(string visualizerTypeName) + public void Ctor_VisualizerTypeName(string? visualizerTypeName) { var attribute = new DebuggerVisualizerAttribute(visualizerTypeName); Assert.Equal(visualizerTypeName, attribute.VisualizerTypeName); @@ -22,7 +22,7 @@ public void Ctor_VisualizerTypeName(string visualizerTypeName) [Theory] [InlineData(null, null)] [InlineData("VisualizerTypeName", "VisualizerObjectSourceTypeName")] - public void Ctor_VisualizerTypeName_VisualizerObjectSourceTypeName(string visualizerTypeName, string visualizerObjectSourceTypeName) + public void Ctor_VisualizerTypeName_VisualizerObjectSourceTypeName(string? visualizerTypeName, string? visualizerObjectSourceTypeName) { var attribute = new DebuggerVisualizerAttribute(visualizerTypeName, visualizerObjectSourceTypeName); Assert.Equal(visualizerTypeName, attribute.VisualizerTypeName); @@ -34,7 +34,7 @@ public void Ctor_VisualizerTypeName_VisualizerObjectSourceTypeName(string visual [Theory] [InlineData(null, typeof(int))] [InlineData("VisualizerTypeName", typeof(DebuggerVisualizerAttributeTests))] - public void Ctor_VisualizerTypeName_VisualizerObjectSourceType(string visualizerTypeName, Type visualizerObjectSourceType) + public void Ctor_VisualizerTypeName_VisualizerObjectSourceType(string? visualizerTypeName, Type visualizerObjectSourceType) { var attribute = new DebuggerVisualizerAttribute(visualizerTypeName, visualizerObjectSourceType); Assert.Equal(visualizerTypeName, attribute.VisualizerTypeName); @@ -70,7 +70,7 @@ public void Ctor_VisualizerType_VisualizerObjectSourceType(Type visualizerType, [Theory] [InlineData(typeof(string), null)] [InlineData(typeof(DebuggerVisualizerAttributeTests), "VisualizerObjectSourceTypeName")] - public void Ctor_VisualizerType_VisualizerObjectSourceTypeName(Type visualizerType, string visualizerObjectSourceTypeName) + public void Ctor_VisualizerType_VisualizerObjectSourceTypeName(Type visualizerType, string? visualizerObjectSourceTypeName) { var attribute = new DebuggerVisualizerAttribute(visualizerType, visualizerObjectSourceTypeName); Assert.Equal(visualizerType.AssemblyQualifiedName, attribute.VisualizerTypeName); diff --git a/src/libraries/System.Runtime/tests/System.Diagnostics.Tools.Tests/System/CodeDom/Compiler/GeneratedCodeAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Diagnostics.Tools.Tests/System/CodeDom/Compiler/GeneratedCodeAttributeTests.cs index 4eec33dc065695..40144596ec99cb 100644 --- a/src/libraries/System.Runtime/tests/System.Diagnostics.Tools.Tests/System/CodeDom/Compiler/GeneratedCodeAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Diagnostics.Tools.Tests/System/CodeDom/Compiler/GeneratedCodeAttributeTests.cs @@ -10,7 +10,7 @@ public class GeneratedCodeAttributeTests [Theory] [InlineData(null, null)] [InlineData("Tool", "Version")] - public void TestConstructor(string tool, string version) + public void TestConstructor(string? tool, string? version) { GeneratedCodeAttribute gca = new GeneratedCodeAttribute(tool, version); diff --git a/src/libraries/System.Runtime/tests/System.Diagnostics.Tools.Tests/System/Diagnostics/CodeAnalysis/SuppressMessageAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Diagnostics.Tools.Tests/System/Diagnostics/CodeAnalysis/SuppressMessageAttributeTests.cs index 91a32840ba83a8..d3fe7900580c56 100644 --- a/src/libraries/System.Runtime/tests/System.Diagnostics.Tools.Tests/System/Diagnostics/CodeAnalysis/SuppressMessageAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Diagnostics.Tools.Tests/System/Diagnostics/CodeAnalysis/SuppressMessageAttributeTests.cs @@ -12,7 +12,7 @@ public class SuppressMessageAttributeTests [InlineData("", "", "", "", "", "")] [InlineData(null, null, null, null, null, null)] [InlineData("", null, "Justification", null, "Scope", "")] - public void TestConstructor(string category, string id, string justification, string messageId, string scope, string target) + public void TestConstructor(string? category, string? id, string? justification, string? messageId, string? scope, string? target) { SuppressMessageAttribute sma = new SuppressMessageAttribute(category, id) { diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/GetStringComparerTests.cs b/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/GetStringComparerTests.cs index 0735620db91af1..19337e915d1bf5 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/GetStringComparerTests.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Extensions.Tests/GetStringComparerTests.cs @@ -32,7 +32,7 @@ public void GetStringComparer_Invalid() [InlineData("abc", "ABC", "en-US", CompareOptions.OrdinalIgnoreCase, 0, 0)] [InlineData("Cot\u00E9", "cot\u00E9", "fr-FR", CompareOptions.IgnoreCase, 0, 0)] [InlineData("cot\u00E9", "c\u00F4te", "fr-FR", CompareOptions.None, 1, -1)] - public static void Compare(string x, string y, string cultureName, CompareOptions options, int expectedNls, int expectedICU) + public static void Compare(string? x, string? y, string cultureName, CompareOptions options, int expectedNls, int expectedICU) { int expected = PlatformDetection.IsNlsGlobalization ? expectedNls : expectedICU; StringComparer comparer = new CultureInfo(cultureName).CompareInfo.GetStringComparer(options); diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoCurrentCulture.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoCurrentCulture.cs index c13c8446ffa89c..914b505081a769 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoCurrentCulture.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoCurrentCulture.cs @@ -149,7 +149,7 @@ public void CurrentCulture_BasedOnLangEnvVar(string langEnvVar, string expectedC [ConditionalTheory(typeof(RemoteExecutor), nameof(RemoteExecutor.IsSupported))] [InlineData("")] [InlineData(null)] - public void CurrentCulture_DefaultWithNoLang(string langEnvVar) + public void CurrentCulture_DefaultWithNoLang(string? langEnvVar) { var psi = new ProcessStartInfo(); TestEnvironment.ClearGlobalizationEnvironmentVars(psi.Environment); diff --git a/src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoGetFormat.cs b/src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoGetFormat.cs index 2636285e87938b..2d067a09b5dc3a 100644 --- a/src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoGetFormat.cs +++ b/src/libraries/System.Runtime/tests/System.Globalization.Tests/CultureInfo/CultureInfoGetFormat.cs @@ -11,7 +11,7 @@ public class CultureInfoGetFormat [InlineData(typeof(NumberFormatInfo), typeof(NumberFormatInfo))] [InlineData(typeof(DateTimeFormatInfo), typeof(DateTimeFormatInfo))] [InlineData(typeof(string), null)] - public void GetFormat(Type formatType, Type expectedFormatType) + public void GetFormat(Type formatType, Type? expectedFormatType) { object format = new CultureInfo("en-US").GetFormat(formatType); if (expectedFormatType == null) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/ChangeExtension.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/ChangeExtension.cs index cb4156cd44a764..983290ab52d81d 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/ChangeExtension.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/ChangeExtension.cs @@ -15,7 +15,7 @@ public class File_ChangeExtension : FileSystemTest [InlineData("filename.tmp", "...", "filename...")] [InlineData("filename.tmp", null, "filename")] [InlineData("filename.tmp.doc", ".tmp", "filename.tmp.tmp")] - public void ValidExtensions(string original, string newExtension, string expected) + public void ValidExtensions(string? original, string? newExtension, string? expected) { string newPath = Path.ChangeExtension(original, newExtension); Assert.Equal(expected, newPath); diff --git a/src/libraries/System.Runtime/tests/System.IO.Tests/IndentedTextWriter.cs b/src/libraries/System.Runtime/tests/System.IO.Tests/IndentedTextWriter.cs index 11b9ad7b82a193..93df41dc7f7afc 100644 --- a/src/libraries/System.Runtime/tests/System.IO.Tests/IndentedTextWriter.cs +++ b/src/libraries/System.Runtime/tests/System.IO.Tests/IndentedTextWriter.cs @@ -378,7 +378,7 @@ public static void Indent_RoundtripsAndAffectsOutput(int indent) [InlineData("")] [InlineData("space")] [InlineData(" ")] - public static void TabString_UsesProvidedString(string tabString) + public static void TabString_UsesProvidedString(string? tabString) { var sb = new StringBuilder(); var sw = new StringWriter(sb); diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyNameTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyNameTests.cs index f5225adc18b783..a9d4c2f12b7013 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyNameTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/AssemblyNameTests.cs @@ -90,7 +90,7 @@ public void Ctor_String_Public_Key(string name, string expectedName) [InlineData(" \t \r \n ", typeof(FileLoadException))] [InlineData("aa, culture=en-en, culture=en-en", typeof(FileLoadException))] [InlineData("MyAssemblyName, PublicKey=00000000000000000400000000000000, PublicKeyToken=b77a5c561934e089", typeof(FileLoadException))] - public void Ctor_String_Invalid(string assemblyName, Type exceptionType) + public void Ctor_String_Invalid(string? assemblyName, Type exceptionType) { Assert.Throws(exceptionType, () => new AssemblyName(assemblyName)); } @@ -409,7 +409,7 @@ public void GetPublicKeyToken_CurrentlyExecutingAssembly() [InlineData("", "")] [InlineData(" name ", " name ")] [InlineData("\tname\t", "\tname\t")] - public void Name_Set(string name, string expectedName) + public void Name_Set(string? name, string? expectedName) { AssemblyName assemblyName = new AssemblyName("MyAssemblyName"); assemblyName.Name = name; @@ -421,7 +421,7 @@ public void Name_Set(string name, string expectedName) [MemberData(nameof(Names_TestDataRequiresEscaping))] [InlineData(null, "")] [InlineData("", "")] - public void Name_Set_FullName(string name, string expectedName) + public void Name_Set_FullName(string? name, string expectedName) { AssemblyName assemblyName = new AssemblyName("MyAssemblyName"); assemblyName.Name = name; diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/DefaultBinderTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/DefaultBinderTests.cs index d1c1f63d830e0a..b65efe98b431e7 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/DefaultBinderTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/DefaultBinderTests.cs @@ -182,7 +182,7 @@ public static void InvokeWithNamedParametersOutOfOrder() [Theory] [InlineData("")] [InlineData(null)] - public static void InvokeWithCreateInstance(string name) + public static void InvokeWithCreateInstance(string? name) { Assert.IsType(typeof(Sample).InvokeMember(name, BindingFlags.CreateInstance, null, null, null)); } diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/FieldInfoTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/FieldInfoTests.cs index d8c6425f3b1a72..b2d76725e99396 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/FieldInfoTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/FieldInfoTests.cs @@ -777,7 +777,7 @@ struct Inner [InlineData(long.MaxValue)] [InlineData(byte.MaxValue)] [InlineData(null)] - public static void SetValueDirect_GetValueDirectRoundDataTest(object value) + public static void SetValueDirect_GetValueDirectRoundDataTest(object? value) { FieldData testField = new FieldData { inner = new Inner() { field = -1 } }; FieldInfo innerFieldInfo = typeof(FieldData).GetField(nameof(FieldData.inner)); diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/MethodInfoTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/MethodInfoTests.cs index 5e791cc2d6dd0d..9a102cec6b5c4d 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/MethodInfoTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/MethodInfoTests.cs @@ -162,7 +162,7 @@ public void CreateDelegate_ValueTypeParameters() [Theory] [InlineData(typeof(MI_BaseClass), nameof(MI_BaseClass.VirtualMethod), null, typeof(ArgumentNullException))] [InlineData(typeof(MI_BaseClass), nameof(MI_BaseClass.VirtualMethod), typeof(Delegate_Void_Int), typeof(ArgumentException))] - public void CreateDelegate_Invalid(Type type, string name, Type delegateType, Type exceptionType) + public void CreateDelegate_Invalid(Type type, string name, Type? delegateType, Type exceptionType) { MethodInfo methodInfo = GetMethod(type, name); Assert.Throws(exceptionType, () => methodInfo.CreateDelegate(delegateType)); diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/ParameterInfoTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/ParameterInfoTests.cs index 7fcf2f896d8f00..2a68eab6e2743c 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/ParameterInfoTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/ParameterInfoTests.cs @@ -312,7 +312,7 @@ public void IsIn(Type type, string name, int index, bool expected) [InlineData(typeof(ParameterInfoMetadata), "MethodWithDefaultNullableDateTime", 0, null)] [InlineData(typeof(ParameterInfoMetadata), "MethodWithEnum", 0, AttributeTargets.All)] [InlineData(typeof(ParameterInfoMetadata), "MethodWithNullableEnum", 0, (int)AttributeTargets.All)] - public void DefaultValue(Type type, string name, int index, object expected) + public void DefaultValue(Type type, string name, int index, object? expected) { ParameterInfo parameterInfo = GetParameterInfo(type, name, index); Assert.Equal(expected, parameterInfo.DefaultValue); @@ -320,7 +320,7 @@ public void DefaultValue(Type type, string name, int index, object expected) [Theory] [InlineData(typeof(ParameterInfoMetadata), "MethodWithDefaultDateTime", 0, null)] - public void DefaultValue_broken_on_NETFX(Type type, string name, int index, object expected) + public void DefaultValue_broken_on_NETFX(Type type, string name, int index, object? expected) { ParameterInfo parameterInfo = GetParameterInfo(type, name, index); Assert.Equal(expected, parameterInfo.DefaultValue); diff --git a/src/libraries/System.Runtime/tests/System.Reflection.Tests/TypeInfoTests.cs b/src/libraries/System.Runtime/tests/System.Reflection.Tests/TypeInfoTests.cs index 231c6f1119bcdf..17f744d3872858 100644 --- a/src/libraries/System.Runtime/tests/System.Reflection.Tests/TypeInfoTests.cs +++ b/src/libraries/System.Runtime/tests/System.Reflection.Tests/TypeInfoTests.cs @@ -76,7 +76,7 @@ public void DeclaredEvents(Type type, string name, bool exists, string eventHand [InlineData(typeof(TI_SubClass), nameof(TI_SubClass.s_field), true, typeof(string), false)] [InlineData(typeof(TI_SubClass), nameof(TI_SubClass.s_readonlyField), true, typeof(string), false)] [InlineData(typeof(TI_SubClass), nameof(TI_SubClass.s_volatileField), true, typeof(string), false)] - public void DeclaredFields(Type type, string name, bool exists, Type fieldType, bool isPrivate) + public void DeclaredFields(Type type, string name, bool exists, Type? fieldType, bool isPrivate) { IEnumerable fields = type.GetTypeInfo().DeclaredFields.Select(fieldInfo => fieldInfo.Name); FieldInfo declaredFieldInfo = type.GetTypeInfo().GetDeclaredField(name); @@ -395,7 +395,7 @@ public void GenericTypeParameters(Type type, string[] expected, string[] baseExp [InlineData(10, nameof(IntEnum.Enum10))] [InlineData(45, nameof(IntEnum.Enum45))] [InlineData(8, null)] - public void GetEnumName(object value, string expected) + public void GetEnumName(object value, string? expected) { Assert.Equal(expected, typeof(IntEnum).GetTypeInfo().GetEnumName(value)); } @@ -595,7 +595,7 @@ public void IsInstanceOfType(Type type, object o, bool expected) [InlineData(typeof(uint[]), typeof(int[]), true)] [InlineData(typeof(IList), typeof(int[]), true)] [InlineData(typeof(IList), typeof(int[]), true)] - public void IsAssignable(Type type, Type c, bool expected) + public void IsAssignable(Type type, Type? c, bool expected) { Assert.Equal(expected, type.GetTypeInfo().IsAssignableFrom(c)); Assert.Equal(expected, type.GetTypeInfo().IsAssignableFrom(c?.GetTypeInfo())); @@ -1114,7 +1114,7 @@ public void GetDeclaredNestedType_NullName_ThrowsArgumentNullException() [InlineData(typeof(TI_BaseClass), null)] [InlineData(typeof(string[]), typeof(string))] [InlineData(typeof(int[]), typeof(int))] - public void GetElementType(Type type, Type expected) + public void GetElementType(Type type, Type? expected) { Assert.Equal(expected, type.GetTypeInfo().GetElementType()); } diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Environment.ProcessorCount.cs b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Environment.ProcessorCount.cs index 1628d8b826f602..b440df84835954 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Environment.ProcessorCount.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/Environment.ProcessorCount.cs @@ -72,7 +72,7 @@ public void ProcessorCount_Windows_MatchesGetSystemInfo() [InlineData(2000, 0, " 17 ")] [InlineData(0, 0, "3")] public static unsafe void ProcessorCount_Windows_RespectsJobCpuRateAndConfigurationSetting( - ushort maxRate, ushort minRate, string procCountConfig) + ushort maxRate, ushort minRate, string? procCountConfig) { IntPtr hJob = IntPtr.Zero; PROCESS_INFORMATION processInfo = default; diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/IO/PathTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/IO/PathTests.cs index b248728a79da0a..a701eea79f47ea 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/IO/PathTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Extensions.Tests/System/IO/PathTests.cs @@ -24,7 +24,7 @@ public class PathTests : PathTestsBase InlineData("dir/file.t", "exe", "dir/file.exe"), InlineData("dir/file.exe", "t", "dir/file.t"), InlineData("dir/file", "exe", "dir/file.exe")] - public void ChangeExtension(string path, string newExtension, string expected) + public void ChangeExtension(string? path, string? newExtension, string? expected) { if (expected != null) expected = expected.Replace('/', Path.DirectorySeparatorChar); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/AppContext/AppContextTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/AppContext/AppContextTests.cs index 6cf9ce9ac7f995..22d0118e11b7c1 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/AppContext/AppContextTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/AppContext/AppContextTests.cs @@ -12,7 +12,7 @@ public partial class AppContextTests [InlineData("AppContext_Case1", 123)] [InlineData("AppContext_Case2", "")] [InlineData("AppContext_Case3", null)] - public void AppContext_GetSetDataTest(string dataKey, object value) + public void AppContext_GetSetDataTest(string dataKey, object? value) { // Set data AppContext.SetData(dataKey, value); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ArgumentNullExceptionTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ArgumentNullExceptionTests.cs index 9705f44c55c14a..81551e69e4d125 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ArgumentNullExceptionTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ArgumentNullExceptionTests.cs @@ -66,7 +66,7 @@ public static unsafe void ThrowIfNull_NonNull_DoesntThrow() [InlineData(null)] [InlineData("")] [InlineData("name")] - public static unsafe void ThrowIfNull_Null_ThrowsArgumentNullException(string paramName) + public static unsafe void ThrowIfNull_Null_ThrowsArgumentNullException(string? paramName) { AssertExtensions.Throws(paramName, () => ArgumentNullException.ThrowIfNull((object)null, paramName)); AssertExtensions.Throws(paramName, () => ArgumentNullException.ThrowIfNull((void*)null, paramName)); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ArrayTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ArrayTests.cs index 8290a03428897d..96856a698c8888 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ArrayTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ArrayTests.cs @@ -369,7 +369,7 @@ public static IEnumerable BinarySearch_SZArray_TestData() [InlineData(new char[] { '\0' }, 0, 1, null, null, -1)] [InlineData(new float[] { 0 }, 0, 1, null, null, -1)] [InlineData(new double[] { 0 }, 0, 1, null, null, -1)] - public static void BinarySearch_Array(Array array, int index, int length, object value, IComparer comparer, int expected) + public static void BinarySearch_Array(Array array, int index, int length, object? value, IComparer? comparer, int expected) { bool isDefaultComparer = comparer == null || comparer == Comparer.Default; if (index == array.GetLowerBound(0) && length == array.Length) @@ -3220,7 +3220,7 @@ public static void IStructuralEquatable_GetHashCode_NullComparer_ThrowsArgumentN [InlineData(new int[] { 1, 2, 3, 4, 5 }, 7, new int[] { 1, 2, 3, 4, 5, default(int), default(int) })] [InlineData(new int[] { 1, 2, 3, 4, 5 }, 3, new int[] { 1, 2, 3 })] [InlineData(null, 3, new int[] { default(int), default(int), default(int) })] - public static void Resize(int[] array, int newSize, int[] expected) + public static void Resize(int[]? array, int newSize, int[] expected) { int[] testArray = array; Array.Resize(ref testArray, newSize); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/BooleanTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/BooleanTests.cs index 835f038afd74de..69fa8752df5821 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/BooleanTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/BooleanTests.cs @@ -124,7 +124,7 @@ public void ToString_Invoke_ReturnsExpected(bool value, string expected) [InlineData(false, false, 0)] [InlineData(false, true, -1)] [InlineData(false, null, 1)] - public void CompareTo_Other_ReturnsExpected(bool b, object obj, int expected) + public void CompareTo_Other_ReturnsExpected(bool b, object? obj, int expected) { if (obj is bool boolValue) { @@ -155,7 +155,7 @@ public void CompareTo_ObjectNotBool_ThrowsArgumentException(bool b, object obj) [InlineData(false, "0", false)] [InlineData(false, "False", false)] [InlineData(false, null, false)] - public void Equals_Other_ReturnsExpected(bool b1, object obj, bool expected) + public void Equals_Other_ReturnsExpected(bool b1, object? obj, bool expected) { if (obj is bool boolValue) { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ByteTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ByteTests.cs index 0325507355adae..d95fd2c3d8666f 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ByteTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ByteTests.cs @@ -43,7 +43,7 @@ public static void MinValue() [InlineData((byte)234, (byte)235, -1)] [InlineData((byte)234, byte.MaxValue, -1)] [InlineData((byte)234, null, 1)] - public void CompareTo_Other_ReturnsExpected(byte i, object value, int expected) + public void CompareTo_Other_ReturnsExpected(byte i, object? value, int expected) { if (value is byte byteValue) { @@ -68,7 +68,7 @@ public void CompareTo_ObjectNotByte_ThrowsArgumentException(object value) [InlineData((byte)78, null, false)] [InlineData((byte)78, "78", false)] [InlineData((byte)78, 78, false)] - public static void EqualsTest(byte b, object obj, bool expected) + public static void EqualsTest(byte b, object? obj, bool expected) { if (obj is byte b2) { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/CharTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/CharTests.cs index d43482bfce4bae..65112375551d3f 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/CharTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/CharTests.cs @@ -17,7 +17,7 @@ public class CharTests [InlineData('h', 'a', 1)] [InlineData('h', 'z', -1)] [InlineData('h', null, 1)] - public void CompareTo_Other_ReturnsExpected(char c, object value, int expected) + public void CompareTo_Other_ReturnsExpected(char c, object? value, int expected) { if (value is char charValue) { @@ -154,7 +154,7 @@ public static void ConvertToUtf32_Char_Char_Invalid() [InlineData('a', (int)'a', false)] [InlineData('a', "a", false)] [InlineData('a', null, false)] - public static void EqualsTest(char c, object obj, bool expected) + public static void EqualsTest(char c, object? obj, bool expected) { if (obj is char) { @@ -1019,7 +1019,7 @@ public static void Parse(string s, char expected) [InlineData("\\u0135", typeof(FormatException))] [InlineData("\u01356", typeof(FormatException))] [InlineData("\ud801\udc01", typeof(FormatException))] // Surrogate pair - public static void Parse_Invalid(string s, Type exceptionType) + public static void Parse_Invalid(string? s, Type exceptionType) { char c; Assert.False(char.TryParse(s, out c)); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DateTimeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DateTimeTests.cs index 2d31b68544abba..8eca865c38f95f 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DateTimeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DateTimeTests.cs @@ -1339,7 +1339,7 @@ public static void Parse_InvalidArguments_Throws() [Theory] [InlineData(null)] [InlineData("")] - public static void TryParse_NullOrEmptyString_ReturnsFalse(string input) + public static void TryParse_NullOrEmptyString_ReturnsFalse(string? input) { Assert.False(DateTime.TryParse(input, out DateTime result)); Assert.False(DateTime.TryParse(input, new MyFormatter(), DateTimeStyles.None, out result)); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/ConstantExpectedAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/ConstantExpectedAttributeTests.cs index 390955277f71fb..f74426ce594281 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/ConstantExpectedAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/ConstantExpectedAttributeTests.cs @@ -22,7 +22,7 @@ public void TestConstructor() [InlineData(10000)] [InlineData(0.5f)] [InlineData(null)] - public void TestSetMin(object min) + public void TestSetMin(object? min) { var attr = new ConstantExpectedAttribute { @@ -38,7 +38,7 @@ public void TestSetMin(object min) [InlineData(10000)] [InlineData(0.5f)] [InlineData(null)] - public void TestSetMax(object max) + public void TestSetMax(object? max) { var attr = new ConstantExpectedAttribute { @@ -55,7 +55,7 @@ public void TestSetMax(object max) [InlineData(null, null)] [InlineData(10, 0)] [InlineData(10, "https://dot.net")] - public void TestSetMinAndMax(object min, object max) + public void TestSetMinAndMax(object? min, object? max) { var attr = new ConstantExpectedAttribute { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/DynamicDependencyAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/DynamicDependencyAttributeTests.cs index c81a220659a522..d82b7c9798cc51 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/DynamicDependencyAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/DynamicDependencyAttributeTests.cs @@ -13,7 +13,7 @@ public class DynamicDependencyAttributeTests [InlineData("Foo()")] [InlineData(null)] [InlineData("")] - public void TestConstructorSignature(string memberSignature) + public void TestConstructorSignature(string? memberSignature) { var dda = new DynamicDependencyAttribute(memberSignature); @@ -29,7 +29,7 @@ public void TestConstructorSignature(string memberSignature) [InlineData("Foo()", typeof(string))] [InlineData(null, null)] [InlineData("", typeof(void))] - public void TestConstructorSignatureType(string memberSignature, Type type) + public void TestConstructorSignatureType(string? memberSignature, Type? type) { var dda = new DynamicDependencyAttribute(memberSignature, type); @@ -45,7 +45,7 @@ public void TestConstructorSignatureType(string memberSignature, Type type) [InlineData("Foo()", "System.String", "System.Runtime")] [InlineData(null, null, null)] [InlineData("", "", "")] - public void TestConstructorSignatureTypeNameAssemblyName(string memberSignature, string typeName, string assemblyName) + public void TestConstructorSignatureTypeNameAssemblyName(string? memberSignature, string? typeName, string? assemblyName) { var dda = new DynamicDependencyAttribute(memberSignature, typeName, assemblyName); @@ -61,7 +61,7 @@ public void TestConstructorSignatureTypeNameAssemblyName(string memberSignature, [InlineData(DynamicallyAccessedMemberTypes.PublicMethods, typeof(string))] [InlineData(DynamicallyAccessedMemberTypes.None, null)] [InlineData(DynamicallyAccessedMemberTypes.All, typeof(void))] - public void TestConstructorMemberTypes(DynamicallyAccessedMemberTypes memberTypes, Type type) + public void TestConstructorMemberTypes(DynamicallyAccessedMemberTypes memberTypes, Type? type) { var dda = new DynamicDependencyAttribute(memberTypes, type); @@ -77,7 +77,7 @@ public void TestConstructorMemberTypes(DynamicallyAccessedMemberTypes memberType [InlineData(DynamicallyAccessedMemberTypes.PublicMethods, "System.String", "System.Runtime")] [InlineData(DynamicallyAccessedMemberTypes.None, null, null)] [InlineData(DynamicallyAccessedMemberTypes.All, "", "")] - public void TestConstructorMemberTypesTypeNameAssemblyName(DynamicallyAccessedMemberTypes memberTypes, string typeName, string assemblyName) + public void TestConstructorMemberTypesTypeNameAssemblyName(DynamicallyAccessedMemberTypes memberTypes, string? typeName, string? assemblyName) { var dda = new DynamicDependencyAttribute(memberTypes, typeName, assemblyName); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/ExperimentalAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/ExperimentalAttributeTests.cs index 4088037a54ac33..66d0a3ed7ba817 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/ExperimentalAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/ExperimentalAttributeTests.cs @@ -26,7 +26,7 @@ public void TestConstructor(string expected) [InlineData(null)] [InlineData("")] [InlineData("https://contoso.com/obsoletion-warnings/{0}")] - public void TestSetUrlFormat(string urlFormat) + public void TestSetUrlFormat(string? urlFormat) { var attr = new ExperimentalAttribute("diagnosticId") { @@ -41,7 +41,7 @@ public void TestSetUrlFormat(string urlFormat) [InlineData(null)] [InlineData("")] [InlineData("This is an experimental feature")] - public void TestSetMessage(string message) + public void TestSetMessage(string? message) { var attribute = new ExperimentalAttribute("diagnosticId") { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/RequiresAssemblyFilesAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/RequiresAssemblyFilesAttributeTests.cs index 6dd40bf5b3de42..89fa0471568904 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/RequiresAssemblyFilesAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/RequiresAssemblyFilesAttributeTests.cs @@ -20,7 +20,7 @@ public void TestConstructor() [InlineData("Message")] [InlineData("")] [InlineData(null)] - public void TestSetMessage(string message) + public void TestSetMessage(string? message) { var attr = new RequiresAssemblyFilesAttribute(message); @@ -32,7 +32,7 @@ public void TestSetMessage(string message) [InlineData("https://dot.net")] [InlineData("")] [InlineData(null)] - public void TestSetUrl(string url) + public void TestSetUrl(string? url) { var attr = new RequiresAssemblyFilesAttribute() { @@ -53,7 +53,7 @@ public void TestSetUrl(string url) [InlineData(null, "https://dot.net")] [InlineData(null, "")] [InlineData(null, null)] - public void TestSetMessageAndUrl(string message, string url) + public void TestSetMessageAndUrl(string? message, string? url) { var attr = new RequiresAssemblyFilesAttribute(message) { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/RequiresDynamicCodeAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/RequiresDynamicCodeAttributeTests.cs index a9cbc6f6942ec0..e63f6c0f8f4ca8 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/RequiresDynamicCodeAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/RequiresDynamicCodeAttributeTests.cs @@ -20,7 +20,7 @@ public void TestConstructor() [InlineData("https://dot.net")] [InlineData("")] [InlineData(null)] - public void TestSetUrl(string url) + public void TestSetUrl(string? url) { var attr = new RequiresDynamicCodeAttribute("User Message") { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/RequiresUnreferencedCodeAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/RequiresUnreferencedCodeAttributeTests.cs index 62424692f1dc2c..237f0acf5bafe8 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/RequiresUnreferencedCodeAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/RequiresUnreferencedCodeAttributeTests.cs @@ -20,7 +20,7 @@ public void TestConstructor() [InlineData("https://dot.net")] [InlineData("")] [InlineData(null)] - public void TestSetUrl(string url) + public void TestSetUrl(string? url) { var attr = new RequiresUnreferencedCodeAttribute("User Message") { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/UnconditionalSuppressMessageAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/UnconditionalSuppressMessageAttributeTests.cs index a63d9c34ec2502..d4d31192e374bc 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/UnconditionalSuppressMessageAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Diagnostics/CodeAnalysis/UnconditionalSuppressMessageAttributeTests.cs @@ -12,7 +12,7 @@ public class UnconditionalSuppressMessageAttributeTests [InlineData("", "", "", "", "", "")] [InlineData(null, null, null, null, null, null)] [InlineData("", null, "Justification", null, "Scope", "")] - public void TestConstructor(string category, string id, string justification, string messageId, string scope, string target) + public void TestConstructor(string? category, string? id, string? justification, string? messageId, string? scope, string? target) { var usma = new UnconditionalSuppressMessageAttribute(category, id) { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.cs index a236858cff20d1..ac1bf4abf4e863 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/DoubleTests.cs @@ -59,7 +59,7 @@ public static void CompareTo_ObjectNotDouble_ThrowsArgumentException(object valu [InlineData(double.NegativeInfinity, double.PositiveInfinity, -1)] [InlineData(double.PositiveInfinity, double.PositiveInfinity, 0)] [InlineData(double.PositiveInfinity, double.NegativeInfinity, 1)] - public static void CompareTo_Other_ReturnsExpected(double d1, object value, int expected) + public static void CompareTo_Other_ReturnsExpected(double d1, object? value, int expected) { if (value is double d2) { @@ -131,7 +131,7 @@ public static void Epsilon() [InlineData(double.NaN, -double.NaN, true)] [InlineData(789.0, 789.0f, false)] [InlineData(789.0, "789", false)] - public static void EqualsTest(double d1, object value, bool expected) + public static void EqualsTest(double d1, object? value, bool expected) { if (value is double d2) { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/EnumTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/EnumTests.cs index b3fddb6bac4c18..4c73475742a497 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/EnumTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/EnumTests.cs @@ -294,7 +294,7 @@ public static void Parse_NonExistentValue_IncludedInErrorMessage(string value) [InlineData((sbyte)2, "Two")] [InlineData(sbyte.MaxValue, "Max")] [InlineData((sbyte)3, null)] - public void GetName_InvokeSByteEnum_ReturnsExpected(object value, string expected) + public void GetName_InvokeSByteEnum_ReturnsExpected(object value, string? expected) { TestGetName(typeof(SByteEnum), value, expected); if (!(value is SByteEnum enumValue)) @@ -314,7 +314,7 @@ public void GetName_InvokeSByteEnum_ReturnsExpected(object value, string expecte [InlineData((byte)2, "Two")] [InlineData(byte.MaxValue, "Max")] [InlineData((byte)3, null)] - public void GetName_InvokeByteEnum_ReturnsExpected(object value, string expected) + public void GetName_InvokeByteEnum_ReturnsExpected(object value, string? expected) { TestGetName(typeof(ByteEnum), value, expected); if (!(value is ByteEnum enumValue)) @@ -334,7 +334,7 @@ public void GetName_InvokeByteEnum_ReturnsExpected(object value, string expected [InlineData((short)2, "Two")] [InlineData(short.MaxValue, "Max")] [InlineData((short)3, null)] - public void GetName_InvokeInt16Enum_ReturnsExpected(object value, string expected) + public void GetName_InvokeInt16Enum_ReturnsExpected(object value, string? expected) { TestGetName(typeof(Int16Enum), value, expected); if (!(value is Int16Enum enumValue)) @@ -354,7 +354,7 @@ public void GetName_InvokeInt16Enum_ReturnsExpected(object value, string expecte [InlineData((ushort)2, "Two")] [InlineData(ushort.MaxValue, "Max")] [InlineData((ushort)3, null)] - public void GetName_InvokeUInt16Enum_ReturnsExpected(object value, string expected) + public void GetName_InvokeUInt16Enum_ReturnsExpected(object value, string? expected) { TestGetName(typeof(UInt16Enum), value, expected); if (!(value is UInt16Enum enumValue)) @@ -374,7 +374,7 @@ public void GetName_InvokeUInt16Enum_ReturnsExpected(object value, string expect [InlineData(2, "Two")] [InlineData(int.MaxValue, "Max")] [InlineData(3, null)] - public void GetName_InvokeInt32Enum_ReturnsExpected(object value, string expected) + public void GetName_InvokeInt32Enum_ReturnsExpected(object value, string? expected) { TestGetName(typeof(Int32Enum), value, expected); if (!(value is Int32Enum enumValue)) @@ -394,7 +394,7 @@ public void GetName_InvokeInt32Enum_ReturnsExpected(object value, string expecte [InlineData((uint)2, "Two")] [InlineData(uint.MaxValue, "Max")] [InlineData((uint)3, null)] - public void GetName_InvokeUInt32Enum_ReturnsExpected(object value, string expected) + public void GetName_InvokeUInt32Enum_ReturnsExpected(object value, string? expected) { TestGetName(typeof(UInt32Enum), value, expected); if (!(value is UInt32Enum enumValue)) @@ -414,7 +414,7 @@ public void GetName_InvokeUInt32Enum_ReturnsExpected(object value, string expect [InlineData((long)2, "Two")] [InlineData(long.MaxValue, "Max")] [InlineData((long)3, null)] - public void GetName_InvokeInt64Enum_ReturnsExpected(object value, string expected) + public void GetName_InvokeInt64Enum_ReturnsExpected(object value, string? expected) { TestGetName(typeof(Int64Enum), value, expected); if (!(value is Int64Enum enumValue)) @@ -434,7 +434,7 @@ public void GetName_InvokeInt64Enum_ReturnsExpected(object value, string expecte [InlineData(2UL, "Two")] [InlineData(ulong.MaxValue, "Max")] [InlineData(3UL, null)] - public void GetName_InvokeUInt64Enum_ReturnsExpected(object value, string expected) + public void GetName_InvokeUInt64Enum_ReturnsExpected(object value, string? expected) { TestGetName(typeof(UInt64Enum), value, expected); if (!(value is UInt64Enum enumValue)) @@ -524,7 +524,7 @@ public void GetName_InvalidValue_ThrowsArgumentException(object value) [InlineData(typeof(SByteEnum), unchecked((int)(0xffffff80u)), "Min")] [InlineData(typeof(SByteEnum), (char)1, "One")] [InlineData(typeof(SByteEnum), SimpleEnum.Red, "One")] // API doesn't care if you pass in a completely different enum - public static void GetName_NonIntegralTypes_ReturnsExpected(Type enumType, object value, string expected) + public static void GetName_NonIntegralTypes_ReturnsExpected(Type enumType, object value, string? expected) { // Despite what MSDN says, GetName() does not require passing in the exact integral type. // For the purposes of comparison: diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int16Tests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int16Tests.cs index 60414f96e1a8b6..4601ac9dad7965 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int16Tests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int16Tests.cs @@ -52,7 +52,7 @@ public static void MinValue() [InlineData((short)-234, (short)234, -1)] [InlineData((short)-234, (short)-432, 1)] [InlineData((short)234, null, 1)] - public void CompareTo_Other_ReturnsExpected(short i, object value, int expected) + public void CompareTo_Other_ReturnsExpected(short i, object? value, int expected) { if (value is short shortValue) { @@ -81,7 +81,7 @@ public void CompareTo_ObjectNotShort_ThrowsArgumentException(object value) [InlineData((short)789, null, false)] [InlineData((short)789, "789", false)] [InlineData((short)789, 789, false)] - public static void EqualsTest(short i1, object obj, bool expected) + public static void EqualsTest(short i1, object? obj, bool expected) { if (obj is short) { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int32Tests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int32Tests.cs index c170548369cd2c..d1b9c154aefc97 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int32Tests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int32Tests.cs @@ -52,7 +52,7 @@ public static void MinValue() [InlineData(-234, 234, -1)] [InlineData(-234, -432, 1)] [InlineData(234, null, 1)] - public void CompareTo_Other_ReturnsExpected(int i, object value, int expected) + public void CompareTo_Other_ReturnsExpected(int i, object? value, int expected) { if (value is int intValue) { @@ -81,7 +81,7 @@ public void CompareTo_ObjectNotInt_ThrowsArgumentException(object value) [InlineData(789, null, false)] [InlineData(789, "789", false)] [InlineData(789, (long)789, false)] - public static void EqualsTest(int i1, object obj, bool expected) + public static void EqualsTest(int i1, object? obj, bool expected) { if (obj is int) { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int64Tests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int64Tests.cs index 2e2af6716ef343..7e755afd985834 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int64Tests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Int64Tests.cs @@ -53,7 +53,7 @@ public static void MinValue() [InlineData((long)-234, (long)234, -1)] [InlineData((long)-234, (long)-432, 1)] [InlineData((long)234, null, 1)] - public void CompareTo_Other_ReturnsExpected(long i, object value, int expected) + public void CompareTo_Other_ReturnsExpected(long i, object? value, int expected) { if (value is long longValue) { @@ -82,7 +82,7 @@ public void CompareTo_ObjectNotLong_ThrowsArgumentException(object value) [InlineData((long)789, null, false)] [InlineData((long)789, "789", false)] [InlineData((long)789, 789, false)] - public static void EqualsTest(long i1, object obj, bool expected) + public static void EqualsTest(long i1, object? obj, bool expected) { if (obj is long) { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/IntPtrTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/IntPtrTests.cs index d56f15e69e410f..0016d974ab1737 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/IntPtrTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/IntPtrTests.cs @@ -112,7 +112,7 @@ public static IEnumerable Equals_TestData() [Theory] [MemberData(nameof(Equals_TestData))] - public static void EqualsTest(nint value, object obj, bool expected) + public static void EqualsTest(nint value, object? obj, bool expected) { if (obj is nint other) { @@ -246,7 +246,7 @@ public static void MinValue() [InlineData(-234, 234, -1)] [InlineData(-234, -432, 1)] [InlineData(234, null, 1)] - public static void CompareTo_Other_ReturnsExpected(int l, object value, int expected) + public static void CompareTo_Other_ReturnsExpected(int l, object? value, int expected) { nint i = l; if (value is int intValue) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/NullableTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/NullableTests.cs index 5e6f268915cca4..4f3efc786e4623 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/NullableTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/NullableTests.cs @@ -83,7 +83,7 @@ public static void ExplicitCast_T() [InlineData(typeof(int?), typeof(int))] [InlineData(typeof(int), null)] [InlineData(typeof(G), null)] - public static void GetUnderlyingType(Type nullableType, Type expected) + public static void GetUnderlyingType(Type nullableType, Type? expected) { Assert.Equal(expected, Nullable.GetUnderlyingType(nullableType)); } diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ObsoleteAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ObsoleteAttributeTests.cs index 32cc0ccbabb763..4d74c084567aca 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ObsoleteAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/ObsoleteAttributeTests.cs @@ -21,7 +21,7 @@ public static void Ctor_Default() [InlineData(null, null)] [InlineData("", "BCL0006")] [InlineData("message", "")] - public void Ctor_String_Id(string message, string id) + public void Ctor_String_Id(string? message, string? id) { var attribute = new ObsoleteAttribute(message) { DiagnosticId = id }; Assert.Equal(message, attribute.Message); @@ -34,7 +34,7 @@ public void Ctor_String_Id(string message, string id) [InlineData(null, true, "")] [InlineData("", false, null)] [InlineData("message", true, "https://aka.ms/obsolete/{0}")] - public void Ctor_String_Bool_Url(string message, bool error, string url) + public void Ctor_String_Bool_Url(string? message, bool error, string? url) { var attribute = new ObsoleteAttribute(message, error) { UrlFormat = url }; Assert.Equal(message, attribute.Message); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyCompanyAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyCompanyAttributeTests.cs index b685373ea0b538..87295bd34d0abb 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyCompanyAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyCompanyAttributeTests.cs @@ -11,7 +11,7 @@ public class AssemblyCompanyAttributeTests [InlineData(null)] [InlineData("")] [InlineData("company")] - public void Ctor_String(string company) + public void Ctor_String(string? company) { var attribute = new AssemblyCompanyAttribute(company); Assert.Equal(company, attribute.Company); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyConfigurationAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyConfigurationAttributeTests.cs index 9041709da4acd1..6a8988c52b37e7 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyConfigurationAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyConfigurationAttributeTests.cs @@ -11,7 +11,7 @@ public class AssemblyConfigurationAttributeTests [InlineData(null)] [InlineData("")] [InlineData("configuration")] - public void Ctor_String(string configuration) + public void Ctor_String(string? configuration) { var attribute = new AssemblyConfigurationAttribute(configuration); Assert.Equal(configuration, attribute.Configuration); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyCopyrightAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyCopyrightAttributeTests.cs index 3142407a0e7067..bb3788bfe378f1 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyCopyrightAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyCopyrightAttributeTests.cs @@ -11,7 +11,7 @@ public class AssemblyCopyrightAttributeTests [InlineData(null)] [InlineData("")] [InlineData("copyright")] - public void Ctor_String(string copyright) + public void Ctor_String(string? copyright) { var attribute = new AssemblyCopyrightAttribute(copyright); Assert.Equal(copyright, attribute.Copyright); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyCultureAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyCultureAttributeTests.cs index 86aeb5f6a026c0..e921ad78ef3df8 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyCultureAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyCultureAttributeTests.cs @@ -11,7 +11,7 @@ public class AssemblyCultureAttributeTests [InlineData(null)] [InlineData("")] [InlineData("Czech")] - public void Ctor_String(string culture) + public void Ctor_String(string? culture) { var attribute = new AssemblyCultureAttribute(culture); Assert.Equal(culture, attribute.Culture); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyDefaultAliasAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyDefaultAliasAttributeTests.cs index 94f7d03f31a9ad..7167083ed41ec5 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyDefaultAliasAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyDefaultAliasAttributeTests.cs @@ -11,7 +11,7 @@ public class AssemblyDefaultAliasAttributeTests [InlineData(null)] [InlineData("")] [InlineData("defaultAlias")] - public void Ctor_String(string defaultAlias) + public void Ctor_String(string? defaultAlias) { var attribute = new AssemblyDefaultAliasAttribute(defaultAlias); Assert.Equal(defaultAlias, attribute.DefaultAlias); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyDescriptionAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyDescriptionAttributeTests.cs index efa97cf0917565..00b0cfc799891b 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyDescriptionAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyDescriptionAttributeTests.cs @@ -11,7 +11,7 @@ public class AssemblyDescriptionAttributeTests [InlineData(null)] [InlineData("")] [InlineData("description")] - public void Ctor_String(string description) + public void Ctor_String(string? description) { var attribute = new AssemblyDescriptionAttribute(description); Assert.Equal(description, attribute.Description); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyInformationalVersionAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyInformationalVersionAttributeTests.cs index 83ca8d4e07038a..026d3a00ca8c8e 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyInformationalVersionAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyInformationalVersionAttributeTests.cs @@ -12,7 +12,7 @@ public class AssemblyInformationalVersionAttributeTests [InlineData("")] [InlineData("version")] [InlineData("3.4.5.6.7")] - public void Ctor_String(string informationalVersion) + public void Ctor_String(string? informationalVersion) { var attribute = new AssemblyInformationalVersionAttribute(informationalVersion); Assert.Equal(informationalVersion, attribute.InformationalVersion); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyKeyFileAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyKeyFileAttributeTests.cs index 84ffd312fe20b3..5b1062293f3305 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyKeyFileAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyKeyFileAttributeTests.cs @@ -12,7 +12,7 @@ public class AssemblyKeyFileAttributeTests [InlineData("")] [InlineData("keyFile")] [InlineData("KeyFile.snk")] - public void Ctor_String(string keyFile) + public void Ctor_String(string? keyFile) { var attribute = new AssemblyKeyFileAttribute(keyFile); Assert.Equal(keyFile, attribute.KeyFile); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyKeyNameAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyKeyNameAttributeTests.cs index e4decff7790ea6..099638767a6000 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyKeyNameAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyKeyNameAttributeTests.cs @@ -11,7 +11,7 @@ public class AssemblyKeyNameAttributeTests [InlineData(null)] [InlineData("")] [InlineData("keyName")] - public void Ctor_String(string keyName) + public void Ctor_String(string? keyName) { var attribute = new AssemblyKeyNameAttribute(keyName); Assert.Equal(keyName, attribute.KeyName); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyMetadataAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyMetadataAttributeTests.cs index 5a80e97444117c..d87d9109f91ef0 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyMetadataAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyMetadataAttributeTests.cs @@ -11,7 +11,7 @@ public class AssemblyMetadataAttributeTests [InlineData(null, null)] [InlineData("", "")] [InlineData("key", "value")] - public void Ctor_String_String(string key, string value) + public void Ctor_String_String(string? key, string? value) { var attribute = new AssemblyMetadataAttribute(key, value); Assert.Equal(key, attribute.Key); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyProductAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyProductAttributeTests.cs index 2787e74d3ebb14..6f83daee9662d3 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyProductAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyProductAttributeTests.cs @@ -12,7 +12,7 @@ public class AssemblyProductAttributeTests [InlineData("")] [InlineData("product")] [InlineData(".NET Core")] - public void Ctor_String(string product) + public void Ctor_String(string? product) { var attribute = new AssemblyProductAttribute(product); Assert.Equal(product, attribute.Product); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblySignatureKeyAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblySignatureKeyAttributeTests.cs index 94a1ba0c44995b..0dbf27ab5253e5 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblySignatureKeyAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblySignatureKeyAttributeTests.cs @@ -11,7 +11,7 @@ public class AssemblySignatureKeyAttributeTests [InlineData(null, null)] [InlineData("", "")] [InlineData("publicKey", "countersignature")] - public void Ctor_String_String(string publicKey, string countersignature) + public void Ctor_String_String(string? publicKey, string? countersignature) { var attribute = new AssemblySignatureKeyAttribute(publicKey, countersignature); Assert.Equal(publicKey, attribute.PublicKey); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyTitleAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyTitleAttributeTests.cs index bb9f8c28157359..ef3fb0129b913c 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyTitleAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyTitleAttributeTests.cs @@ -11,7 +11,7 @@ public class AssemblyTitleAttributeTests [InlineData(null)] [InlineData("")] [InlineData("title")] - public void Ctor_String(string title) + public void Ctor_String(string? title) { var attribute = new AssemblyTitleAttribute(title); Assert.Equal(title, attribute.Title); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyTrademarkAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyTrademarkAttributeTests.cs index bce1353d9f0a51..1e178f89633eda 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyTrademarkAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyTrademarkAttributeTests.cs @@ -11,7 +11,7 @@ public class AssemblyTrademarkAttributeTests [InlineData(null)] [InlineData("")] [InlineData("trademark")] - public void Ctor_String(string trademark) + public void Ctor_String(string? trademark) { var attribute = new AssemblyTrademarkAttribute(trademark); Assert.Equal(trademark, attribute.Trademark); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyVersionAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyVersionAttributeTests.cs index c79b9c9c49f0b8..844c00491af841 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyVersionAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/AssemblyVersionAttributeTests.cs @@ -12,7 +12,7 @@ public class AssemblyVersionAttributeTests [InlineData("")] [InlineData("version")] [InlineData("5.6.7.8.9")] - public void Ctor_String(string version) + public void Ctor_String(string? version) { var attribute = new AssemblyVersionAttribute(version); Assert.Equal(version, attribute.Version); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/DefaultMemberAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/DefaultMemberAttributeTests.cs index f0cc50bdbd2a92..5502b2e503267a 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/DefaultMemberAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/DefaultMemberAttributeTests.cs @@ -11,7 +11,7 @@ public class DefaultMemberAttributeTests [InlineData(null)] [InlineData("")] [InlineData("configuration")] - public void Ctor_String(string memberName) + public void Ctor_String(string? memberName) { var attribute = new DefaultMemberAttribute(memberName); Assert.Equal(memberName, attribute.MemberName); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/ObfuscationAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/ObfuscationAttributeTests.cs index 589f0906cb1c70..05ca5573642442 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/ObfuscationAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/ObfuscationAttributeTests.cs @@ -45,7 +45,7 @@ public void Exclude_Set_GetReturnsExpected(bool value) [InlineData(null)] [InlineData("")] [InlineData("feature")] - public void Feature_Set_GetReturnsExpected(string value) + public void Feature_Set_GetReturnsExpected(string? value) { var attribute = new ObfuscationAttribute { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/StrongNameKeyPairTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/StrongNameKeyPairTests.cs index 10cf716f583303..54fc76d0e8a1d0 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/StrongNameKeyPairTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Reflection/StrongNameKeyPairTests.cs @@ -45,7 +45,7 @@ public void Ctor_NullKeyPairFile_ThrowsPlatformNotSupportedException() [InlineData(null)] [InlineData("")] [InlineData("keyPairContainer")] - public void Ctor_String_ThrowsPlatformNotSupportedException(string keyPairContainer) + public void Ctor_String_ThrowsPlatformNotSupportedException(string? keyPairContainer) { Assert.Throws(() => new StrongNameKeyPair(keyPairContainer)); } diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/Serialization/StreamingContextTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/Serialization/StreamingContextTests.cs index 489e9cd2c74900..6afc053c0b8217 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/Serialization/StreamingContextTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/Serialization/StreamingContextTests.cs @@ -30,7 +30,7 @@ public void Ctor_StreamingContextStates(StreamingContextStates state) [InlineData(StreamingContextStates.All, null)] [InlineData((StreamingContextStates)0, "")] [InlineData((StreamingContextStates)(-1), "context")] - public void Ctor_StreamingContextStates_Object(StreamingContextStates state, object additional) + public void Ctor_StreamingContextStates_Object(StreamingContextStates state, object? additional) { var context = new StreamingContext(state, additional); Assert.Equal(state, context.State); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/Versioning/RequiresPreviewFeaturesAttributeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/Versioning/RequiresPreviewFeaturesAttributeTests.cs index 1751b90a576905..ed9c7dab5d54d5 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/Versioning/RequiresPreviewFeaturesAttributeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Runtime/Versioning/RequiresPreviewFeaturesAttributeTests.cs @@ -25,7 +25,7 @@ public static void Ctor_Default() [InlineData(null)] [InlineData("")] [InlineData("message")] - public void Ctor_String_Message(string message) + public void Ctor_String_Message(string? message) { var attribute = new RequiresPreviewFeaturesAttribute(message); Assert.Same(message, attribute.Message); @@ -36,7 +36,7 @@ public void Ctor_String_Message(string message) [InlineData(null, "")] [InlineData("", null)] [InlineData("message", "https://aka.ms/preview-features/")] - public void Ctor_String_Url(string message, string url) + public void Ctor_String_Url(string? message, string? url) { var attribute = new RequiresPreviewFeaturesAttribute(message) { Url = url }; Assert.Same(message, attribute.Message); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/SByteTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/SByteTests.cs index 7b92f123fd498e..effc332bc5b93d 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/SByteTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/SByteTests.cs @@ -48,7 +48,7 @@ public static void MinValue() [InlineData((sbyte)-114, sbyte.MaxValue, -1)] [InlineData(sbyte.MaxValue, sbyte.MaxValue, 0)] [InlineData((sbyte)114, null, 1)] - public void CompareTo_Other_ReturnsExpected(sbyte i, object value, int expected) + public void CompareTo_Other_ReturnsExpected(sbyte i, object? value, int expected) { if (value is sbyte sbyteValue) { @@ -77,7 +77,7 @@ public void CompareTo_ObjectNotSByte_ThrowsArgumentException(object value) [InlineData((sbyte)78, null, false)] [InlineData((sbyte)78, "78", false)] [InlineData((sbyte)78, 78, false)] - public static void EqualsTest(sbyte i1, object obj, bool expected) + public static void EqualsTest(sbyte i1, object? obj, bool expected) { if (obj is sbyte) { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/SingleTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/SingleTests.cs index a7152e5ab00efb..fc8f547f15ea45 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/SingleTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/SingleTests.cs @@ -56,7 +56,7 @@ public static void CompareTo_ObjectNotFloat_ThrowsArgumentException(object value [InlineData(float.NegativeInfinity, float.PositiveInfinity, -1)] [InlineData(float.PositiveInfinity, float.PositiveInfinity, 0)] [InlineData(float.PositiveInfinity, float.NegativeInfinity, 1)] - public static void CompareTo_Other_ReturnsExpected(float f1, object value, int expected) + public static void CompareTo_Other_ReturnsExpected(float f1, object? value, int expected) { if (value is float f2) { @@ -128,7 +128,7 @@ public static void Epsilon() [InlineData(float.NaN, -float.NaN, true)] [InlineData(789.0f, 789.0, false)] [InlineData(789.0f, "789", false)] - public static void EqualsTest(float f1, object value, bool expected) + public static void EqualsTest(float f1, object? value, bool expected) { if (value is float f2) { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/String.SplitTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/String.SplitTests.cs index 1cda74cfda28d6..317695b20493b0 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/String.SplitTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/String.SplitTests.cs @@ -571,7 +571,7 @@ public static void SplitCharSeparator(string value, char separator, int count, S [InlineData(" a b ", null, 2, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries, new[] { "a b" })] [InlineData(" a b ", "", 2, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries, new[] { "a b" })] [InlineData(" a b ", " ", 2, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries, new[] { "a", "b" })] - public static void SplitStringSeparator(string value, string separator, int count, StringSplitOptions options, string[] expected) + public static void SplitStringSeparator(string value, string? separator, int count, StringSplitOptions options, string[] expected) { Assert.Equal(expected, value.Split(separator, count, options)); Assert.Equal(expected, value.Split(new[] { separator }, count, options)); @@ -638,7 +638,7 @@ public static void SplitNullCharArraySeparator_BindsToCharArrayOverload() [InlineData(" a b ", null, 2, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries, new[] { "a", "b" })] [InlineData(" a b ", new char[0], 2, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries, new[] { "a", "b" })] [InlineData(" a b ", new char[] { ' ' }, 2, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries, new[] { "a", "b" })] - public static void SplitCharArraySeparator(string value, char[] separators, int count, StringSplitOptions options, string[] expected) + public static void SplitCharArraySeparator(string value, char[]? separators, int count, StringSplitOptions options, string[] expected) { Assert.Equal(expected, value.Split(separators, count, options)); Assert.Equal(expected, value.Split(ToStringArray(separators), count, options)); @@ -697,7 +697,7 @@ public static void SplitCharArraySeparator(string value, char[] separators, int [InlineData(" a b ", null, 2, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries, new[] { "a", "b" })] [InlineData(" a b ", new string[0], 2, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries, new[] { "a", "b" })] [InlineData(" a b ", new string[] { " " }, 2, StringSplitOptions.TrimEntries | StringSplitOptions.RemoveEmptyEntries, new[] { "a", "b" })] - public static void SplitStringArraySeparator(string value, string[] separators, int count, StringSplitOptions options, string[] expected) + public static void SplitStringArraySeparator(string value, string[]? separators, int count, StringSplitOptions options, string[] expected) { Assert.Equal(expected, value.Split(separators, count, options)); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Text/StringBuilderReplaceTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Text/StringBuilderReplaceTests.cs index c4752d17682896..54ebfca0141029 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Text/StringBuilderReplaceTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Text/StringBuilderReplaceTests.cs @@ -25,7 +25,7 @@ public abstract class StringBuilderReplaceTests [InlineData("aaaabbbbccccdddd", "aaaabbbbccccdddd", "", 16, 0, "aaaabbbbccccdddd")] [InlineData("aaaabbbbccccdddd", "aaaabbbbccccdddde", "", 0, 16, "aaaabbbbccccdddd")] [InlineData("aaaaaaaaaaaaaaaa", "a", "b", 0, 16, "bbbbbbbbbbbbbbbb")] - public void Replace_StringBuilder(string value, string oldValue, string newValue, int startIndex, int count, string expected) + public void Replace_StringBuilder(string value, string oldValue, string? newValue, int startIndex, int count, string expected) { StringBuilder builder; if (startIndex == 0 && count == value.Length) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Text/StringBuilderTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Text/StringBuilderTests.cs index 5671c6d3614e57..27a9a02eded2f9 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Text/StringBuilderTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Text/StringBuilderTests.cs @@ -70,7 +70,7 @@ public static void Ctor_Int_Int_Invalid() [InlineData("Hello")] [InlineData("")] [InlineData(null)] - public static void Ctor_String(string value) + public static void Ctor_String(string? value) { var builder = new StringBuilder(value); @@ -83,7 +83,7 @@ public static void Ctor_String(string value) [InlineData("Hello")] [InlineData("")] [InlineData(null)] - public static void Ctor_String_Int(string value) + public static void Ctor_String_Int(string? value) { var builder = new StringBuilder(value, 42); @@ -105,7 +105,7 @@ public static void Ctor_String_Int_NegativeCapacity_ThrowsArgumentOutOfRangeExce [InlineData("Hello", 2, 3)] [InlineData("", 0, 0)] [InlineData(null, 0, 0)] - public static void Ctor_String_Int_Int_Int(string value, int startIndex, int length) + public static void Ctor_String_Int_Int_Int(string? value, int startIndex, int length) { var builder = new StringBuilder(value, startIndex, length, 42); @@ -384,7 +384,7 @@ public static void Append_Long_NoSpareCapacity_ThrowsArgumentOutOfRangeException [InlineData("", "g", "g")] [InlineData("Hello", "", "Hello")] [InlineData("Hello", null, "Hello")] - public static void Append_Object(string original, object value, string expected) + public static void Append_Object(string original, object? value, string expected) { var builder = new StringBuilder(original); builder.Append(value); @@ -562,7 +562,7 @@ public static void Append_Char_NoSpareCapacity_ThrowsArgumentOutOfRangeException [InlineData("", new char[] { 'a' }, 0, "")] [InlineData("Hello", new char[0], 0, "Hello")] [InlineData("Hello", null, 0, "Hello")] - public static unsafe void Append_CharPointer(string original, char[] charArray, int valueCount, string expected) + public static unsafe void Append_CharPointer(string original, char[]? charArray, int valueCount, string expected) { _ = charArray; // https://github.com/xunit/xunit/issues/1969 fixed (char* value = charArray) @@ -613,7 +613,7 @@ public static unsafe void Append_CharPointer_NoSpareCapacity_ThrowsArgumentOutOf [InlineData("Hello", "g", 0, 0, "Hello")] [InlineData("Hello", "", 0, 0, "Hello")] [InlineData("Hello", null, 0, 0, "Hello")] - public static void Append_String(string original, string value, int startIndex, int count, string expected) + public static void Append_String(string original, string? value, int startIndex, int count, string expected) { StringBuilder builder; if (startIndex == 0 && count == (value?.Length ?? 0)) @@ -673,7 +673,7 @@ public static void Append_String_NoSpareCapacity_ThrowsArgumentOutOfRangeExcepti [InlineData("Hello", new char[] { 'e' }, 0, 0, "Hello")] [InlineData("Hello", new char[0], 0, 0, "Hello")] [InlineData("Hello", null, 0, 0, "Hello")] - public static void Append_CharArray(string original, char[] value, int startIndex, int charCount, string expected) + public static void Append_CharArray(string original, char[]? value, int startIndex, int charCount, string expected) { StringBuilder builder; if (startIndex == 0 && charCount == (value?.Length ?? 0)) @@ -1355,7 +1355,7 @@ public static void Insert_Float_Invalid() [InlineData("Hello", 5, "def", "Hellodef")] [InlineData("Hello", 0, "", "Hello")] [InlineData("Hello", 0, null, "Hello")] - public static void Insert_Object(string original, int index, object value, string expected) + public static void Insert_Object(string original, int index, object? value, string expected) { var builder = new StringBuilder(original); builder.Insert(index, value); @@ -1544,7 +1544,7 @@ public static void Insert_SByte_Invalid() [InlineData("Hello", 0, null, 1, "Hello")] [InlineData("Hello", 3, "abc", 2, "Helabcabclo")] [InlineData("Hello", 5, "def", 2, "Hellodefdef")] - public static void Insert_String_Count(string original, int index, string value, int count, string expected) + public static void Insert_String_Count(string original, int index, string? value, int count, string expected) { StringBuilder builder; if (count == 1) @@ -1590,7 +1590,7 @@ public static void Insert_String_Count_Invalid() [InlineData("Hello", 3, new char[] { 'a', 'b', 'c' }, 1, 1, "Helblo")] [InlineData("Hello", 3, new char[] { 'a', 'b', 'c' }, 1, 2, "Helbclo")] [InlineData("Hello", 3, new char[] { 'a', 'b', 'c' }, 0, 2, "Helablo")] - public static void Insert_CharArray(string original, int index, char[] value, int startIndex, int charCount, string expected) + public static void Insert_CharArray(string original, int index, char[]? value, int startIndex, int charCount, string expected) { StringBuilder builder; if (startIndex == 0 && charCount == (value?.Length ?? 0)) @@ -1836,7 +1836,7 @@ private sealed class NullToStringObject [InlineData("", "123")] [InlineData(" ", "1 2 3")] [InlineData(", ", "1, 2, 3")] - public static void AppendJoin_TestStringSeparators(string separator, string expected) + public static void AppendJoin_TestStringSeparators(string? separator, string expected) { var values = new object[] { 1, 2, 3 }; var stringValues = new string[] { "1", "2", "3" }; @@ -1859,7 +1859,7 @@ private static StringBuilder CreateBuilderWithNoSpareCapacity() [InlineData("", new object[] { "", "" })] [InlineData(" ", new object[] { })] [InlineData(", ", new object[] { "" })] - public static void AppendJoin_NoValues_NoSpareCapacity_DoesNotThrow(string separator, object[] values) + public static void AppendJoin_NoValues_NoSpareCapacity_DoesNotThrow(string? separator, object[] values) { var stringValues = Array.ConvertAll(values, _ => _?.ToString()); var enumerable = values.Select(_ => _); @@ -1884,7 +1884,7 @@ public static void AppendJoin_NoValues_NoSpareCapacity_DoesNotThrow(string separ [InlineData(" ", new object[] { " " })] [InlineData(" ", new object[] { null, null })] [InlineData(" ", new object[] { "", "" })] - public static void AppendJoin_NoSpareCapacity_ThrowsArgumentOutOfRangeException(string separator, object[] values) + public static void AppendJoin_NoSpareCapacity_ThrowsArgumentOutOfRangeException(string? separator, object[] values) { var builder = new StringBuilder(0, 5); builder.Append("Hello"); diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Type/TypeTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Type/TypeTests.cs index 221b03f1050ead..df5066f613ce9c 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Type/TypeTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Type/TypeTests.cs @@ -584,7 +584,7 @@ public void Delimiter() [InlineData(typeof(ushort), TypeCode.UInt16)] [InlineData(typeof(uint), TypeCode.UInt32)] [InlineData(typeof(ulong), TypeCode.UInt64)] - public void GetTypeCode_ValidType_ReturnsExpected(Type t, TypeCode typeCode) + public void GetTypeCode_ValidType_ReturnsExpected(Type? t, TypeCode typeCode) { Assert.Equal(typeCode, Type.GetTypeCode(t)); } diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt16Tests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt16Tests.cs index 6ddf7c3bfbaab1..bc5ffd25435887 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt16Tests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt16Tests.cs @@ -43,7 +43,7 @@ public static void MinValue() [InlineData((ushort)234, (ushort)456, -1)] [InlineData((ushort)234, ushort.MaxValue, -1)] [InlineData((ushort)234, null, 1)] - public void CompareTo_Other_ReturnsExpected(ushort i, object value, int expected) + public void CompareTo_Other_ReturnsExpected(ushort i, object? value, int expected) { if (value is ushort ushortValue) { @@ -68,7 +68,7 @@ public void CompareTo_ObjectNotUshort_ThrowsArgumentException(object value) [InlineData((ushort)789, null, false)] [InlineData((ushort)789, "789", false)] [InlineData((ushort)789, 789, false)] - public static void EqualsTest(ushort i1, object obj, bool expected) + public static void EqualsTest(ushort i1, object? obj, bool expected) { if (obj is ushort) { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt32Tests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt32Tests.cs index c2f80bba01dda7..ade9fe7664bec6 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt32Tests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt32Tests.cs @@ -44,7 +44,7 @@ public static void MinValue() [InlineData((uint)234, (uint)456, -1)] [InlineData((uint)234, uint.MaxValue, -1)] [InlineData((uint)234, null, 1)] - public void CompareTo_Other_ReturnsExpected(uint i, object value, int expected) + public void CompareTo_Other_ReturnsExpected(uint i, object? value, int expected) { if (value is uint uintValue) { @@ -69,7 +69,7 @@ public void CompareTo_ObjectNotUint_ThrowsArgumentException(object value) [InlineData((uint)789, null, false)] [InlineData((uint)789, "789", false)] [InlineData((uint)789, 789, false)] - public static void EqualsTest(uint i1, object obj, bool expected) + public static void EqualsTest(uint i1, object? obj, bool expected) { if (obj is uint) { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt64Tests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt64Tests.cs index 27efe49e48289e..2ef2bc24f5a3ef 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt64Tests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UInt64Tests.cs @@ -44,7 +44,7 @@ public static void MinValue() [InlineData((ulong)234, (ulong)456, -1)] [InlineData((ulong)234, ulong.MaxValue, -1)] [InlineData((ulong)234, null, 1)] - public void CompareTo_Other_ReturnsExpected(ulong i, object value, int expected) + public void CompareTo_Other_ReturnsExpected(ulong i, object? value, int expected) { if (value is ulong ulongValue) { @@ -69,7 +69,7 @@ public void CompareTo_ObjectNotUlong_ThrowsArgumentException(object value) [InlineData((ulong)789, null, false)] [InlineData((ulong)789, "789", false)] [InlineData((ulong)789, 789, false)] - public static void EqualsTest(ulong i1, object obj, bool expected) + public static void EqualsTest(ulong i1, object? obj, bool expected) { if (obj is ulong i2) { diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UIntPtrTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UIntPtrTests.cs index a1ff5ba221977e..8308860583f80b 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UIntPtrTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/UIntPtrTests.cs @@ -109,7 +109,7 @@ public static IEnumerable Equals_TestData() [Theory] [MemberData(nameof(Equals_TestData))] - public static void EqualsTest(nuint value, object obj, bool expected) + public static void EqualsTest(nuint value, object? obj, bool expected) { if (obj is nuint other) { @@ -232,7 +232,7 @@ public static void MinValue() [InlineData(234u, 456u, -1)] [InlineData(234u, uint.MaxValue, -1)] [InlineData(234u, null, 1)] - public static void CompareTo_Other_ReturnsExpected(uint i0, object value, int expected) + public static void CompareTo_Other_ReturnsExpected(uint i0, object? value, int expected) { nuint i = i0; if (value is uint uintValue) diff --git a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Uri.MethodsTests.cs b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Uri.MethodsTests.cs index 15dc2f84da28ae..7b42936a154ca2 100644 --- a/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Uri.MethodsTests.cs +++ b/src/libraries/System.Runtime/tests/System.Runtime.Tests/System/Uri.MethodsTests.cs @@ -161,7 +161,7 @@ public void CheckHostName(string name, UriHostNameType expected) [InlineData("!", false)] [InlineData("", false)] [InlineData(null, false)] - public void CheckSchemeName(string schemeName, bool expected) + public void CheckSchemeName(string? schemeName, bool expected) { Assert.Equal(expected, Uri.CheckSchemeName(schemeName)); } @@ -272,7 +272,7 @@ public void IsWellFormedOriginalString(string uriString, bool expected) [InlineData("file://C:/directory/filename", UriKind.RelativeOrAbsolute, false)] [InlineData("http:\\host/path/file", UriKind.RelativeOrAbsolute, false)] [InlineData(null, UriKind.RelativeOrAbsolute, false)] - public void IsWellFormedUriString(string uriString, UriKind uriKind, bool expected) + public void IsWellFormedUriString(string? uriString, UriKind uriKind, bool expected) { Assert.Equal(expected, Uri.IsWellFormedUriString(uriString, uriKind)); } diff --git a/src/libraries/System.Runtime/tests/System.Threading.Tasks.Extensions.Tests/PoolingAsyncValueTaskMethodBuilderTests.cs b/src/libraries/System.Runtime/tests/System.Threading.Tasks.Extensions.Tests/PoolingAsyncValueTaskMethodBuilderTests.cs index 62a6406c309b62..ce987a024f5b72 100644 --- a/src/libraries/System.Runtime/tests/System.Threading.Tasks.Extensions.Tests/PoolingAsyncValueTaskMethodBuilderTests.cs +++ b/src/libraries/System.Runtime/tests/System.Threading.Tasks.Extensions.Tests/PoolingAsyncValueTaskMethodBuilderTests.cs @@ -514,7 +514,7 @@ static async ValueTask ValueTaskAsync(int i) [InlineData(null)] [InlineData("1")] [InlineData("100")] - public void PoolingAsyncValueTasksBuilder_ObjectsPooled(string limitEnvVar) + public void PoolingAsyncValueTasksBuilder_ObjectsPooled(string? limitEnvVar) { // Use RemoteExecutor to launch a process with the right environment variables set var psi = new ProcessStartInfo(); diff --git a/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs b/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs index 4364e917eeac7a..102262dea7bd5f 100644 --- a/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs +++ b/src/libraries/System.Runtime/tests/System.Threading.Tasks.Tests/System.Runtime.CompilerServices/AsyncTaskMethodBuilderTests.cs @@ -386,7 +386,7 @@ public static void TaskMethodBuilderDecimal_DoesntUseCompletedCache() [Theory] [InlineData((string)null, true)] [InlineData("test", false)] - public static void TaskMethodBuilderRef_UsesCompletedCache(string result, bool shouldBeCached) + public static void TaskMethodBuilderRef_UsesCompletedCache(string? result, bool shouldBeCached) { TaskMethodBuilderT_UsesCompletedCache(result, shouldBeCached); } diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/Pkcs8PrivateKeyInfoTests.cs b/src/libraries/System.Security.Cryptography.Pkcs/tests/Pkcs8PrivateKeyInfoTests.cs index d688ac3a9c97d7..c1e21e5f86ee6d 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/Pkcs8PrivateKeyInfoTests.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/Pkcs8PrivateKeyInfoTests.cs @@ -334,7 +334,7 @@ public static void NullAlgorithm() [InlineData("0....0")] [InlineData("0.0...0")] [InlineData("potato")] - public static void InvalidAlgorithmId(string oidValue) + public static void InvalidAlgorithmId(string? oidValue) { Pkcs8PrivateKeyInfo info = new Pkcs8PrivateKeyInfo( new Oid(oidValue, "friendly name"), diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/Rfc3161/TimestampTokenTests.cs b/src/libraries/System.Security.Cryptography.Pkcs/tests/Rfc3161/TimestampTokenTests.cs index 7c570de2ca6c7b..f0a1161992f9b0 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/Rfc3161/TimestampTokenTests.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/Rfc3161/TimestampTokenTests.cs @@ -341,7 +341,7 @@ public static void CertMismatchIssuerAndSerialV1( public static void MatchV2( X509IncludeOption includeOption, SigningCertificateOption v2Option, - string hashAlgName) + string? hashAlgName) { CustomBuild_CertMatch( Certificates.ValidLookingTsaCert, @@ -361,7 +361,7 @@ public static void MatchV2( [InlineData(X509IncludeOption.None, "SHA1")] [InlineData(X509IncludeOption.WholeChain, "SHA384")] [InlineData(X509IncludeOption.None, "SHA384")] - public static void CertHashMismatchV2(X509IncludeOption includeOption, string hashAlgName) + public static void CertHashMismatchV2(X509IncludeOption includeOption, string? hashAlgName) { CustomBuild_CertMismatch( Certificates.ValidLookingTsaCert, @@ -417,7 +417,7 @@ public static void CertMismatchIssuerAndSerialV2( X509IncludeOption includeOption, SigningCertificateOption v2Option, SubjectIdentifierType identifierType, - string hashAlgName) + string? hashAlgName) { CustomBuild_CertMismatch( Certificates.ValidLookingTsaCert, @@ -514,7 +514,7 @@ public static void CertMatchV1AndV2( X509IncludeOption includeOption, SigningCertificateOption v1Option, SigningCertificateOption v2Option, - string hashAlgName) + string? hashAlgName) { CustomBuild_CertMatch( Certificates.ValidLookingTsaCert, @@ -561,7 +561,7 @@ public static void CertMismatchV1OrV2( SigningCertificateOption v1Option, SigningCertificateOption v2Option, SubjectIdentifierType identifierType, - string hashAlgName) + string? hashAlgName) { CustomBuild_CertMismatch( Certificates.ValidLookingTsaCert, diff --git a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.cs b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.cs index b1d0d480c05b12..262584ee9e4bc3 100644 --- a/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.cs +++ b/src/libraries/System.Security.Cryptography.Pkcs/tests/SignedCms/SignedCmsTests.cs @@ -1501,7 +1501,7 @@ public static void CheckSignature_Pkcs1_Sha1_Declared_Sha256WithRsa() [InlineData(" 1.1", "010100", null)] [InlineData("1.1 ", "010100", null)] [InlineData("1 1", "010100", null)] - public static void SignIdentifiedContent_BadOid(string oidValueIn, string contentHex, string oidValueOut) + public static void SignIdentifiedContent_BadOid(string? oidValueIn, string contentHex, string? oidValueOut) { SignedCms signedCms = new SignedCms( new ContentInfo(new Oid(oidValueIn, "Some Friendly Name"), contentHex.HexToByteArray())); diff --git a/src/libraries/System.Security.Cryptography.ProtectedData/tests/ProtectedDataTests.cs b/src/libraries/System.Security.Cryptography.ProtectedData/tests/ProtectedDataTests.cs index 90153dc500d735..bf470951100b49 100644 --- a/src/libraries/System.Security.Cryptography.ProtectedData/tests/ProtectedDataTests.cs +++ b/src/libraries/System.Security.Cryptography.ProtectedData/tests/ProtectedDataTests.cs @@ -14,7 +14,7 @@ public abstract class ProtectedDataTests [Theory] [InlineData(null)] [InlineData(new byte[] { 4, 5, 6 })] - public void RoundTrip(byte[] entropy) + public void RoundTrip(byte[]? entropy) { foreach (DataProtectionScope scope in new[] { DataProtectionScope.CurrentUser, DataProtectionScope.LocalMachine }) { @@ -49,7 +49,7 @@ public void ProtectEmptyData(DataProtectionScope scope, bool useEntropy) [InlineData(null, new byte[] { 4, 5, 6 })] [InlineData(new byte[] { 4, 5, 6 }, null)] [InlineData(new byte[] { 4, 5, 6 }, new byte[] { 4, 5, 7 })] - public void WrongEntropy(byte[] entropy1, byte[] entropy2) + public void WrongEntropy(byte[]? entropy1, byte[]? entropy2) { foreach (DataProtectionScope scope in new[] { DataProtectionScope.CurrentUser, DataProtectionScope.LocalMachine }) { diff --git a/src/libraries/System.Security.Cryptography/tests/X509Certificates/CollectionTests.cs b/src/libraries/System.Security.Cryptography/tests/X509Certificates/CollectionTests.cs index a9ac4e821539a1..cb53f557be2e24 100644 --- a/src/libraries/System.Security.Cryptography/tests/X509Certificates/CollectionTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/X509Certificates/CollectionTests.cs @@ -1805,7 +1805,7 @@ public static void ExportPkcs12_Pkcs12ExportPbeParameters_ArgValidation() [InlineData((PbeEncryptionAlgorithm)(-1), nameof(HashAlgorithmName.SHA1))] public static void ExportPkcs12_PbeParameters_ArgValidation( PbeEncryptionAlgorithm encryptionAlgorithm, - string hashAlgorithm) + string? hashAlgorithm) { X509Certificate2Collection collection = []; PbeParameters badParameters = new(encryptionAlgorithm, new HashAlgorithmName(hashAlgorithm), 1); diff --git a/src/libraries/System.Security.Cryptography/tests/X509Certificates/ExportTests.cs b/src/libraries/System.Security.Cryptography/tests/X509Certificates/ExportTests.cs index 70eb3214bf858c..e3a6a1e61f0ab3 100644 --- a/src/libraries/System.Security.Cryptography/tests/X509Certificates/ExportTests.cs +++ b/src/libraries/System.Security.Cryptography/tests/X509Certificates/ExportTests.cs @@ -276,7 +276,7 @@ public static void ExportPkcs12_Pkcs12ExportPbeParameters_ArgValidation() [InlineData((PbeEncryptionAlgorithm)(-1), nameof(HashAlgorithmName.SHA1))] public static void ExportPkcs12_PbeParameters_ArgValidation( PbeEncryptionAlgorithm encryptionAlgorithm, - string hashAlgorithm) + string? hashAlgorithm) { using (X509Certificate2 cert = new(TestData.PfxData, TestData.PfxDataPassword)) { diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/InlineCategoriesDocumentTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/InlineCategoriesDocumentTests.cs index 071a74d94a5254..7e821de655e2f9 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/InlineCategoriesDocumentTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/InlineCategoriesDocumentTests.cs @@ -131,7 +131,7 @@ public void CreateCategory_Invoke_ReturnsExpected() [InlineData("name", "http://www.w3.org/2000/xmlns/", "value", "version")] [InlineData("type", "ns", "value", "version")] [InlineData("name", "http://www.w3.org/2001/XMLSchema-instance", "value", "version")] - public void TryParseAttribute_Invoke_ReturnsFalse(string name, string ns, string value, string version) + public void TryParseAttribute_Invoke_ReturnsFalse(string? name, string? ns, string? value, string? version) { var document = new InlineCategoriesDocumentSubclass(); Assert.False(document.TryParseAttributeEntryPoint(name, ns, value, version)); @@ -146,7 +146,7 @@ public static IEnumerable TryParseElement_TestData() [Theory] [MemberData(nameof(TryParseElement_TestData))] - public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version) + public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string? version) { var document = new InlineCategoriesDocumentSubclass(); Assert.False(document.TryParseElementEntryPoint(reader, version)); @@ -156,7 +156,7 @@ public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteAttributeExtensions_Invoke_ReturnsExpected(string version) + public void WriteAttributeExtensions_Invoke_ReturnsExpected(string? version) { var document = new InlineCategoriesDocumentSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => document.WriteAttributeExtensionsEntryPoint(writer, version)); @@ -178,7 +178,7 @@ public void WriteAttributeExtensions_NullWriter_ThrowsArgumentNullException() [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteElementExtensions_Invoke_ReturnsExpected(string version) + public void WriteElementExtensions_Invoke_ReturnsExpected(string? version) { var document = new InlineCategoriesDocumentSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => document.WriteElementExtensionsEntryPoint(writer, version)); diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ReferencedCategoriesDocumentTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ReferencedCategoriesDocumentTests.cs index a06d9bee7216d0..dda7ac070f8d9a 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ReferencedCategoriesDocumentTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ReferencedCategoriesDocumentTests.cs @@ -124,7 +124,7 @@ public void Categories_SetNullItem_ThrowsArgumentNullException() [InlineData("name", "http://www.w3.org/2000/xmlns/", "value", "version")] [InlineData("type", "ns", "value", "version")] [InlineData("name", "http://www.w3.org/2001/XMLSchema-instance", "value", "version")] - public void TryParseAttribute_Invoke_ReturnsFalse(string name, string ns, string value, string version) + public void TryParseAttribute_Invoke_ReturnsFalse(string? name, string? ns, string? value, string? version) { var document = new ReferencedCategoriesDocumentSubclass(); Assert.False(document.TryParseAttributeEntryPoint(name, ns, value, version)); @@ -139,7 +139,7 @@ public static IEnumerable TryParseElement_TestData() [Theory] [MemberData(nameof(TryParseElement_TestData))] - public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version) + public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string? version) { var document = new ReferencedCategoriesDocumentSubclass(); Assert.False(document.TryParseElementEntryPoint(reader, version)); @@ -149,7 +149,7 @@ public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteAttributeExtensions_Invoke_ReturnsExpected(string version) + public void WriteAttributeExtensions_Invoke_ReturnsExpected(string? version) { var document = new ReferencedCategoriesDocumentSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => document.WriteAttributeExtensionsEntryPoint(writer, version)); @@ -171,7 +171,7 @@ public void WriteAttributeExtensions_NullWriter_ThrowsArgumentNullException() [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteElementExtensions_Invoke_ReturnsExpected(string version) + public void WriteElementExtensions_Invoke_ReturnsExpected(string? version) { var document = new ReferencedCategoriesDocumentSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => document.WriteElementExtensionsEntryPoint(writer, version)); diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ResourceCollectionInfoTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ResourceCollectionInfoTests.cs index b301dadedabd05..86ef9cd52f7249 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ResourceCollectionInfoTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ResourceCollectionInfoTests.cs @@ -248,7 +248,7 @@ public void CreateReferencedCategoriesDocument_Invoke_ReturnsExpected() [InlineData("name", "http://www.w3.org/2000/xmlns/", "value", "version")] [InlineData("type", "ns", "value", "version")] [InlineData("name", "http://www.w3.org/2001/XMLSchema-instance", "value", "version")] - public void TryParseAttribute_Invoke_ReturnsFalse(string name, string ns, string value, string version) + public void TryParseAttribute_Invoke_ReturnsFalse(string? name, string? ns, string? value, string? version) { var collectionInfo = new ResourceCollectionInfoSubclass(); Assert.False(collectionInfo.TryParseAttributeEntryPoint(name, ns, value, version)); @@ -273,7 +273,7 @@ public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteAttributeExtensions_Invoke_ReturnsExpected(string version) + public void WriteAttributeExtensions_Invoke_ReturnsExpected(string? version) { var collectionInfo = new ResourceCollectionInfoSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => collectionInfo.WriteAttributeExtensionsEntryPoint(writer, version)); @@ -295,7 +295,7 @@ public void WriteAttributeExtensions_NullWriter_ThrowsArgumentNullException() [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteElementExtensions_Invoke_ReturnsExpected(string version) + public void WriteElementExtensions_Invoke_ReturnsExpected(string? version) { var collectionInfo = new ResourceCollectionInfoSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => collectionInfo.WriteElementExtensionsEntryPoint(writer, version)); diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ServiceDocumentTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ServiceDocumentTests.cs index bc39ffaba44a63..226b53c045e068 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ServiceDocumentTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/ServiceDocumentTests.cs @@ -102,7 +102,7 @@ public void Workspaces_SetNullItem_ThrowsArgumentNullException() [InlineData("name", "http://www.w3.org/2000/xmlns/", "value", "version")] [InlineData("type", "ns", "value", "version")] [InlineData("name", "http://www.w3.org/2001/XMLSchema-instance", "value", "version")] - public void TryParseAttribute_Invoke_ReturnsFalse(string name, string ns, string value, string version) + public void TryParseAttribute_Invoke_ReturnsFalse(string? name, string? ns, string? value, string? version) { var document = new ServiceDocumentSubclass(); Assert.False(document.TryParseAttributeEntryPoint(name, ns, value, version)); @@ -117,7 +117,7 @@ public static IEnumerable TryParseElement_TestData() [Theory] [MemberData(nameof(TryParseElement_TestData))] - public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version) + public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string? version) { var document = new ServiceDocumentSubclass(); Assert.False(document.TryParseElementEntryPoint(reader, version)); @@ -127,7 +127,7 @@ public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteAttributeExtensions_Invoke_ReturnsExpected(string version) + public void WriteAttributeExtensions_Invoke_ReturnsExpected(string? version) { var document = new ServiceDocumentSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => document.WriteAttributeExtensionsEntryPoint(writer, version)); @@ -149,7 +149,7 @@ public void WriteAttributeExtensions_NullWriter_ThrowsArgumentNullException() [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteElementExtensions_Invoke_ReturnsExpected(string version) + public void WriteElementExtensions_Invoke_ReturnsExpected(string? version) { var document = new ServiceDocumentSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => document.WriteElementExtensionsEntryPoint(writer, version)); diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationCategoryTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationCategoryTests.cs index a7ca29f8b99e62..693fd704decfca 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationCategoryTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationCategoryTests.cs @@ -26,7 +26,7 @@ public void Ctor_Default() [InlineData(null)] [InlineData("")] [InlineData("name")] - public void Ctor_String(string name) + public void Ctor_String(string? name) { var category = new SyndicationCategory(name); Assert.Empty(category.AttributeExtensions); @@ -40,7 +40,7 @@ public void Ctor_String(string name) [InlineData(null, null, null)] [InlineData("", "", "")] [InlineData("name", "scheme", "label")] - public void Ctor_String_String_String(string name, string scheme, string label) + public void Ctor_String_String_String(string? name, string? scheme, string? label) { var category = new SyndicationCategory(name, scheme, label); Assert.Empty(category.AttributeExtensions); @@ -130,7 +130,7 @@ public void Clone_Empty_ReturnsExpected() [InlineData("name", "http://www.w3.org/2000/xmlns/", "value", "version")] [InlineData("type", "ns", "value", "version")] [InlineData("name", "http://www.w3.org/2001/XMLSchema-instance", "value", "version")] - public void TryParseAttribute_Invoke_ReturnsFalse(string name, string ns, string value, string version) + public void TryParseAttribute_Invoke_ReturnsFalse(string? name, string? ns, string? value, string? version) { var category = new SyndicationCategorySubclass(); Assert.False(category.TryParseAttributeEntryPoint(name, ns, value, version)); @@ -145,7 +145,7 @@ public static IEnumerable TryParseElement_TestData() [Theory] [MemberData(nameof(TryParseElement_TestData))] - public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version) + public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string? version) { var category = new SyndicationCategorySubclass(); Assert.False(category.TryParseElementEntryPoint(reader, version)); @@ -155,7 +155,7 @@ public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteAttributeExtensions_Invoke_ReturnsExpected(string version) + public void WriteAttributeExtensions_Invoke_ReturnsExpected(string? version) { var category = new SyndicationCategorySubclass(); CompareHelper.AssertEqualWriteOutput("", writer => category.WriteAttributeExtensionsEntryPoint(writer, version)); @@ -177,7 +177,7 @@ public void WriteAttributeExtensions_NullWriter_ThrowsArgumentNullException() [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteElementExtensions_Invoke_ReturnsExpected(string version) + public void WriteElementExtensions_Invoke_ReturnsExpected(string? version) { var category = new SyndicationCategorySubclass(); CompareHelper.AssertEqualWriteOutput("", writer => category.WriteElementExtensionsEntryPoint(writer, version)); diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationContentTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationContentTests.cs index 9b07ba9340e6b2..6cbc3325791338 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationContentTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationContentTests.cs @@ -89,7 +89,7 @@ public void WriteTo_NullWriter_ThrowsArgumentNullException() [Theory] [InlineData(null)] [InlineData("")] - public void WriteTo_EmptyOrNullName_ThrowsArgumentException(string outerElementName) + public void WriteTo_EmptyOrNullName_ThrowsArgumentException(string? outerElementName) { var content = new SyndicationContentSubclass(); using (var stringWriter = new StringWriter()) @@ -103,7 +103,7 @@ public void WriteTo_EmptyOrNullName_ThrowsArgumentException(string outerElementN [InlineData(null)] [InlineData("")] [InlineData("content")] - public void CreateHtmlContent_Invoke_ReturnsExpected(string content) + public void CreateHtmlContent_Invoke_ReturnsExpected(string? content) { TextSyndicationContent syndicationContent = SyndicationContent.CreateHtmlContent(content); Assert.Empty(syndicationContent.AttributeExtensions); @@ -115,7 +115,7 @@ public void CreateHtmlContent_Invoke_ReturnsExpected(string content) [InlineData(null)] [InlineData("")] [InlineData("content")] - public void CreatePlainContent_Invoke_ReturnsExpected(string content) + public void CreatePlainContent_Invoke_ReturnsExpected(string? content) { TextSyndicationContent syndicationContent = SyndicationContent.CreatePlaintextContent(content); Assert.Empty(syndicationContent.AttributeExtensions); @@ -127,7 +127,7 @@ public void CreatePlainContent_Invoke_ReturnsExpected(string content) [InlineData(null)] [InlineData("")] [InlineData("content")] - public void CreateXhtmlContent_Invoke_ReturnsExpected(string content) + public void CreateXhtmlContent_Invoke_ReturnsExpected(string? content) { TextSyndicationContent syndicationContent = SyndicationContent.CreateXhtmlContent(content); Assert.Empty(syndicationContent.AttributeExtensions); diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationElementExtensionCollectionTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationElementExtensionCollectionTests.cs index a8b352822cfc7a..09608540635763 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationElementExtensionCollectionTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationElementExtensionCollectionTests.cs @@ -164,7 +164,7 @@ public void ReadElementExtensions_Invoke_ReturnsExpected() [InlineData("SyndicationElementExtensionCollectionTests.extensionobject", "http://schemas.datacontract.org/2004/07/System.ServiceModel.Syndication.Tests")] [InlineData("SyndicationElementExtensionCollectionTests.ExtensionObject", "http://schemas.datacontract.org/2004/07/system.servicemodel.syndication.tests")] [InlineData("SyndicationElementExtensionCollectionTests.ExtensionObject", "System.ServiceModel.Syndication.Tests")] - public void ReadElementExtensions_NoSuchObject_ReturnsEmpty(string name, string ns) + public void ReadElementExtensions_NoSuchObject_ReturnsEmpty(string name, string? ns) { SyndicationElementExtensionCollection elementExtensions = new SyndicationCategory().ElementExtensions; elementExtensions.Add(new ExtensionObject { Value = 10 }); diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationElementExtensionTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationElementExtensionTests.cs index e7d57bb2c2d214..4bbe2269b9cf53 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationElementExtensionTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationElementExtensionTests.cs @@ -104,7 +104,7 @@ public void Ctor_DataContractExtension_XmlObjectSerializer(XmlObjectSerializer s [InlineData(null, "outerNamespace")] [InlineData("outerName", "")] [InlineData("outerName", "outerNamespace")] - public void Ctor_String_String_Object(string outerName, string outerNamespace) + public void Ctor_String_String_Object(string? outerName, string? outerNamespace) { var extensionObject = new ExtensionObject { Value = 10 }; @@ -134,7 +134,7 @@ public void Ctor_String_String_Object(string outerName, string outerNamespace) [InlineData(null, "outerNamespace")] [InlineData("outerName", "")] [InlineData("outerName", "outerNamespace")] - public void Ctor_String_String_Object_XmlObjectSerializer(string outerName, string outerNamespace) + public void Ctor_String_String_Object_XmlObjectSerializer(string? outerName, string? outerNamespace) { var extensionObject = new ExtensionObject { Value = 10 }; diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationFeedTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationFeedTests.cs index 280929d010f955..67c30bd13eaf66 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationFeedTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationFeedTests.cs @@ -28,7 +28,7 @@ public static IEnumerable Ctor_Items_TestData() [Theory] [InlineData(null)] [MemberData(nameof(Ctor_Items_TestData))] - public void Ctor_Items(IEnumerable items) + public void Ctor_Items(IEnumerable? items) { var feed = new SyndicationFeed(items); VerifySyndicationFeed(feed, null, null, null, null, default, items); @@ -313,7 +313,7 @@ public void CreatePerson_Invoke_ReturnsExpected() [InlineData("name", "http://www.w3.org/2000/xmlns/", "value", "version")] [InlineData("type", "ns", "value", "version")] [InlineData("name", "http://www.w3.org/2001/XMLSchema-instance", "value", "version")] - public void TryParseAttribute_Invoke_ReturnsFalse(string name, string ns, string value, string version) + public void TryParseAttribute_Invoke_ReturnsFalse(string? name, string? ns, string? value, string? version) { var feed = new SyndicationFeedSubclass(); Assert.False(feed.TryParseAttributeEntryPoint(name, ns, value, version)); @@ -328,7 +328,7 @@ public static IEnumerable TryParseElement_TestData() [Theory] [MemberData(nameof(TryParseElement_TestData))] - public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version) + public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string? version) { var feed = new SyndicationFeedSubclass(); Assert.False(feed.TryParseElementEntryPoint(reader, version)); @@ -338,7 +338,7 @@ public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteAttributeExtensions_Invoke_ReturnsExpected(string version) + public void WriteAttributeExtensions_Invoke_ReturnsExpected(string? version) { var feed = new SyndicationFeedSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => feed.WriteAttributeExtensionsEntryPoint(writer, version)); @@ -360,7 +360,7 @@ public void WriteAttributeExtensions_NullWriter_ThrowsArgumentNullException() [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteElementExtensions_Invoke_ReturnsExpected(string version) + public void WriteElementExtensions_Invoke_ReturnsExpected(string? version) { var feed = new SyndicationFeedSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => feed.WriteElementExtensionsEntryPoint(writer, version)); diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationItemTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationItemTests.cs index e5f8f7842d8bde..3076afebb46083 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationItemTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationItemTests.cs @@ -506,7 +506,7 @@ public void CreatePerson_Invoke_ReturnsExpected() [InlineData("name", "http://www.w3.org/2000/xmlns/", "value", "version")] [InlineData("type", "ns", "value", "version")] [InlineData("name", "http://www.w3.org/2001/XMLSchema-instance", "value", "version")] - public void TryParseAttribute_Invoke_ReturnsFalse(string name, string ns, string value, string version) + public void TryParseAttribute_Invoke_ReturnsFalse(string? name, string? ns, string? value, string? version) { var item = new SyndicationItemSubclass(); Assert.False(item.TryParseAttributeEntryPoint(name, ns, value, version)); @@ -537,7 +537,7 @@ public static IEnumerable TryParseElement_TestData() [Theory] [MemberData(nameof(TryParseElement_TestData))] - public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version) + public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string? version) { var item = new SyndicationItemSubclass(); Assert.False(item.TryParseElementEntryPoint(reader, version)); @@ -547,7 +547,7 @@ public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteAttributeExtensions_Invoke_ReturnsExpected(string version) + public void WriteAttributeExtensions_Invoke_ReturnsExpected(string? version) { var item = new SyndicationItemSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => item.WriteAttributeExtensionsEntryPoint(writer, version)); @@ -569,7 +569,7 @@ public void WriteAttributeExtensions_NullWriter_ThrowsArgumentNullException() [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteElementExtensions_Invoke_ReturnsExpected(string version) + public void WriteElementExtensions_Invoke_ReturnsExpected(string? version) { var item = new SyndicationItemSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => item.WriteElementExtensionsEntryPoint(writer, version)); diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationLinkTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationLinkTests.cs index 6ed01307e0cfa4..13ddf7b9508a16 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationLinkTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationLinkTests.cs @@ -319,7 +319,7 @@ public void GetAbsoluteUri_Invoke_ReturnsExpected(SyndicationLink link, Uri expe [InlineData("name", "http://www.w3.org/2000/xmlns/", "value", "version")] [InlineData("type", "ns", "value", "version")] [InlineData("name", "http://www.w3.org/2001/XMLSchema-instance", "value", "version")] - public void TryParseAttribute_Invoke_ReturnsFalse(string name, string ns, string value, string version) + public void TryParseAttribute_Invoke_ReturnsFalse(string? name, string? ns, string? value, string? version) { var link = new SyndicationLinkSubclass(); Assert.False(link.TryParseAttributeEntryPoint(name, ns, value, version)); @@ -334,7 +334,7 @@ public static IEnumerable TryParseElement_TestData() [Theory] [MemberData(nameof(TryParseElement_TestData))] - public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version) + public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string? version) { var link = new SyndicationLinkSubclass(); Assert.False(link.TryParseElementEntryPoint(reader, version)); @@ -344,7 +344,7 @@ public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteAttributeExtensions_Invoke_ReturnsExpected(string version) + public void WriteAttributeExtensions_Invoke_ReturnsExpected(string? version) { var link = new SyndicationLinkSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => link.WriteAttributeExtensionsEntryPoint(writer, version)); @@ -366,7 +366,7 @@ public void WriteAttributeExtensions_NullWriter_ThrowsArgumentNullException() [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteElementExtensions_Invoke_ReturnsExpected(string version) + public void WriteElementExtensions_Invoke_ReturnsExpected(string? version) { var link = new SyndicationLinkSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => link.WriteElementExtensionsEntryPoint(writer, version)); diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationPersonTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationPersonTests.cs index 0e1f1c84091f62..3a91e08ceaa71e 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationPersonTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/SyndicationPersonTests.cs @@ -26,7 +26,7 @@ public void Ctor_Default() [InlineData(null)] [InlineData("")] [InlineData("email")] - public void Ctor_String(string email) + public void Ctor_String(string? email) { var person = new SyndicationPerson(email); Assert.Empty(person.AttributeExtensions); @@ -40,7 +40,7 @@ public void Ctor_String(string email) [InlineData(null, null, null)] [InlineData("", "", "")] [InlineData("email", "name", "uri")] - public void Ctor_String_String_String(string email, string name, string uri) + public void Ctor_String_String_String(string? email, string? name, string? uri) { var person = new SyndicationPerson(email, name, uri); Assert.Empty(person.AttributeExtensions); @@ -130,7 +130,7 @@ public void Clone_Empty_ReturnsExpected() [InlineData("name", "http://www.w3.org/2000/xmlns/", "value", "version")] [InlineData("type", "ns", "value", "version")] [InlineData("name", "http://www.w3.org/2001/XMLSchema-instance", "value", "version")] - public void TryParseAttribute_Invoke_ReturnsFalse(string name, string ns, string value, string version) + public void TryParseAttribute_Invoke_ReturnsFalse(string? name, string? ns, string? value, string? version) { var person = new SyndicationPersonSubclass(); Assert.False(person.TryParseAttributeEntryPoint(name, ns, value, version)); @@ -145,7 +145,7 @@ public static IEnumerable TryParseElement_TestData() [Theory] [MemberData(nameof(TryParseElement_TestData))] - public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version) + public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string? version) { var person = new SyndicationPersonSubclass(); Assert.False(person.TryParseElementEntryPoint(reader, version)); @@ -155,7 +155,7 @@ public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteAttributeExtensions_Invoke_ReturnsExpected(string version) + public void WriteAttributeExtensions_Invoke_ReturnsExpected(string? version) { var person = new SyndicationPersonSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => person.WriteAttributeExtensionsEntryPoint(writer, version)); @@ -177,7 +177,7 @@ public void WriteAttributeExtensions_NullWriter_ThrowsArgumentNullException() [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteElementExtensions_Invoke_ReturnsExpected(string version) + public void WriteElementExtensions_Invoke_ReturnsExpected(string? version) { var person = new SyndicationPersonSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => person.WriteElementExtensionsEntryPoint(writer, version)); diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/TextSyndicationContentTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/TextSyndicationContentTests.cs index 1473201dfd3dd5..40f892dd0c8a79 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/TextSyndicationContentTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/TextSyndicationContentTests.cs @@ -12,7 +12,7 @@ public class TextSyndicationContentTests [InlineData(null)] [InlineData("")] [InlineData("text")] - public void Ctor_String(string text) + public void Ctor_String(string? text) { var content = new TextSyndicationContent(text); Assert.Empty(content.AttributeExtensions); @@ -24,7 +24,7 @@ public void Ctor_String(string text) [InlineData(null, TextSyndicationContentKind.Html, "html")] [InlineData("", TextSyndicationContentKind.Plaintext, "text")] [InlineData("text", TextSyndicationContentKind.XHtml, "xhtml")] - public void Ctor_String_TextSyndicationContentKind(string text, TextSyndicationContentKind textKind, string type) + public void Ctor_String_TextSyndicationContentKind(string? text, TextSyndicationContentKind textKind, string type) { var content = new TextSyndicationContent(text, textKind); Assert.Empty(content.AttributeExtensions); diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/WorkspaceTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/WorkspaceTests.cs index 78e30ffea3b39a..0759c1c0489d03 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/WorkspaceTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/WorkspaceTests.cs @@ -134,7 +134,7 @@ public void CreateResoureCollection_Invoke_ReturnsExpected() [InlineData("name", "http://www.w3.org/2000/xmlns/", "value", "version")] [InlineData("type", "ns", "value", "version")] [InlineData("name", "http://www.w3.org/2001/XMLSchema-instance", "value", "version")] - public void TryParseAttribute_Invoke_ReturnsFalse(string name, string ns, string value, string version) + public void TryParseAttribute_Invoke_ReturnsFalse(string? name, string? ns, string? value, string? version) { var workspace = new WorkspaceSubclass(); Assert.False(workspace.TryParseAttributeEntryPoint(name, ns, value, version)); @@ -159,7 +159,7 @@ public void TryParseElement_Invoke_ReturnsFalse(XmlReader reader, string version [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteAttributeExtensions_Invoke_ReturnsExpected(string version) + public void WriteAttributeExtensions_Invoke_ReturnsExpected(string? version) { var workspace = new WorkspaceSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => workspace.WriteAttributeExtensionsEntryPoint(writer, version)); @@ -181,7 +181,7 @@ public void WriteAttributeExtensions_NullWriter_ThrowsArgumentNullException() [InlineData(null)] [InlineData("")] [InlineData("version")] - public void WriteElementExtensions_Invoke_ReturnsExpected(string version) + public void WriteElementExtensions_Invoke_ReturnsExpected(string? version) { var workspace = new WorkspaceSubclass(); CompareHelper.AssertEqualWriteOutput("", writer => workspace.WriteElementExtensionsEntryPoint(writer, version)); diff --git a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/XmlSyndicationContentTests.cs b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/XmlSyndicationContentTests.cs index 72653c47447200..57658c1639b9c0 100644 --- a/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/XmlSyndicationContentTests.cs +++ b/src/libraries/System.ServiceModel.Syndication/tests/System/ServiceModel/Syndication/XmlSyndicationContentTests.cs @@ -65,7 +65,7 @@ public void Ctor_NullReader_ThrowsArgumentNullException() [InlineData(null)] [InlineData("")] [InlineData("text/html")] - public void Ctor_Type_SyndicationElementExtension(string type) + public void Ctor_Type_SyndicationElementExtension(string? type) { var extension = new SyndicationElementExtension(new ExtensionObject { Value = 10 }); var content = new XmlSyndicationContent(type, extension); diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonDocumentTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonDocumentTests.cs index 4657992d53f03b..73babaa84b4ade 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonDocumentTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonDocumentTests.cs @@ -1861,7 +1861,7 @@ public static void CheckInvalidString() [InlineData("\"hello\" ", "hello")] [InlineData(" null ", (string)null)] [InlineData("\"\\u0033\\u0031\"", "31")] - public static void ReadString(string json, string expectedValue) + public static void ReadString(string json, string? expectedValue) { using (JsonDocument doc = JsonDocument.Parse(json)) { diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonPropertyTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonPropertyTests.cs index 7642aa43b294ee..881af3f439d74e 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonPropertyTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/JsonPropertyTests.cs @@ -96,7 +96,7 @@ private static void AssertContents(string expectedValue, ArrayBufferWriter [InlineData("hello")] [InlineData("")] [InlineData(null)] - public static void NameEquals_InvalidInstance_Throws(string text) + public static void NameEquals_InvalidInstance_Throws(string? text) { string ErrorMessage = new InvalidOperationException().Message; JsonProperty prop = default; diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CustomConverterTests/CustomConverterTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CustomConverterTests/CustomConverterTests.cs index 42fdc3549e5500..e4f0a01895261e 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CustomConverterTests/CustomConverterTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/CustomConverterTests/CustomConverterTests.cs @@ -251,7 +251,7 @@ private sealed class InvalidJsonConverterFactory : JsonConverterFactory [InlineData(typeof(JsonStringEnumConverter), null)] [InlineData(typeof(InvalidJsonConverterFactory), null)] [InlineData(typeof(TestFactory), null)] - public static void JsonConverter_TypeProperty_ReturnsExpectedResult(Type converterType, Type expectedType) + public static void JsonConverter_TypeProperty_ReturnsExpectedResult(Type converterType, Type? expectedType) { var converter = (JsonConverter)Activator.CreateInstance(converterType)!; Assert.Equal(expectedType, converter.Type); diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ReadValueTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ReadValueTests.cs index 55a581e52b9a88..75495a030646e2 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ReadValueTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/ReadValueTests.cs @@ -385,7 +385,7 @@ public class SimpleTypeWithArray [InlineData("true", typeof(bool), true)] [InlineData("false", typeof(bool), false)] [InlineData("\"my string\"", typeof(string), "my string")] - public static void Primitives(string jsonString, Type type, object expected) + public static void Primitives(string jsonString, Type type, object? expected) { byte[] utf8 = Encoding.UTF8.GetBytes(jsonString); @@ -406,7 +406,7 @@ public static void Primitives(string jsonString, Type type, object expected) [InlineData("true", typeof(bool), true)] [InlineData("false", typeof(bool), false)] [InlineData("\"my string\"", typeof(string), "my string")] - public static void PrimitivesMultiSegment(string jsonString, Type type, object expected) + public static void PrimitivesMultiSegment(string jsonString, Type type, object? expected) { byte[] utf8 = Encoding.UTF8.GetBytes(jsonString); ReadOnlySequence sequence = JsonTestHelper.CreateSegments(utf8); diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs index b4ea57a41297c5..6195032db8082b 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Utf8JsonReaderTests.TryGet.cs @@ -1005,7 +1005,7 @@ public static void InvalidConversion() [InlineData("[\"\\u0030\\u0031\\u0032\\u0033\\u0034\\u0035\", \"\\u0000\\u002B\", \"a\\u005C\\u0072b\", \"a\\\\u005C\\u0072b\", \"a\\u008E\\u008Fb\", \"a\\uD803\\uDE6Db\", \"a\\uD834\\uDD1Eb\", \"a\\\\uD834\\\\uDD1Eb\"]")] [InlineData("{\"message\":\"Hello /a/b/c \\/ \\r\\b\\n\\f\\t\\/\"}")] [InlineData(null)] // Large randomly generated string - public static void TestingGetString(string jsonString) + public static void TestingGetString(string? jsonString) { if (jsonString == null) { diff --git a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/GeneratedRegexAttributeTests.cs b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/GeneratedRegexAttributeTests.cs index 1997be9e66d5aa..b353211e5ef8d4 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/GeneratedRegexAttributeTests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/FunctionalTests/GeneratedRegexAttributeTests.cs @@ -12,7 +12,7 @@ public class GeneratedRegexAttributeTests [InlineData(null, RegexOptions.None, Timeout.Infinite)] [InlineData("", (RegexOptions)12345, -2)] [InlineData("a.*b", RegexOptions.Compiled | RegexOptions.CultureInvariant, 1)] - public void Ctor_Roundtrips(string pattern, RegexOptions options, int matchTimeoutMilliseconds) + public void Ctor_Roundtrips(string? pattern, RegexOptions options, int matchTimeoutMilliseconds) { GeneratedRegexAttribute a; diff --git a/src/libraries/System.Text.RegularExpressions/tests/UnitTests/RegexPrefixAnalyzerTests.cs b/src/libraries/System.Text.RegularExpressions/tests/UnitTests/RegexPrefixAnalyzerTests.cs index 783b45e9d3c980..5ef0a80fa1f9c6 100644 --- a/src/libraries/System.Text.RegularExpressions/tests/UnitTests/RegexPrefixAnalyzerTests.cs +++ b/src/libraries/System.Text.RegularExpressions/tests/UnitTests/RegexPrefixAnalyzerTests.cs @@ -120,7 +120,7 @@ public void FindFirstCharClass_StressDeep() [InlineData("(?i)((abc){4,8}|(def){2,3})", new[] { "abcabcab", "defdef" }, true)] [InlineData("(?i)((abc){4,8}|(de+f){2,3})", new[] { "abcabcab", "de" }, true)] [InlineData("(?i)((ab{2}c){4,8}|(de+f){2,3})", new[] { "abbcabbc", "de" }, true)] - public void FindPrefixes(string pattern, string[] expectedSet, bool ignoreCase) + public void FindPrefixes(string pattern, string[]? expectedSet, bool ignoreCase) { RegexTree tree = RegexParser.Parse(pattern, RegexOptions.None, CultureInfo.InvariantCulture); string[] actual = RegexPrefixAnalyzer.FindPrefixes(tree.Root, ignoreCase); diff --git a/src/libraries/System.Threading.AccessControl/tests/EventWaitHandleAclTests.cs b/src/libraries/System.Threading.AccessControl/tests/EventWaitHandleAclTests.cs index 61cd59035b780d..08c4ffa1b9bd00 100644 --- a/src/libraries/System.Threading.AccessControl/tests/EventWaitHandleAclTests.cs +++ b/src/libraries/System.Threading.AccessControl/tests/EventWaitHandleAclTests.cs @@ -26,7 +26,7 @@ public void EventWaitHandle_Create_NullSecurity() [Theory] [InlineData(null)] [InlineData("")] - public void EventWaitHandle_Create_NameMultipleNew(string name) + public void EventWaitHandle_Create_NameMultipleNew(string? name) { EventWaitHandleSecurity security = GetBasicEventWaitHandleSecurity(); diff --git a/src/libraries/System.Threading.AccessControl/tests/MutexAclTests.cs b/src/libraries/System.Threading.AccessControl/tests/MutexAclTests.cs index 3f90570f68dffb..9354f74fa43f14 100644 --- a/src/libraries/System.Threading.AccessControl/tests/MutexAclTests.cs +++ b/src/libraries/System.Threading.AccessControl/tests/MutexAclTests.cs @@ -21,7 +21,7 @@ public void Mutex_Create_NullSecurity() [Theory] [InlineData(null)] [InlineData("")] - public void Mutex_Create_NameMultipleNew(string name) + public void Mutex_Create_NameMultipleNew(string? name) { MutexSecurity security = GetBasicMutexSecurity(); diff --git a/src/libraries/System.Threading.AccessControl/tests/SemaphoreAclTests.cs b/src/libraries/System.Threading.AccessControl/tests/SemaphoreAclTests.cs index ab3b171d0c53a9..3c085bad3459bb 100644 --- a/src/libraries/System.Threading.AccessControl/tests/SemaphoreAclTests.cs +++ b/src/libraries/System.Threading.AccessControl/tests/SemaphoreAclTests.cs @@ -46,7 +46,7 @@ public void Semaphore_Create_InvalidCounts(int initialCount, int maximumCount) [Theory] [InlineData(null)] [InlineData("")] - public void Semaphore_Create_NameMultipleNew(string name) + public void Semaphore_Create_NameMultipleNew(string? name) { SemaphoreSecurity security = GetBasicSemaphoreSecurity(); bool expectedCreatedNew = true; diff --git a/src/libraries/System.Transactions.Local/tests/AsyncTransactionScopeTests.cs b/src/libraries/System.Transactions.Local/tests/AsyncTransactionScopeTests.cs index ff5c050292fcff..c8470d61419659 100644 --- a/src/libraries/System.Transactions.Local/tests/AsyncTransactionScopeTests.cs +++ b/src/libraries/System.Transactions.Local/tests/AsyncTransactionScopeTests.cs @@ -437,7 +437,7 @@ public void AsyncTSTest(int variation) [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [InlineData(true, false, null)] [InlineData(true, true, null)] - public void AsyncTSAndDependantClone(bool requiresNew, bool synchronizeScope, string txId) + public void AsyncTSAndDependantClone(bool requiresNew, bool synchronizeScope, string? txId) { string txId1 = null; string txId2 = null; @@ -527,7 +527,7 @@ public void AsyncTSAndDependantClone(bool requiresNew, bool synchronizeScope, st [ConditionalTheory(typeof(PlatformDetection), nameof(PlatformDetection.IsThreadingSupported))] [InlineData(true, false, null)] [InlineData(true, true, null)] - public void NestedAsyncTSAndDependantClone(bool parentrequiresNew, bool childRequiresNew, string txId) + public void NestedAsyncTSAndDependantClone(bool parentrequiresNew, bool childRequiresNew, string? txId) { string txId1; string txId2; diff --git a/src/libraries/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs b/src/libraries/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs index fb4494072cba6c..5fd9f488da4999 100644 --- a/src/libraries/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs +++ b/src/libraries/System.Web.HttpUtility/tests/HttpUtility/HttpUtilityTest.cs @@ -57,7 +57,7 @@ public class HttpUtilityTest [Theory] [InlineData(null, null)] [MemberData(nameof(HtmlAttributeEncodeData))] - public void HtmlAttributeEncode(string expected, string input) + public void HtmlAttributeEncode(string? expected, string? input) { Assert.Equal(expected, HttpUtility.HtmlAttributeEncode(input)); } @@ -74,7 +74,7 @@ public void HtmlAttributeEncode_TextWriter_null() [Theory] [InlineData("", null)] [MemberData(nameof(HtmlAttributeEncodeData))] - public void HtmlAttributeEncode_TextWriter(string expected, string input) + public void HtmlAttributeEncode_TextWriter(string expected, string? input) { var sw = new StringWriter(); HttpUtility.HtmlAttributeEncode(input, sw); @@ -261,7 +261,7 @@ private sealed class NullToString [InlineData(2, "2")] [InlineData("", "")] [InlineData(null, null)] - public void HtmlEncode(object decoded, string encoded) + public void HtmlEncode(object? decoded, string? encoded) { if (decoded is string s) { @@ -635,7 +635,7 @@ public static IEnumerable UrlEncodeData [Theory] [InlineData(null, null)] [MemberData(nameof(UrlEncodeData))] - public void UrlEncode(string decoded, string encoded) + public void UrlEncode(string? decoded, string? encoded) { Assert.Equal(encoded, HttpUtility.UrlEncode(decoded)); } @@ -781,7 +781,7 @@ public void UrlEncodeUnicodeToBytes(string decoded, string encoded) [InlineData("mailto:user@example.net", "mailto:user@example.net")] [InlineData("http://example\u200E.net/", "http://example%e2%80%8e.net/")] [InlineData("http://ex ample\u200E.net/", "http://ex%20ample%e2%80%8e.net/")] - public void UrlPathEncode(string decoded, string encoded) + public void UrlPathEncode(string? decoded, string? encoded) { Assert.Equal(encoded, HttpUtility.UrlPathEncode(decoded)); } diff --git a/src/libraries/System.Windows.Extensions/tests/System/Media/SoundPlayerTests.cs b/src/libraries/System.Windows.Extensions/tests/System/Media/SoundPlayerTests.cs index 815b7bf479b4fb..8622866a3f95ba 100644 --- a/src/libraries/System.Windows.Extensions/tests/System/Media/SoundPlayerTests.cs +++ b/src/libraries/System.Windows.Extensions/tests/System/Media/SoundPlayerTests.cs @@ -67,7 +67,7 @@ public void Ctor_String(string soundLocation) [Theory] [InlineData(null)] [InlineData("")] - public void Ctor_NullOrEmptyString_ThrowsArgumentException(string soundLocation) + public void Ctor_NullOrEmptyString_ThrowsArgumentException(string? soundLocation) { AssertExtensions.Throws("path", null, () => new SoundPlayer(soundLocation)); } @@ -372,7 +372,7 @@ public void SoundLocation_SetValid_Success(string soundLocation) [Theory] [InlineData(null)] [InlineData("")] - public void SoundLocation_SetNullOrEmpty_ThrowsArgumentException(string soundLocation) + public void SoundLocation_SetNullOrEmpty_ThrowsArgumentException(string? soundLocation) { var player = new SoundPlayer() { SoundLocation = soundLocation }; Assert.Equal("", player.SoundLocation); @@ -423,7 +423,7 @@ public void Stream_SetValid_Success(Stream stream) [Theory] [InlineData(null)] [InlineData("tag")] - public void Tag_Set_GetReturnsExpected(object value) + public void Tag_Set_GetReturnsExpected(object? value) { var player = new SoundPlayer { Tag = value }; Assert.Equal(value, player.Tag); From 1597e3b5971ab88bcaa49b1334402114780f8573 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 31 Jul 2025 17:34:21 +0000 Subject: [PATCH 03/10] Fix xUnit1037: There are fewer theory data type arguments than required by the parameters of the test method --- .../tests/Extensions/TypeNameHelperTest.cs | 4 +- .../System/Net/Http/HttpProtocolTests.cs | 63 ++++++++----------- .../System/Net/Http/ResponseStreamTest.cs | 2 +- .../tests/Tests}/TheoryDataExtensions.cs | 2 + .../tests/ConfigurationManagerTest.cs | 2 +- ...iceCollectionKeyedServiceExtensionsTest.cs | 16 ++--- .../ServiceCollectionServiceExtensionsTest.cs | 12 ++-- .../ServiceLookup/CallSiteFactoryTest.cs | 16 ++--- .../tests/DI.Tests/ServiceTableTest.cs | 2 +- .../tests/ExclusionFilterTests.cs | 2 +- .../OptionsTest.cs | 4 +- .../tests/StringSegmentTest.cs | 4 +- .../StreamPipeReaderReadAtLeastAsyncTests.cs | 4 +- .../UnitTests/TranscodingReadStreamTests.cs | 8 +-- .../UnitTests/TranscodingWriteStreamTests.cs | 4 +- ...urces.Extensions.BinaryFormat.Tests.csproj | 1 + .../Directory/CreateDirectory.cs | 3 +- ...ileSystem.DisabledFileLocking.Tests.csproj | 1 + .../FileSystemTest.cs | 19 +++--- .../System.IO.FileSystem.Tests.csproj | 1 + 20 files changed, 81 insertions(+), 89 deletions(-) rename src/libraries/{System.Resources.Extensions/tests/BinaryFormatTests/Legacy => Common/tests/Tests}/TheoryDataExtensions.cs (97%) diff --git a/src/libraries/Common/tests/Extensions/TypeNameHelperTest.cs b/src/libraries/Common/tests/Extensions/TypeNameHelperTest.cs index a187cfd4888a77..54f4d29387849e 100644 --- a/src/libraries/Common/tests/Extensions/TypeNameHelperTest.cs +++ b/src/libraries/Common/tests/Extensions/TypeNameHelperTest.cs @@ -176,7 +176,7 @@ public void Can_pretty_print_open_generics(Type type, bool fullName, string expe Assert.Equal(expected, TypeNameHelper.GetTypeDisplayName(type, fullName)); } - public static TheoryData GetTypeDisplayName_IncludesGenericParameterNamesWhenOptionIsSetData => + public static TheoryData GetTypeDisplayName_IncludesGenericParameterNamesWhenOptionIsSetData => new TheoryData { { typeof(B<>),"Microsoft.Extensions.Internal.TypeNameHelperTest+B" }, @@ -196,7 +196,7 @@ public void GetTypeDisplayName_IncludesGenericParameterNamesWhenOptionIsSet(Type Assert.Equal(expected, actual); } - public static TheoryData GetTypeDisplayName_WithoutFullName_IncludesGenericParameterNamesWhenOptionIsSetData => + public static TheoryData GetTypeDisplayName_WithoutFullName_IncludesGenericParameterNamesWhenOptionIsSetData => new TheoryData { { typeof(B<>),"B" }, diff --git a/src/libraries/Common/tests/System/Net/Http/HttpProtocolTests.cs b/src/libraries/Common/tests/System/Net/Http/HttpProtocolTests.cs index 9c1838a2ea9225..0d3f460d586dd5 100644 --- a/src/libraries/Common/tests/System/Net/Http/HttpProtocolTests.cs +++ b/src/libraries/Common/tests/System/Net/Http/HttpProtocolTests.cs @@ -287,44 +287,33 @@ await TestHelper.WhenAllCompletedOrAnyFailed( }, new LoopbackServer.Options { StreamWrapper = GetStream }); } - public static IEnumerable GetInvalidStatusLine() - { - yield return "HTTP/1.1 2345"; - yield return "HTTP/A.1 200 OK"; - yield return "HTTP/X.Y.Z 200 OK"; - - yield return "HTTP/0.1 200 OK"; - yield return "HTTP/3.5 200 OK"; - yield return "HTTP/1.12 200 OK"; - yield return "HTTP/12.1 200 OK"; - yield return "HTTP/1.1 200 O\rK"; - - yield return "HTTP/1.A 200 OK"; - yield return "HTTP/1.1 "; - yield return "HTTP/1.1 !11"; - yield return "HTTP/1.1 a11"; - yield return "HTTP/1.1 abc"; - yield return "HTTP/1.1\t\t"; - yield return "HTTP/1.1\t"; - yield return "HTTP/1.1 "; - - yield return "HTTP/1.1 200OK"; - yield return "HTTP/1.1 20c"; - yield return "HTTP/1.1 23"; - yield return "HTTP/1.1 2bc"; - - yield return "NOTHTTP/1.1"; - yield return "HTTP 1.1 200 OK"; - yield return "ABCD/1.1 200 OK"; - yield return "HTTP/1.1"; - yield return "HTTP\\1.1 200 OK"; - yield return "NOTHTTP/1.1 200 OK"; - } - - public static TheoryData InvalidStatusLine = GetInvalidStatusLine().ToTheoryData(); - [Theory] - [MemberData(nameof(InvalidStatusLine))] + [InlineData("HTTP/1.1 2345")] + [InlineData("HTTP/A.1 200 OK")] + [InlineData("HTTP/X.Y.Z 200 OK")] + [InlineData("HTTP/0.1 200 OK")] + [InlineData("HTTP/3.5 200 OK")] + [InlineData("HTTP/1.12 200 OK")] + [InlineData("HTTP/12.1 200 OK")] + [InlineData("HTTP/1.1 200 O\rK")] + [InlineData("HTTP/1.A 200 OK")] + [InlineData("HTTP/1.1 ")] + [InlineData("HTTP/1.1 !11")] + [InlineData("HTTP/1.1 a11")] + [InlineData("HTTP/1.1 abc")] + [InlineData("HTTP/1.1\t\t")] + [InlineData("HTTP/1.1\t")] + [InlineData("HTTP/1.1 ")] + [InlineData("HTTP/1.1 200OK")] + [InlineData("HTTP/1.1 20c")] + [InlineData("HTTP/1.1 23")] + [InlineData("HTTP/1.1 2bc")] + [InlineData("NOTHTTP/1.1")] + [InlineData("HTTP 1.1 200 OK")] + [InlineData("ABCD/1.1 200 OK")] + [InlineData("HTTP/1.1")] + [InlineData("HTTP\\1.1 200 OK")] + [InlineData("NOTHTTP/1.1 200 OK")] public async Task GetAsync_InvalidStatusLine_ThrowsException(string responseString) { await GetAsyncThrowsExceptionHelper(responseString); diff --git a/src/libraries/Common/tests/System/Net/Http/ResponseStreamTest.cs b/src/libraries/Common/tests/System/Net/Http/ResponseStreamTest.cs index 786ee3c4ccf6ad..306a362ec5d32f 100644 --- a/src/libraries/Common/tests/System/Net/Http/ResponseStreamTest.cs +++ b/src/libraries/Common/tests/System/Net/Http/ResponseStreamTest.cs @@ -487,7 +487,7 @@ public async Task BrowserHttpHandler_StreamingRequest_ThrowFromContentCopy_Reque } } - public static TheoryData CancelRequestReadFunctions + public static TheoryData CancelRequestReadFunctions => new TheoryData { { false, 0, false }, diff --git a/src/libraries/System.Resources.Extensions/tests/BinaryFormatTests/Legacy/TheoryDataExtensions.cs b/src/libraries/Common/tests/Tests/TheoryDataExtensions.cs similarity index 97% rename from src/libraries/System.Resources.Extensions/tests/BinaryFormatTests/Legacy/TheoryDataExtensions.cs rename to src/libraries/Common/tests/Tests/TheoryDataExtensions.cs index ab5df917fdb5fd..dcc2e9e35b7ddb 100644 --- a/src/libraries/System.Resources.Extensions/tests/BinaryFormatTests/Legacy/TheoryDataExtensions.cs +++ b/src/libraries/Common/tests/Tests/TheoryDataExtensions.cs @@ -1,6 +1,8 @@ // Licensed to the .NET Foundation under one or more agreements. // The .NET Foundation licenses this file to you under the MIT license. +using System.Collections.Generic; + namespace Xunit; internal static class TheoryDataExtensions diff --git a/src/libraries/Microsoft.Extensions.Configuration/tests/ConfigurationManagerTest.cs b/src/libraries/Microsoft.Extensions.Configuration/tests/ConfigurationManagerTest.cs index 7f2ca2877a48f8..0455727a1f848c 100644 --- a/src/libraries/Microsoft.Extensions.Configuration/tests/ConfigurationManagerTest.cs +++ b/src/libraries/Microsoft.Extensions.Configuration/tests/ConfigurationManagerTest.cs @@ -196,7 +196,7 @@ public async Task ProviderCanBlockLoadWaitingOnConcurrentRead() await loadTask; } - public static TheoryData ConcurrentReadActions + public static TheoryData> ConcurrentReadActions { get { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceCollectionKeyedServiceExtensionsTest.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceCollectionKeyedServiceExtensionsTest.cs index 681336a0a4d542..4255cca0549e60 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceCollectionKeyedServiceExtensionsTest.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceCollectionKeyedServiceExtensionsTest.cs @@ -13,7 +13,7 @@ public class ServiceCollectionKeyedServiceExtensionsTest { private static readonly FakeService _instance = new FakeService(); - public static TheoryData AddImplementationTypeData + public static TheoryData, Type, object, Type, ServiceLifetime> AddImplementationTypeData { get { @@ -61,7 +61,7 @@ public void AddWithTypeAddsServiceWithRightLifecyle(Action a Assert.Equal(lifeCycle, descriptor.Lifetime); } - public static TheoryData AddImplementationFactoryData + public static TheoryData, Type, object, Type, ServiceLifetime> AddImplementationFactoryData { get { @@ -109,7 +109,7 @@ public void AddWithFactoryAddsServiceWithRightLifecyle( Assert.Equal(lifeCycle, descriptor.Lifetime); } - public static TheoryData AddSingletonData + public static TheoryData> AddSingletonData { get { @@ -158,7 +158,7 @@ public void TryAddNoOpFailsIfExists(Action addAction) Assert.Equal(ServiceLifetime.Singleton, descriptor.Lifetime); } - public static TheoryData TryAddImplementationTypeData + public static TheoryData, Type, object, Type, ServiceLifetime> TryAddImplementationTypeData { get { @@ -256,7 +256,7 @@ public void TryAddIfMissingActuallyAdds() Assert.Equal(ServiceLifetime.Transient, descriptor.Lifetime); } - public static TheoryData TryAddEnumerableImplementationTypeData + public static TheoryData, Type, object, Type, ServiceLifetime> TryAddEnumerableImplementationTypeData { get { @@ -327,7 +327,7 @@ public void TryAddEnumerable_DoesNotAddDuplicate( Assert.Equal(expectedLifetime, d.Lifetime); } - public static TheoryData TryAddEnumerableInvalidImplementationTypeData + public static TheoryData TryAddEnumerableInvalidImplementationTypeData { get { @@ -489,7 +489,7 @@ public void RemoveAll_RemovesAllMatchingServicesWhenKeyIsInt() Assert.Equal(new[] { descriptor }, collection); } - public static TheoryData NullServiceKeyData + public static TheoryData NullServiceKeyData { get { @@ -520,7 +520,7 @@ public void NullServiceKey_IsKeyedServiceFalse(ServiceDescriptor serviceDescript Assert.Throws(() => serviceDescriptor.KeyedImplementationFactory); } - public static TheoryData NotNullServiceKeyData + public static TheoryData NotNullServiceKeyData { get { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceCollectionServiceExtensionsTest.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceCollectionServiceExtensionsTest.cs index 3acb7de6679db0..fd5f3c201e5f4a 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceCollectionServiceExtensionsTest.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceCollectionServiceExtensionsTest.cs @@ -12,7 +12,7 @@ public class ServiceCollectionServiceExtensionsTest { private static readonly FakeService _instance = new FakeService(); - public static TheoryData AddImplementationTypeData + public static TheoryData, Type, Type, ServiceLifetime> AddImplementationTypeData { get { @@ -58,7 +58,7 @@ public void AddWithTypeAddsServiceWithRightLifecyle(Action a Assert.Equal(lifeCycle, descriptor.Lifetime); } - public static TheoryData AddImplementationFactoryData + public static TheoryData, Type, Type, ServiceLifetime> AddImplementationFactoryData { get { @@ -104,7 +104,7 @@ public void AddWithFactoryAddsServiceWithRightLifecyle( Assert.Equal(lifeCycle, descriptor.Lifetime); } - public static TheoryData AddSingletonData + public static TheoryData> AddSingletonData { get { @@ -152,7 +152,7 @@ public void TryAddNoOpFailsIfExists(Action addAction) Assert.Equal(ServiceLifetime.Singleton, descriptor.Lifetime); } - public static TheoryData TryAddImplementationTypeData + public static TheoryData, Type, Type, ServiceLifetime> TryAddImplementationTypeData { get { @@ -244,7 +244,7 @@ public void TryAddIfMissingActuallyAdds() Assert.Equal(ServiceLifetime.Transient, descriptor.Lifetime); } - public static TheoryData TryAddEnumerableImplementationTypeData + public static TheoryData TryAddEnumerableImplementationTypeData { get { @@ -310,7 +310,7 @@ public void TryAddEnumerable_DoesNotAddDuplicate( Assert.Equal(expectedLifetime, d.Lifetime); } - public static TheoryData TryAddEnumerableInvalidImplementationTypeData + public static TheoryData TryAddEnumerableInvalidImplementationTypeData { get { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceLookup/CallSiteFactoryTest.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceLookup/CallSiteFactoryTest.cs index 919dee6475909b..655fbe0c333017 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceLookup/CallSiteFactoryTest.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceLookup/CallSiteFactoryTest.cs @@ -423,8 +423,8 @@ public void CreateCallSite_ReturnsMatchingTypesThatMatchCorrectConstraints(Type Assert.Equal(matchingImplementationTypes, enumerableCall.ServiceCallSites.Select(scs => scs.ImplementationType).ToArray()); } - public static TheoryData CreateCallSite_PicksConstructorWithTheMostNumberOfResolvedParametersData => - new TheoryData, Type[]> + public static TheoryData, Type[]> CreateCallSite_PicksConstructorWithTheMostNumberOfResolvedParametersData => + new TheoryData, Type[]> { { typeof(TypeWithSupersetConstructors), @@ -508,11 +508,11 @@ public void CreateCallSite_ReturnsMatchingTypesThatMatchCorrectConstraints(Type [MemberData(nameof(CreateCallSite_PicksConstructorWithTheMostNumberOfResolvedParametersData))] private void CreateCallSite_PicksConstructorWithTheMostNumberOfResolvedParameters( Type type, - Func callSiteFactory, + Func callSiteFactory, Type[] expectedConstructorParameters) { // Act - var callSite = callSiteFactory(type); + var callSite = (ServiceCallSite)callSiteFactory(type); // Assert Assert.Equal(CallSiteResultCacheLocation.Dispose, callSite.Cache.Location); @@ -520,7 +520,7 @@ private void CreateCallSite_PicksConstructorWithTheMostNumberOfResolvedParameter Assert.Equal(expectedConstructorParameters, GetParameters(constructorCallSite)); } - public static TheoryData CreateCallSite_ConsidersConstructorsWithDefaultValuesData => + public static TheoryData, Type[]> CreateCallSite_ConsidersConstructorsWithDefaultValuesData => new TheoryData, Type[]> { { @@ -550,14 +550,14 @@ private void CreateCallSite_PicksConstructorWithTheMostNumberOfResolvedParameter [Theory] [MemberData(nameof(CreateCallSite_ConsidersConstructorsWithDefaultValuesData))] private void CreateCallSite_ConsidersConstructorsWithDefaultValues( - Func callSiteFactory, + Func callSiteFactory, Type[] expectedConstructorParameters) { // Arrange var type = typeof(TypeWithDefaultConstructorParameters); // Act - var callSite = callSiteFactory(type); + var callSite = (ServiceCallSite)callSiteFactory(type); // Assert Assert.Equal(CallSiteResultCacheLocation.Dispose, callSite.Cache.Location); @@ -636,7 +636,7 @@ public void CreateCallSite_ThrowsIfTypeHasNoConstructurWithResolvableParameters( ex.Message); } - public static TheoryData CreateCallSite_ThrowsIfMultipleNonOverlappingConstructorsCanBeResolvedData => + public static TheoryData, Type[][]> CreateCallSite_ThrowsIfMultipleNonOverlappingConstructorsCanBeResolvedData => new TheoryData, Type[][]> { { diff --git a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceTableTest.cs b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceTableTest.cs index b2843e39983639..13edb85cd2f329 100644 --- a/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceTableTest.cs +++ b/src/libraries/Microsoft.Extensions.DependencyInjection/tests/DI.Tests/ServiceTableTest.cs @@ -25,7 +25,7 @@ public void Constructor_WithImplementationType_ThrowsIfServiceTypeIsOpenGenericA AssertExtensions.Throws("descriptors", () => new CallSiteFactory(serviceDescriptors)); } - public static TheoryData Constructor_WithInstance_ThrowsIfServiceTypeIsOpenGenericData => + public static TheoryData Constructor_WithInstance_ThrowsIfServiceTypeIsOpenGenericData => new TheoryData { new List(), diff --git a/src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/ExclusionFilterTests.cs b/src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/ExclusionFilterTests.cs index 6afdb6faa12d77..f83cf015fc4c44 100644 --- a/src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/ExclusionFilterTests.cs +++ b/src/libraries/Microsoft.Extensions.FileProviders.Physical/tests/ExclusionFilterTests.cs @@ -42,7 +42,7 @@ public void FiltersExcludedDirectories(string dirname, FileAttributes attributes Assert.Equal(excluded, FileSystemInfoHelper.IsExcluded(dirInfo, filters)); } - public static TheoryData Combinations + public static TheoryData Combinations { get { diff --git a/src/libraries/Microsoft.Extensions.Options/tests/Microsoft.Extensions.Options.Tests/OptionsTest.cs b/src/libraries/Microsoft.Extensions.Options/tests/Microsoft.Extensions.Options.Tests/OptionsTest.cs index 52e4e1a69dce0a..a9a6348743f974 100644 --- a/src/libraries/Microsoft.Extensions.Options/tests/Microsoft.Extensions.Options.Tests/OptionsTest.cs +++ b/src/libraries/Microsoft.Extensions.Options/tests/Microsoft.Extensions.Options.Tests/OptionsTest.cs @@ -179,7 +179,7 @@ public void SingleValidateOnStartRegistrationTest() Assert.Equal(1, sc.Count(sd => sd.ServiceType == typeof(IStartupValidator))); } - public static TheoryData Configure_GetsNullableOptionsFromConfiguration_Data + public static TheoryData, IDictionary> Configure_GetsNullableOptionsFromConfiguration_Data { get { @@ -254,7 +254,7 @@ public void Configure_GetsNullableOptionsFromConfiguration( Assert.Collection(expectedValues, assertions.ToArray()); } - public static TheoryData Configure_GetsEnumOptionsFromConfiguration_Data + public static TheoryData, IDictionary> Configure_GetsEnumOptionsFromConfiguration_Data { get { diff --git a/src/libraries/Microsoft.Extensions.Primitives/tests/StringSegmentTest.cs b/src/libraries/Microsoft.Extensions.Primitives/tests/StringSegmentTest.cs index 1d45036a447bfe..edca22286c1f41 100644 --- a/src/libraries/Microsoft.Extensions.Primitives/tests/StringSegmentTest.cs +++ b/src/libraries/Microsoft.Extensions.Primitives/tests/StringSegmentTest.cs @@ -571,7 +571,7 @@ public void StringSegment_IsNullOrEmpty_Invalid() Assert.False(StringSegment.IsNullOrEmpty(new StringSegment("ABCDefg", 3, 2))); } - public static TheoryData GetHashCode_ReturnsSameValueForEqualSubstringsData => new TheoryData + public static TheoryData GetHashCode_ReturnsSameValueForEqualSubstringsData => new TheoryData { { default(StringSegment), default(StringSegment) }, { default(StringSegment), new StringSegment() }, @@ -593,7 +593,7 @@ public void GetHashCode_ReturnsSameValueForEqualSubstrings(StringSegment segment Assert.Equal(hashCode1, hashCode2); } - public static TheoryData GetHashCode_ReturnsDifferentValuesForInequalSubstringsData + public static TheoryData GetHashCode_ReturnsDifferentValuesForInequalSubstringsData { get { diff --git a/src/libraries/System.IO.Pipelines/tests/StreamPipeReaderReadAtLeastAsyncTests.cs b/src/libraries/System.IO.Pipelines/tests/StreamPipeReaderReadAtLeastAsyncTests.cs index 887f2057aab4c2..d8211e544c7f54 100644 --- a/src/libraries/System.IO.Pipelines/tests/StreamPipeReaderReadAtLeastAsyncTests.cs +++ b/src/libraries/System.IO.Pipelines/tests/StreamPipeReaderReadAtLeastAsyncTests.cs @@ -18,8 +18,8 @@ protected override void SetPipeReaderOptions(MemoryPool? pool = null, int } private static Func CustomPoolFunc = () => new DisposeTrackingBufferPool(); - public static TheoryData?, int, bool, bool> TestData => - new TheoryData?, int, bool, bool> + public static TheoryData TestData => + new TheoryData { // pool, bufferSize, isSingleSegment, isFromCustomPool { default, 1, true, false }, diff --git a/src/libraries/System.Net.Http.Json/tests/UnitTests/TranscodingReadStreamTests.cs b/src/libraries/System.Net.Http.Json/tests/UnitTests/TranscodingReadStreamTests.cs index 67fa25cd519789..03a82be803fd17 100644 --- a/src/libraries/System.Net.Http.Json/tests/UnitTests/TranscodingReadStreamTests.cs +++ b/src/libraries/System.Net.Http.Json/tests/UnitTests/TranscodingReadStreamTests.cs @@ -164,19 +164,19 @@ private static async Task ReadAsync_WithOverflowBufferAtCharBufferBoundaries(str } } - public static TheoryData ReadAsyncInputLatin(string encoding) + public static TheoryData ReadAsyncInputLatin(string encoding) { int maxCharBufferSize = Encoding.GetEncoding(encoding).GetMaxCharCount(TranscodingReadStream.MaxByteBufferSize); return GetLatinTextInput(maxCharBufferSize, TranscodingReadStream.MaxByteBufferSize); } - public static TheoryData ReadAsyncInputUnicode(string encoding) + public static TheoryData ReadAsyncInputUnicode(string encoding) { int maxCharBufferSize = Encoding.GetEncoding(encoding).GetMaxCharCount(TranscodingReadStream.MaxByteBufferSize); return GetUnicodeText(maxCharBufferSize); } - internal static TheoryData GetLatinTextInput(int maxCharBufferSize, int maxByteBufferSize) + internal static TheoryData GetLatinTextInput(int maxCharBufferSize, int maxByteBufferSize) { return new TheoryData { @@ -189,7 +189,7 @@ internal static TheoryData GetLatinTextInput(int maxCharBufferSize, int maxByteB }; } - internal static TheoryData GetUnicodeText(int maxCharBufferSize) + internal static TheoryData GetUnicodeText(int maxCharBufferSize) { return new TheoryData { diff --git a/src/libraries/System.Net.Http.Json/tests/UnitTests/TranscodingWriteStreamTests.cs b/src/libraries/System.Net.Http.Json/tests/UnitTests/TranscodingWriteStreamTests.cs index b5b32f6c8712eb..e600437808620e 100644 --- a/src/libraries/System.Net.Http.Json/tests/UnitTests/TranscodingWriteStreamTests.cs +++ b/src/libraries/System.Net.Http.Json/tests/UnitTests/TranscodingWriteStreamTests.cs @@ -17,10 +17,10 @@ namespace System.Net.Http.Json.Functional.Tests { public class TranscodingWriteStreamTest { - public static TheoryData WriteAsyncInputLatin => + public static TheoryData WriteAsyncInputLatin => TranscodingReadStreamTest.GetLatinTextInput(TranscodingWriteStream.MaxCharBufferSize, TranscodingWriteStream.MaxByteBufferSize); - public static TheoryData WriteAsyncInputUnicode => + public static TheoryData WriteAsyncInputUnicode => TranscodingReadStreamTest.GetUnicodeText(TranscodingWriteStream.MaxCharBufferSize); [Theory] diff --git a/src/libraries/System.Resources.Extensions/tests/BinaryFormatTests/System.Resources.Extensions.BinaryFormat.Tests.csproj b/src/libraries/System.Resources.Extensions/tests/BinaryFormatTests/System.Resources.Extensions.BinaryFormat.Tests.csproj index c77f6e932d59a7..878fc8c4bf0371 100644 --- a/src/libraries/System.Resources.Extensions/tests/BinaryFormatTests/System.Resources.Extensions.BinaryFormat.Tests.csproj +++ b/src/libraries/System.Resources.Extensions/tests/BinaryFormatTests/System.Resources.Extensions.BinaryFormat.Tests.csproj @@ -18,6 +18,7 @@ + diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Directory/CreateDirectory.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Directory/CreateDirectory.cs index 7ed023adca957b..44fce575b9cd58 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Directory/CreateDirectory.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/Directory/CreateDirectory.cs @@ -3,14 +3,13 @@ using System.Linq; using Microsoft.DotNet.RemoteExecutor; -using Microsoft.DotNet.XUnitExtensions; using Xunit; namespace System.IO.Tests { public class Directory_CreateDirectory : FileSystemTest { - public static TheoryData ReservedDeviceNames = IOInputs.GetReservedDeviceNames().ToTheoryData(); + public static TheoryData ReservedDeviceNames = IOInputs.GetReservedDeviceNames().ToTheoryData(); #region Utilities public virtual DirectoryInfo Create(string path) diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/System.IO.FileSystem.DisabledFileLocking.Tests.csproj b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/System.IO.FileSystem.DisabledFileLocking.Tests.csproj index 614de3d1ce979f..99ff042de2e779 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/System.IO.FileSystem.DisabledFileLocking.Tests.csproj +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/DisabledFileLockingTests/System.IO.FileSystem.DisabledFileLocking.Tests.csproj @@ -24,6 +24,7 @@ + diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileSystemTest.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileSystemTest.cs index e64022e95c2bb4..0c89d585c5ff01 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileSystemTest.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/FileSystemTest.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Diagnostics; -using Microsoft.DotNet.XUnitExtensions; using Xunit; namespace System.IO.Tests @@ -23,15 +22,15 @@ public abstract partial class FileSystemTest : FileCleanupTestBase public static TheoryData PathsWithInvalidColons = TestData.PathsWithInvalidColons; public static TheoryData PathsWithInvalidCharacters = TestData.PathsWithInvalidCharacters; public static TheoryData TrailingCharacters = TestData.TrailingCharacters; - public static TheoryData ValidPathComponentNames = IOInputs.GetValidPathComponentNames().ToTheoryData(); - public static TheoryData SimpleWhiteSpace = IOInputs.GetSimpleWhiteSpace().ToTheoryData(); - public static TheoryData WhiteSpace = IOInputs.GetWhiteSpace().ToTheoryData(); - public static TheoryData UncPathsWithoutShareName = IOInputs.GetUncPathsWithoutShareName().ToTheoryData(); - public static TheoryData PathsWithReservedDeviceNames = IOInputs.GetPathsWithReservedDeviceNames().ToTheoryData(); - public static TheoryData PathsWithColons = IOInputs.GetPathsWithColons().ToTheoryData(); - public static TheoryData PathsWithComponentLongerThanMaxComponent = IOInputs.GetPathsWithComponentLongerThanMaxComponent().ToTheoryData(); - public static TheoryData ControlWhiteSpace = IOInputs.GetControlWhiteSpace().ToTheoryData(); - public static TheoryData NonControlWhiteSpace = IOInputs.GetNonControlWhiteSpace().ToTheoryData(); + public static TheoryData ValidPathComponentNames = IOInputs.GetValidPathComponentNames().ToTheoryData(); + public static TheoryData SimpleWhiteSpace = IOInputs.GetSimpleWhiteSpace().ToTheoryData(); + public static TheoryData WhiteSpace = IOInputs.GetWhiteSpace().ToTheoryData(); + public static TheoryData UncPathsWithoutShareName = IOInputs.GetUncPathsWithoutShareName().ToTheoryData(); + public static TheoryData PathsWithReservedDeviceNames = IOInputs.GetPathsWithReservedDeviceNames().ToTheoryData(); + public static TheoryData PathsWithColons = IOInputs.GetPathsWithColons().ToTheoryData(); + public static TheoryData PathsWithComponentLongerThanMaxComponent = IOInputs.GetPathsWithComponentLongerThanMaxComponent().ToTheoryData(); + public static TheoryData ControlWhiteSpace = IOInputs.GetControlWhiteSpace().ToTheoryData(); + public static TheoryData NonControlWhiteSpace = IOInputs.GetNonControlWhiteSpace().ToTheoryData(); public static TheoryData TrailingSeparators { diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.csproj b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.csproj index 77100193a31e2a..86eda9fae42586 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.csproj +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/System.IO.FileSystem.Tests.csproj @@ -244,6 +244,7 @@ + From 54561d9fe924b76e762441ab3d5ed7ba9c63dfed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Fri, 1 Aug 2025 18:23:02 +0000 Subject: [PATCH 04/10] Fix xUnit1041: Fixture arguments to test classes must have fixture sources --- src/tests/GC/Scenarios/Rootmem/rootmem.cs | 2 +- src/tests/JIT/Methodical/Boxing/callconv/instance.cs | 2 +- src/tests/JIT/Regression/CLR-x86-JIT/V1-M09/b13621/b13621.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/tests/GC/Scenarios/Rootmem/rootmem.cs b/src/tests/GC/Scenarios/Rootmem/rootmem.cs index c2f27d70b29229..99a8ad98c8f9ec 100644 --- a/src/tests/GC/Scenarios/Rootmem/rootmem.cs +++ b/src/tests/GC/Scenarios/Rootmem/rootmem.cs @@ -80,7 +80,7 @@ public static int TestEntryPoint() return 1; } - public RootMem( int i ) + private RootMem( int i ) { if( i> 0) { diff --git a/src/tests/JIT/Methodical/Boxing/callconv/instance.cs b/src/tests/JIT/Methodical/Boxing/callconv/instance.cs index 69f035950619f4..0c70cc18945bc0 100644 --- a/src/tests/JIT/Methodical/Boxing/callconv/instance.cs +++ b/src/tests/JIT/Methodical/Boxing/callconv/instance.cs @@ -38,7 +38,7 @@ protected override object Fibonacci2(object num, object flag) return N; } - public Test(object num) + private Test(object num) { _num = (float)(double)num; } diff --git a/src/tests/JIT/Regression/CLR-x86-JIT/V1-M09/b13621/b13621.cs b/src/tests/JIT/Regression/CLR-x86-JIT/V1-M09/b13621/b13621.cs index 55a0e969f674a2..76841e69d2fc5e 100644 --- a/src/tests/JIT/Regression/CLR-x86-JIT/V1-M09/b13621/b13621.cs +++ b/src/tests/JIT/Regression/CLR-x86-JIT/V1-M09/b13621/b13621.cs @@ -32,7 +32,7 @@ public static void TestEntryPoint() } } - public RootMem(int i) + private RootMem(int i) { if (i > 0) { From 24a149aac942dd0b9c66caa66b78810421c3e587 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 3 Aug 2025 14:54:29 +0200 Subject: [PATCH 05/10] Fix xUnit1048: Avoid using 'async void' for test methods as it is deprecated in xUnit.net v3 --- .../CompressionStreamUnitTests.Brotli.cs | 2 +- .../tests/BinaryDataTests.cs | 4 +-- .../SslStreamOpenSslNamedKeysTests.manual.cs | 2 +- .../tests/FunctionalTests/DisconnectTest.cs | 4 +-- .../JavaScript/JSExportTest.cs | 2 +- .../File/AppendAllBytesAsync.cs | 6 ++-- .../Serialization/Stream.Collections.cs | 4 +-- .../Serialization/WriteValueTests.cs | 7 ++-- .../wasm/Wasm.Build.Tests/DllImportTests.cs | 10 +++--- .../FlagsChangeRebuildTest.cs | 3 +- .../NoopNativeRebuildTest.cs | 3 +- .../OptimizationFlagChangeTests.cs | 3 +- .../ReferenceNewAssemblyRebuildTest.cs | 3 +- .../SimpleSourceChangeRebuildTest.cs | 3 +- .../PInvokeTableGeneratorTests.cs | 16 ++++----- .../SatelliteAssembliesTests.cs | 5 +-- .../Templates/WasmTemplateTests.cs | 2 +- .../wasm/Wasm.Build.Tests/WasmBuildAppBase.cs | 3 +- .../wasm/Wasm.Build.Tests/WasmBuildAppTest.cs | 33 ++++++++++--------- .../WasmRunOutOfAppBundleTests.cs | 3 +- .../wasm/Wasm.Build.Tests/WasmSIMDTests.cs | 5 +-- 21 files changed, 67 insertions(+), 56 deletions(-) diff --git a/src/libraries/System.IO.Compression.Brotli/tests/CompressionStreamUnitTests.Brotli.cs b/src/libraries/System.IO.Compression.Brotli/tests/CompressionStreamUnitTests.Brotli.cs index 2fb9eacc9dfc3f..10f46a6ceb5e87 100644 --- a/src/libraries/System.IO.Compression.Brotli/tests/CompressionStreamUnitTests.Brotli.cs +++ b/src/libraries/System.IO.Compression.Brotli/tests/CompressionStreamUnitTests.Brotli.cs @@ -109,7 +109,7 @@ public void InvalidBrotliCompressionQuality() [Theory] [MemberData(nameof(UncompressedTestFilesBrotli))] - public async void BrotliCompressionQuality_SizeInOrder(string testFile) + public async Task BrotliCompressionQuality_SizeInOrder(string testFile) { using var uncompressedStream = await LocalMemoryStream.ReadAppFileAsync(testFile); diff --git a/src/libraries/System.Memory.Data/tests/BinaryDataTests.cs b/src/libraries/System.Memory.Data/tests/BinaryDataTests.cs index 43310364ff9250..6b69ec66631acb 100644 --- a/src/libraries/System.Memory.Data/tests/BinaryDataTests.cs +++ b/src/libraries/System.Memory.Data/tests/BinaryDataTests.cs @@ -710,7 +710,7 @@ public void ValidatesPositionValue() } [Fact] - public void CloseStreamValidation() + public async Task CloseStreamValidation() { byte[] buffer = "some data"u8.ToArray(); Stream stream = new BinaryData(buffer).ToStream(); @@ -719,7 +719,7 @@ public void CloseStreamValidation() Assert.Throws(() => stream.Position); Assert.Throws(() => stream.Seek(0, SeekOrigin.Begin)); Assert.Throws(() => stream.Read(buffer, 0, buffer.Length)); - Assert.ThrowsAsync(() => stream.ReadAsync(buffer, 0, buffer.Length)); + await Assert.ThrowsAsync(async () => await stream.ReadAsync(buffer, 0, buffer.Length)); Assert.Throws(() => stream.ReadByte()); Assert.Throws(() => stream.Length); Assert.False(stream.CanRead); diff --git a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamOpenSslNamedKeysTests.manual.cs b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamOpenSslNamedKeysTests.manual.cs index 4f844044c92222..853e749a1b2ccb 100644 --- a/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamOpenSslNamedKeysTests.manual.cs +++ b/src/libraries/System.Net.Security/tests/FunctionalTests/SslStreamOpenSslNamedKeysTests.manual.cs @@ -23,7 +23,7 @@ public static async Task Provider_TPM2SslStream_ServerCertIsTpmEcDsa() [ConditionalTheory(typeof(OpenSslNamedKeysHelpers), nameof(OpenSslNamedKeysHelpers.ShouldRunProviderRsaTests))] [MemberData(nameof(OpenSslNamedKeysHelpers.RSASignaturePaddingValues), MemberType = typeof(OpenSslNamedKeysHelpers))] - public static async void Provider_TPM2SslStream_ServerCertIsTpmRsa(RSASignaturePadding padding) + public static async Task Provider_TPM2SslStream_ServerCertIsTpmRsa(RSASignaturePadding padding) { using X509Certificate2 serverCert = CreateSelfSignedRsaCertificate(padding); CreateTlsOptionsForRsa(serverCert, out SslServerAuthenticationOptions serverOptions, out SslClientAuthenticationOptions clientOptions); diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs index 9fe7f43c703b29..43b5ac830a9f4b 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs @@ -87,12 +87,12 @@ public void Disconnect_NotConnected_ThrowsInvalidOperationException(bool reuseSo [Theory] [InlineData(true)] [InlineData(false)] - public void Disconnect_ObjectDisposed_ThrowsObjectDisposedException(bool reuseSocket) + public async Task Disconnect_ObjectDisposed_ThrowsObjectDisposedException(bool reuseSocket) { using (Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { s.Dispose(); - Assert.ThrowsAsync(async () => await DisconnectAsync(s, reuseSocket)); + await Assert.ThrowsAsync(async () => await DisconnectAsync(s, reuseSocket)); } } } diff --git a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSExportTest.cs b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSExportTest.cs index 2759cd89dfe47c..7e6364265b335b 100644 --- a/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSExportTest.cs +++ b/src/libraries/System.Runtime.InteropServices.JavaScript/tests/System.Runtime.InteropServices.JavaScript.UnitTests/System/Runtime/InteropServices/JavaScript/JSExportTest.cs @@ -438,7 +438,7 @@ public async Task InternalsVisibleToDoesntBreak() } [Fact] - public async void JSExportCompletedTaskReturnsResolvedPromise() + public async Task JSExportCompletedTaskReturnsResolvedPromise() { string result = await JavaScriptTestHelper.InvokeReturnCompletedTask(); Assert.Equal("resolved", result); diff --git a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/AppendAllBytesAsync.cs b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/AppendAllBytesAsync.cs index 89ef9b63f665de..00d591fdc7f232 100644 --- a/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/AppendAllBytesAsync.cs +++ b/src/libraries/System.Runtime/tests/System.IO.FileSystem.Tests/File/AppendAllBytesAsync.cs @@ -24,10 +24,10 @@ public async Task NullParametersAsync() } [Fact] - public void NonExistentPathAsync() + public async Task NonExistentPathAsync() { - Assert.ThrowsAsync(() => File.AppendAllBytesAsync(Path.Combine(TestDirectory, GetTestFileName(), GetTestFileName()), new byte[0])); - Assert.ThrowsAsync(() => File.AppendAllBytesAsync(Path.Combine(TestDirectory, GetTestFileName(), GetTestFileName()), ReadOnlyMemory.Empty)); + await Assert.ThrowsAsync(async () => await File.AppendAllBytesAsync(Path.Combine(TestDirectory, GetTestFileName(), GetTestFileName()), new byte[0])); + await Assert.ThrowsAsync(async () => await File.AppendAllBytesAsync(Path.Combine(TestDirectory, GetTestFileName(), GetTestFileName()), ReadOnlyMemory.Empty)); } [Fact] diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.Collections.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.Collections.cs index 8c7639a1bda8e6..350fb234f15ac9 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.Collections.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/Stream.Collections.cs @@ -369,11 +369,11 @@ public ImmutableStructWithStrings( [InlineData("}")] [InlineData("[")] [InlineData("]")] - public void DeserializeDictionaryStartsWithInvalidJson(string json) + public async Task DeserializeDictionaryStartsWithInvalidJson(string json) { foreach (Type type in CollectionTestTypes.DictionaryTypes()) { - Assert.ThrowsAsync(async () => + await Assert.ThrowsAsync(async () => { using (var memoryStream = new MemoryStream(Encoding.UTF8.GetBytes(json))) { diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/WriteValueTests.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/WriteValueTests.cs index 4ef060d1658286..78828487f3457c 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/WriteValueTests.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.Tests/Serialization/WriteValueTests.cs @@ -3,6 +3,7 @@ using System.IO; using System.Text.Encodings.Web; +using System.Threading.Tasks; using Xunit; namespace System.Text.Json.Serialization.Tests @@ -22,7 +23,7 @@ public static void NullWriterThrows() } [Fact] - public async static void NullInputTypeThrows() + public async static Task NullInputTypeThrows() { ArgumentException ex; Utf8JsonWriter writer = new Utf8JsonWriter(new MemoryStream()); @@ -44,7 +45,7 @@ public async static void NullInputTypeThrows() } [Fact] - public async static void NullValueWithValueTypeThrows() + public async static Task NullValueWithValueTypeThrows() { JsonException ex; @@ -63,7 +64,7 @@ public async static void NullValueWithValueTypeThrows() } [Fact] - public async static void NullValueWithNullableSuccess() + public async static Task NullValueWithNullableSuccess() { byte[] nullUtf8Literal = "null"u8.ToArray(); diff --git a/src/mono/wasm/Wasm.Build.Tests/DllImportTests.cs b/src/mono/wasm/Wasm.Build.Tests/DllImportTests.cs index 8f5dfcf0d9b7e3..dac78c679157ce 100644 --- a/src/mono/wasm/Wasm.Build.Tests/DllImportTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/DllImportTests.cs @@ -23,7 +23,7 @@ public DllImportTests(ITestOutputHelper output, SharedBuildPerTestClassFixture b [Theory] [BuildAndRun(aot: false)] - public async void NativeLibraryWithVariadicFunctions(Configuration config, bool aot) + public async Task NativeLibraryWithVariadicFunctions(Configuration config, bool aot) { ProjectInfo info = PrepareProjectForVariadicFunction(config, aot, "variadic"); ReplaceFile(Path.Combine("Common", "Program.cs"), Path.Combine(BuildEnvironment.TestAssetsPath, "EntryPoints", "PInvoke", "VariadicFunctions.cs")); @@ -43,7 +43,7 @@ public async void NativeLibraryWithVariadicFunctions(Configuration config, bool [Theory] [BuildAndRun()] - public async void DllImportWithFunctionPointersCompilesWithoutWarning(Configuration config, bool aot) + public async Task DllImportWithFunctionPointersCompilesWithoutWarning(Configuration config, bool aot) { ProjectInfo info = PrepareProjectForVariadicFunction(config, aot, "fnptr"); ReplaceFile(Path.Combine("Common", "Program.cs"), Path.Combine(BuildEnvironment.TestAssetsPath, "EntryPoints", "PInvoke", "DllImportNoWarning.cs")); @@ -62,7 +62,7 @@ public async void DllImportWithFunctionPointersCompilesWithoutWarning(Configurat [Theory] [BuildAndRun()] - public async void DllImportWithFunctionPointers_ForVariadicFunction_CompilesWithWarning(Configuration config, bool aot) + public async Task DllImportWithFunctionPointers_ForVariadicFunction_CompilesWithWarning(Configuration config, bool aot) { ProjectInfo info = PrepareProjectForVariadicFunction(config, aot, "fnptr_variadic"); ReplaceFile(Path.Combine("Common", "Program.cs"), Path.Combine(BuildEnvironment.TestAssetsPath, "EntryPoints", "PInvoke", "DllImportWarning.cs")); @@ -81,7 +81,7 @@ public async void DllImportWithFunctionPointers_ForVariadicFunction_CompilesWith [Theory] [BuildAndRun()] - public async void DllImportWithFunctionPointers_WarningsAsMessages(Configuration config, bool aot) + public async Task DllImportWithFunctionPointers_WarningsAsMessages(Configuration config, bool aot) { string extraProperties = "$(MSBuildWarningsAsMessage);WASM0001"; ProjectInfo info = CopyTestAsset(config, aot, TestAsset.WasmBasicTestApp, "fnptr", extraProperties: extraProperties); @@ -117,7 +117,7 @@ public void UnmanagedCallback_WithFunctionPointers_CompilesWithWarnings(Configur "with.per.iod", "with🚀unicode#" } })] - public async void CallIntoLibrariesWithNonAlphanumericCharactersInTheirNames(Configuration config, bool aot, string[] libraryNames) + public async Task CallIntoLibrariesWithNonAlphanumericCharactersInTheirNames(Configuration config, bool aot, string[] libraryNames) { var extraItems = @""; string extraProperties = aot ? string.Empty : "true"; diff --git a/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/FlagsChangeRebuildTest.cs b/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/FlagsChangeRebuildTest.cs index 76c55cf22287d2..2b1403b78e54d7 100644 --- a/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/FlagsChangeRebuildTest.cs +++ b/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/FlagsChangeRebuildTest.cs @@ -4,6 +4,7 @@ using System.IO; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using Wasm.Build.Tests; using Xunit; using Xunit.Abstractions; @@ -29,7 +30,7 @@ public FlagsChangeRebuildTests(ITestOutputHelper output, SharedBuildPerTestClass [Theory] [MemberData(nameof(FlagsChangesForNativeRelinkingData), parameters: /*aot*/ false)] [MemberData(nameof(FlagsChangesForNativeRelinkingData), parameters: /*aot*/ true)] - public async void ExtraEmccFlagsSetButNoRealChange(Configuration config, bool aot, string extraCFlags, string extraLDFlags) + public async Task ExtraEmccFlagsSetButNoRealChange(Configuration config, bool aot, string extraCFlags, string extraLDFlags) { ProjectInfo info = CopyTestAsset(config, aot, TestAsset.WasmBasicTestApp, "rebuild_flags"); BuildPaths paths = await FirstNativeBuildAndRun(info, config, aot, requestNativeRelink: true, invariant: false); diff --git a/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/NoopNativeRebuildTest.cs b/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/NoopNativeRebuildTest.cs index dada93b41b0701..00c6c25ecf6ed0 100644 --- a/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/NoopNativeRebuildTest.cs +++ b/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/NoopNativeRebuildTest.cs @@ -3,6 +3,7 @@ using System.Linq; using Wasm.Build.Tests; +using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; @@ -19,7 +20,7 @@ public NoopNativeRebuildTest(ITestOutputHelper output, SharedBuildPerTestClassFi [Theory] [MemberData(nameof(NativeBuildData))] - public async void NoOpRebuildForNativeBuilds(Configuration config, bool aot, bool nativeRelink, bool invariant) + public async Task NoOpRebuildForNativeBuilds(Configuration config, bool aot, bool nativeRelink, bool invariant) { ProjectInfo info = CopyTestAsset(config, aot, TestAsset.WasmBasicTestApp, "rebuild_noop"); BuildPaths paths = await FirstNativeBuildAndRun(info, config, aot, nativeRelink, invariant); diff --git a/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/OptimizationFlagChangeTests.cs b/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/OptimizationFlagChangeTests.cs index 1a06d0f6309c12..0bc203214df016 100644 --- a/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/OptimizationFlagChangeTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/OptimizationFlagChangeTests.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Threading.Tasks; using Wasm.Build.Tests; using Xunit; using Xunit.Abstractions; @@ -29,7 +30,7 @@ public OptimizationFlagChangeTests(ITestOutputHelper output, SharedBuildPerTestC [Theory] [MemberData(nameof(FlagsOnlyChangeData), parameters: /*aot*/ false)] [MemberData(nameof(FlagsOnlyChangeData), parameters: /*aot*/ true)] - public async void OptimizationFlagChange(Configuration config, bool aot, string cflags, string ldflags) + public async Task OptimizationFlagChange(Configuration config, bool aot, string cflags, string ldflags) { ProjectInfo info = CopyTestAsset(config, aot, TestAsset.WasmBasicTestApp, "rebuild_flags"); // force _WasmDevel=false, so we don't get -O0 but -O2 diff --git a/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/ReferenceNewAssemblyRebuildTest.cs b/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/ReferenceNewAssemblyRebuildTest.cs index 7f39761591054c..bc9d6a4cb5a59d 100644 --- a/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/ReferenceNewAssemblyRebuildTest.cs +++ b/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/ReferenceNewAssemblyRebuildTest.cs @@ -4,6 +4,7 @@ using System; using System.IO; using System.Linq; +using System.Threading.Tasks; using Wasm.Build.Tests; using Xunit; using Xunit.Abstractions; @@ -21,7 +22,7 @@ public ReferenceNewAssemblyRebuildTest(ITestOutputHelper output, SharedBuildPerT [Theory] [MemberData(nameof(NativeBuildData))] - public async void ReferenceNewAssembly(Configuration config, bool aot, bool nativeRelink, bool invariant) + public async Task ReferenceNewAssembly(Configuration config, bool aot, bool nativeRelink, bool invariant) { ProjectInfo info = CopyTestAsset(config, aot, TestAsset.WasmBasicTestApp, "rebuild_tasks"); BuildPaths paths = await FirstNativeBuildAndRun(info, config, aot, nativeRelink, invariant); diff --git a/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/SimpleSourceChangeRebuildTest.cs b/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/SimpleSourceChangeRebuildTest.cs index e7207e26600664..342fb537cf3ba6 100644 --- a/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/SimpleSourceChangeRebuildTest.cs +++ b/src/mono/wasm/Wasm.Build.Tests/NativeRebuildTests/SimpleSourceChangeRebuildTest.cs @@ -3,6 +3,7 @@ using System.IO; using System.Linq; +using System.Threading.Tasks; using Wasm.Build.Tests; using Xunit; using Xunit.Abstractions; @@ -20,7 +21,7 @@ public SimpleSourceChangeRebuildTest(ITestOutputHelper output, SharedBuildPerTes [Theory] [MemberData(nameof(NativeBuildData))] - public async void SimpleStringChangeInSource(Configuration config, bool aot, bool nativeRelink, bool invariant) + public async Task SimpleStringChangeInSource(Configuration config, bool aot, bool nativeRelink, bool invariant) { ProjectInfo info = CopyTestAsset(config, aot, TestAsset.WasmBasicTestApp, "rebuild_simple"); BuildPaths paths = await FirstNativeBuildAndRun(info, config, aot, nativeRelink, invariant); diff --git a/src/mono/wasm/Wasm.Build.Tests/PInvokeTableGeneratorTests.cs b/src/mono/wasm/Wasm.Build.Tests/PInvokeTableGeneratorTests.cs index bd1b23f3a88764..83824e78b04a6b 100644 --- a/src/mono/wasm/Wasm.Build.Tests/PInvokeTableGeneratorTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/PInvokeTableGeneratorTests.cs @@ -45,7 +45,7 @@ public void UnmanagedStructAndMethodIn_SameAssembly_WithoutDisableRuntimeMarshal [Theory] [BuildAndRun()] - public async void UnmanagedStructAndMethodIn_SameAssembly_WithDisableRuntimeMarshallingAttribute_ConsideredBlittable + public async Task UnmanagedStructAndMethodIn_SameAssembly_WithDisableRuntimeMarshallingAttribute_ConsideredBlittable (Configuration config, bool aot) { ProjectInfo info = PrepreProjectForBlittableTests( @@ -93,7 +93,7 @@ private ProjectInfo PrepreProjectForBlittableTests(Configuration config, bool ao [Theory] [MemberData(nameof(SeparateAssemblyWithDisableMarshallingAttributeTestData), parameters: Configuration.Debug)] [MemberData(nameof(SeparateAssemblyWithDisableMarshallingAttributeTestData), parameters: Configuration.Release)] - public async void UnmanagedStructsAreConsideredBlittableFromDifferentAssembly + public async Task UnmanagedStructsAreConsideredBlittableFromDifferentAssembly (Configuration config, bool aot, bool libraryHasAttribute, bool appHasAttribute, bool expectSuccess) { string extraProperties = aot ? string.Empty : "true"; @@ -132,7 +132,7 @@ public async void UnmanagedStructsAreConsideredBlittableFromDifferentAssembly [Theory] [BuildAndRun()] - public async void UnmanagedCallback_InFileType(Configuration config, bool aot) + public async Task UnmanagedCallback_InFileType(Configuration config, bool aot) { ProjectInfo info = CopyTestAsset(config, aot, TestAsset.WasmBasicTestApp, "cb_filetype"); string programRelativePath = Path.Combine("Common", "Program.cs"); @@ -151,7 +151,7 @@ public async void UnmanagedCallback_InFileType(Configuration config, bool aot) [Theory] [BuildAndRun()] - public async void UnmanagedCallersOnly_Namespaced(Configuration config, bool aot) + public async Task UnmanagedCallersOnly_Namespaced(Configuration config, bool aot) { ProjectInfo info = CopyTestAsset(config, aot, TestAsset.WasmBasicTestApp, "cb_namespace"); string programRelativePath = Path.Combine("Common", "Program.cs"); @@ -276,7 +276,7 @@ public void IcallWithOverloadedParametersAndEnum(Configuration config, bool aot) [Theory] [BuildAndRun(parameters: new object[] { "tr_TR.UTF-8" })] - public async void BuildNativeInNonEnglishCulture(Configuration config, bool aot, string culture) + public async Task BuildNativeInNonEnglishCulture(Configuration config, bool aot, string culture) { // Check that we can generate interp tables in non-english cultures // Prompted by https://github.com/dotnet/runtime/issues/71149 @@ -351,12 +351,12 @@ private async Task EnsureWasmAbiRulesAreFollowed(Configuration config, bool aot) [Theory] [BuildAndRun(aot: true, config: Configuration.Release)] - public async void EnsureWasmAbiRulesAreFollowedInAOT(Configuration config, bool aot) => + public async Task EnsureWasmAbiRulesAreFollowedInAOT(Configuration config, bool aot) => await EnsureWasmAbiRulesAreFollowed(config, aot); [Theory] [BuildAndRun(aot: false)] - public async void EnsureWasmAbiRulesAreFollowedInInterpreter(Configuration config, bool aot) => + public async Task EnsureWasmAbiRulesAreFollowedInInterpreter(Configuration config, bool aot) => await EnsureWasmAbiRulesAreFollowed(config, aot); [Theory] @@ -373,7 +373,7 @@ public void EnsureComInteropCompilesInAOT(Configuration config, bool aot) [Theory] [BuildAndRun(aot: false)] - public async void UCOWithSpecialCharacters(Configuration config, bool aot) + public async Task UCOWithSpecialCharacters(Configuration config, bool aot) { var extraProperties = "true"; var extraItems = @""; diff --git a/src/mono/wasm/Wasm.Build.Tests/SatelliteAssembliesTests.cs b/src/mono/wasm/Wasm.Build.Tests/SatelliteAssembliesTests.cs index c74a21b82d86bc..92f710baef0dcf 100644 --- a/src/mono/wasm/Wasm.Build.Tests/SatelliteAssembliesTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/SatelliteAssembliesTests.cs @@ -5,6 +5,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; @@ -32,7 +33,7 @@ public SatelliteAssembliesTests(ITestOutputHelper output, SharedBuildPerTestClas [MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ false, /*relinking*/ false })] [MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ false, /*relinking*/ true })] [MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ true, /*relinking*/ false })] - public async void ResourcesFromMainAssembly(Configuration config, bool aot, bool nativeRelink, string? argCulture) + public async Task ResourcesFromMainAssembly(Configuration config, bool aot, bool nativeRelink, string? argCulture) { string prefix = $"sat_asm_from_main_asm"; string extraProperties = (nativeRelink ? $"true" : string.Empty) @@ -58,7 +59,7 @@ public async void ResourcesFromMainAssembly(Configuration config, bool aot, bool [MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ false, /*relinking*/ false })] [MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ false, /*relinking*/ true })] [MemberData(nameof(SatelliteAssemblyTestData), parameters: new object[] { /*aot*/ true, /*relinking*/ false })] - public async void ResourcesFromProjectReference(Configuration config, bool aot, bool nativeRelink, string? argCulture) + public async Task ResourcesFromProjectReference(Configuration config, bool aot, bool nativeRelink, string? argCulture) { string prefix = $"SatelliteAssemblyFromProjectRef"; string extraProperties = $"{(nativeRelink ? "true" : "false")}" diff --git a/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs b/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs index 8305d98c638a75..65f0f39b92a567 100644 --- a/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/Templates/WasmTemplateTests.cs @@ -299,7 +299,7 @@ void AssertFile(string suffix) [Theory] [InlineData(false)] [InlineData(true)] - public async void LibraryModeBuild(bool useWasmSdk) + public async Task LibraryModeBuild(bool useWasmSdk) { var config = Configuration.Release; ProjectInfo info = CopyTestAsset(config, aot: false, TestAsset.LibraryModeTestApp, "libraryMode"); diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmBuildAppBase.cs b/src/mono/wasm/Wasm.Build.Tests/WasmBuildAppBase.cs index 7836ff1a15b3be..f04e7b61d05ee9 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmBuildAppBase.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmBuildAppBase.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; @@ -22,7 +23,7 @@ public WasmBuildAppBase(ITestOutputHelper output, SharedBuildPerTestClassFixture { } - protected async void TestMain(string projectName, + protected async Task TestMain(string projectName, string programText, Configuration config, bool aot, diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmBuildAppTest.cs b/src/mono/wasm/Wasm.Build.Tests/WasmBuildAppTest.cs index 996d3a490651b1..63636c98581806 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmBuildAppTest.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmBuildAppTest.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; using System.IO; +using System.Threading.Tasks; using System.Linq; using Xunit; using Xunit.Abstractions; @@ -20,16 +21,16 @@ public WasmBuildAppTest(ITestOutputHelper output, SharedBuildPerTestClassFixture [Theory] [MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ true })] [MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ false })] - public void TopLevelMain(Configuration config, bool aot) - => TestMain("top_level", + public async Task TopLevelMain(Configuration config, bool aot) + => await TestMain("top_level", @"System.Console.WriteLine(""Hello, World!""); return await System.Threading.Tasks.Task.FromResult(42);", config, aot); [Theory] [MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ true })] [MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ false })] - public void AsyncMain(Configuration config, bool aot) - => TestMain("async_main", @" + public async Task AsyncMain(Configuration config, bool aot) + => await TestMain("async_main", @" using System; using System.Threading.Tasks; @@ -44,8 +45,8 @@ public static async Task Main() [Theory] [MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ true })] [MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ false })] - public void NonAsyncMain(Configuration config, bool aot) - => TestMain("non_async_main", @" + public async Task NonAsyncMain(Configuration config, bool aot) + => await TestMain("non_async_main", @" using System; using System.Threading.Tasks; @@ -59,8 +60,8 @@ public static int Main() [Theory] [MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ false })] - public void ExceptionFromMain(Configuration config, bool aot) - => TestMain("main_exception", """ + public async Task ExceptionFromMain(Configuration config, bool aot) + => await TestMain("main_exception", """ using System; using System.Threading.Tasks; @@ -84,21 +85,21 @@ public static int Main() [Theory] [MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ true })] - public void Bug49588_RegressionTest_AOT(Configuration config, bool aot) - => TestMain("bug49588_aot", s_bug49588_ProgramCS, config, aot); + public async Task Bug49588_RegressionTest_AOT(Configuration config, bool aot) + => await TestMain("bug49588_aot", s_bug49588_ProgramCS, config, aot); [Theory] [MemberData(nameof(MainMethodTestData), parameters: new object[] { /*aot*/ false })] - public void Bug49588_RegressionTest_NativeRelinking(Configuration config, bool aot) - => TestMain("bug49588_native_relinking", s_bug49588_ProgramCS, config, aot, + public async Task Bug49588_RegressionTest_NativeRelinking(Configuration config, bool aot) + => await TestMain("bug49588_native_relinking", s_bug49588_ProgramCS, config, aot, extraArgs: "-p:WasmBuildNative=true", isNativeBuild: true); [Theory] [BuildAndRun] [ActiveIssue("https://github.com/dotnet/runtime/issues/97449")] - public void PropertiesFromRuntimeConfigJson(Configuration config, bool aot) - => TestMain("runtime_config_json", + public async Task PropertiesFromRuntimeConfigJson(Configuration config, bool aot) + => await TestMain("runtime_config_json", @" using System; using System.Runtime.CompilerServices; @@ -121,8 +122,8 @@ public void PropertiesFromRuntimeConfigJson(Configuration config, bool aot) [Theory] [BuildAndRun] [ActiveIssue("https://github.com/dotnet/runtime/issues/97449")] - public void PropertiesFromCsproj(Configuration config, bool aot) - => TestMain("csproj_properties", + public async Task PropertiesFromCsproj(Configuration config, bool aot) + => await TestMain("csproj_properties", @" using System; using System.Runtime.CompilerServices; diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmRunOutOfAppBundleTests.cs b/src/mono/wasm/Wasm.Build.Tests/WasmRunOutOfAppBundleTests.cs index 5a4a82d2142836..44139413690e49 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmRunOutOfAppBundleTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmRunOutOfAppBundleTests.cs @@ -2,6 +2,7 @@ // The .NET Foundation licenses this file to you under the MIT license. using System.IO; +using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; @@ -16,7 +17,7 @@ public WasmRunOutOfAppBundleTests(ITestOutputHelper output, SharedBuildPerTestCl [Theory] [BuildAndRun] - public async void RunOutOfAppBundle(Configuration config, bool aot) + public async Task RunOutOfAppBundle(Configuration config, bool aot) { ProjectInfo info = CopyTestAsset(config, aot, TestAsset.WasmBasicTestApp, "outofappbundle"); UpdateFile(Path.Combine("Common", "Program.cs"), s_mainReturns42); diff --git a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs index d4008d6af8ecca..7f034effcf21dc 100644 --- a/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/WasmSIMDTests.cs @@ -4,6 +4,7 @@ using System.Collections.Generic; using System.IO; using System.Linq; +using System.Threading.Tasks; using Xunit; using Xunit.Abstractions; @@ -26,7 +27,7 @@ public WasmSIMDTests(ITestOutputHelper output, SharedBuildPerTestClassFixture bu [Theory] [MemberData(nameof(MainMethodSimdTestData), parameters: new object[] { /*aot*/ false, /* simd */ true })] - public async void Build_NoAOT_ShouldNotRelink(Configuration config, bool aot, bool simd) + public async Task Build_NoAOT_ShouldNotRelink(Configuration config, bool aot, bool simd) { ProjectInfo info = CopyTestAsset(config, aot, TestAsset.WasmBasicTestApp, "build_with_workload_no_aot"); UpdateFile(Path.Combine("Common", "Program.cs"), s_simdProgramText); @@ -49,7 +50,7 @@ public async void Build_NoAOT_ShouldNotRelink(Configuration config, bool aot, bo [MemberData(nameof(MainMethodSimdTestData), parameters: new object[] { /*aot*/ true, /* simd */ true })] [MemberData(nameof(MainMethodSimdTestData), parameters: new object[] { /*aot*/ false, /* simd */ true })] [MemberData(nameof(MainMethodSimdTestData), parameters: new object[] { /*aot*/ true, /* simd */ false })] - public async void PublishSIMD_AOT(Configuration config, bool aot, bool simd) + public async Task PublishSIMD_AOT(Configuration config, bool aot, bool simd) { ProjectInfo info = CopyTestAsset(config, aot, TestAsset.WasmBasicTestApp, "simd_publish"); UpdateFile(Path.Combine("Common", "Program.cs"), s_simdProgramText); From 443b396377a6af3976b0bed8ca0b31a06c13ea08 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 31 Jul 2025 23:55:42 +0000 Subject: [PATCH 06/10] Fix xUnit2021: Async assertions should be awaited --- .../System/Data/Common/DbConnectionTests.cs | 16 ++++++------- .../System/Data/Common/DbDataReaderTest.cs | 16 ++++++------- .../Reader/EventLogExceptionTests.cs | 24 +++++++++---------- .../UnitTests/WinHttpResponseStreamTest.cs | 4 ++-- .../tests/FunctionalTests/DisconnectTest.cs | 4 ++-- .../XmlPreloadedResolverGetEntity.cs | 12 +++++----- 6 files changed, 38 insertions(+), 38 deletions(-) diff --git a/src/libraries/System.Data.Common/tests/System/Data/Common/DbConnectionTests.cs b/src/libraries/System.Data.Common/tests/System/Data/Common/DbConnectionTests.cs index feed7b22e80bbc..42ea4d30d8e4db 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/Common/DbConnectionTests.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/Common/DbConnectionTests.cs @@ -108,21 +108,21 @@ public void ProviderFactoryTest() } [Fact] - public void GetSchemaAsync_with_cancelled_token() + public async Task GetSchemaAsync_with_cancelled_token() { var conn = new MockDbConnection(); - Assert.ThrowsAsync(async () => await conn.GetSchemaAsync(new CancellationToken(true))); - Assert.ThrowsAsync(async () => await conn.GetSchemaAsync("MetaDataCollections", new CancellationToken(true))); - Assert.ThrowsAsync(async () => await conn.GetSchemaAsync("MetaDataCollections", new string[0], new CancellationToken(true))); + await Assert.ThrowsAsync(async () => await conn.GetSchemaAsync(new CancellationToken(true))); + await Assert.ThrowsAsync(async () => await conn.GetSchemaAsync("MetaDataCollections", new CancellationToken(true))); + await Assert.ThrowsAsync(async () => await conn.GetSchemaAsync("MetaDataCollections", new string[0], new CancellationToken(true))); } [Fact] - public void GetSchemaAsync_with_exception() + public async Task GetSchemaAsync_with_exception() { var conn = new MockDbConnection(); - Assert.ThrowsAsync(async () => await conn.GetSchemaAsync()); - Assert.ThrowsAsync(async () => await conn.GetSchemaAsync("MetaDataCollections")); - Assert.ThrowsAsync(async () => await conn.GetSchemaAsync("MetaDataCollections", new string[0])); + await Assert.ThrowsAsync(async () => await conn.GetSchemaAsync()); + await Assert.ThrowsAsync(async () => await conn.GetSchemaAsync("MetaDataCollections")); + await Assert.ThrowsAsync(async () => await conn.GetSchemaAsync("MetaDataCollections", new string[0])); } [Fact] diff --git a/src/libraries/System.Data.Common/tests/System/Data/Common/DbDataReaderTest.cs b/src/libraries/System.Data.Common/tests/System/Data/Common/DbDataReaderTest.cs index 3d51ee9aac4288..322e4235ccf995 100644 --- a/src/libraries/System.Data.Common/tests/System/Data/Common/DbDataReaderTest.cs +++ b/src/libraries/System.Data.Common/tests/System/Data/Common/DbDataReaderTest.cs @@ -501,12 +501,12 @@ public Task IsDbNullAsyncByColumnNameCanceledTest() } [Fact] - public void GetSchemaTableAsync_with_cancelled_token() - => Assert.ThrowsAsync(async () => await new DbDataReaderMock().GetSchemaTableAsync(new CancellationToken(true))); + public async Task GetSchemaTableAsync_with_cancelled_token() + => await Assert.ThrowsAsync(async () => await new DbDataReaderMock().GetSchemaTableAsync(new CancellationToken(true))); [Fact] - public void GetSchemaTableAsync_with_exception() - => Assert.ThrowsAsync(async () => await new DbDataReaderMock().GetSchemaTableAsync()); + public async Task GetSchemaTableAsync_with_exception() + => await Assert.ThrowsAsync(async () => await new DbDataReaderMock().GetSchemaTableAsync()); [Fact] public async Task GetSchemaTableAsync_calls_GetSchemaTable() @@ -522,12 +522,12 @@ public async Task GetSchemaTableAsync_calls_GetSchemaTable() } [Fact] - public void GetColumnSchemaAsync_with_cancelled_token() - => Assert.ThrowsAsync(async () => await new DbDataReaderMock().GetColumnSchemaAsync(new CancellationToken(true))); + public async Task GetColumnSchemaAsync_with_cancelled_token() + => await Assert.ThrowsAsync(async () => await new DbDataReaderMock().GetColumnSchemaAsync(new CancellationToken(true))); [Fact] - public void GetColumnSchemaAsync_with_exception() - => Assert.ThrowsAsync(async () => await new DbDataReaderMock().GetColumnSchemaAsync()); + public async Task GetColumnSchemaAsync_with_exception() + => await Assert.ThrowsAsync(async () => await new DbDataReaderMock().GetColumnSchemaAsync()); [Fact] public async Task GetColumnSchemaAsync_calls_GetSchemaTable() diff --git a/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/EventLogExceptionTests.cs b/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/EventLogExceptionTests.cs index 4bf77f2676e04e..5788c020d8f9b4 100644 --- a/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/EventLogExceptionTests.cs +++ b/src/libraries/System.Diagnostics.EventLog/tests/System/Diagnostics/Reader/EventLogExceptionTests.cs @@ -11,33 +11,33 @@ public class EventLogExceptionTests [Fact] public void EventLogNotFoundException_Ctor() { - Assert.ThrowsAsync(() => throw new EventLogNotFoundException()); - Assert.ThrowsAsync(() => throw new EventLogNotFoundException("message")); - Assert.ThrowsAsync(() => throw new EventLogNotFoundException("message", new Exception("inner exception"))); + Assert.Throws(new Action(() => { throw new EventLogNotFoundException(); })); + Assert.Throws(new Action(() => { throw new EventLogNotFoundException("message"); })); + Assert.Throws(new Action(() => { throw new EventLogNotFoundException("message", new Exception("inner exception")); })); } [Fact] public void EventLogReadingException_Ctor() { - Assert.ThrowsAsync(() => throw new EventLogReadingException()); - Assert.ThrowsAsync(() => throw new EventLogReadingException("message")); - Assert.ThrowsAsync(() => throw new EventLogReadingException("message", new Exception("inner exception"))); + Assert.Throws(new Action(() => { throw new EventLogReadingException(); })); + Assert.Throws(new Action(() => { throw new EventLogReadingException("message"); })); + Assert.Throws(new Action(() => { throw new EventLogReadingException("message", new Exception("inner exception")); })); } [Fact] public void EventLogProviderDisabledException_Ctor() { - Assert.ThrowsAsync(() => throw new EventLogProviderDisabledException()); - Assert.ThrowsAsync(() => throw new EventLogProviderDisabledException("message")); - Assert.ThrowsAsync(() => throw new EventLogProviderDisabledException("message", new Exception("inner exception"))); + Assert.Throws(new Action(() => { throw new EventLogProviderDisabledException(); })); + Assert.Throws(new Action(() => { throw new EventLogProviderDisabledException("message"); })); + Assert.Throws(new Action(() => { throw new EventLogProviderDisabledException("message", new Exception("inner exception")); })); } [Fact] public void EventLogInvalidDataException_Ctor() { - Assert.ThrowsAsync(() => throw new EventLogInvalidDataException()); - Assert.ThrowsAsync(() => throw new EventLogInvalidDataException("message")); - Assert.ThrowsAsync(() => throw new EventLogInvalidDataException("message", new Exception("inner exception"))); + Assert.Throws(new Action(() => throw new EventLogInvalidDataException())); + Assert.Throws(new Action(() => throw new EventLogInvalidDataException("message"))); + Assert.Throws(new Action(() => throw new EventLogInvalidDataException("message", new Exception("inner exception")))); } } diff --git a/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/WinHttpResponseStreamTest.cs b/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/WinHttpResponseStreamTest.cs index 4665a6a88eba43..74030974906057 100644 --- a/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/WinHttpResponseStreamTest.cs +++ b/src/libraries/System.Net.Http.WinHttpHandler/tests/UnitTests/WinHttpResponseStreamTest.cs @@ -278,14 +278,14 @@ public void ReadAsync_WhenDisposed_ThrowsObjectDisposedException() } [Fact] - public void ReadAsync_PriorReadInProgress_ThrowsInvalidOperationException() + public async Task ReadAsync_PriorReadInProgress_ThrowsInvalidOperationException() { Stream stream = MakeResponseStream(); TestControl.WinHttpReadData.Pause(); Task t1 = stream.ReadAsync(new byte[1], 0, 1); - Assert.ThrowsAsync(() => stream.ReadAsync(new byte[1], 0, 1)); + await Assert.ThrowsAsync(async () => await stream.ReadAsync(new byte[1], 0, 1)); TestControl.WinHttpReadData.Resume(); t1.Wait(); diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs index 43b5ac830a9f4b..30604e90567243 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs @@ -76,11 +76,11 @@ public async Task DisconnectAndReuse_ReconnectSync_ThrowsInvalidOperationExcepti [Theory] [InlineData(true)] [InlineData(false)] - public void Disconnect_NotConnected_ThrowsInvalidOperationException(bool reuseSocket) + public async Task Disconnect_NotConnected_ThrowsInvalidOperationException(bool reuseSocket) { using (Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp)) { - Assert.ThrowsAsync(async () => await DisconnectAsync(s, reuseSocket)); + await Assert.ThrowsAsync(async () => await DisconnectAsync(s, reuseSocket)); } } diff --git a/src/libraries/System.Private.Xml/tests/XmlResolver/System.Xml.XmlResolver.Tests/XmlPreloadedResolverGetEntity.cs b/src/libraries/System.Private.Xml/tests/XmlResolver/System.Xml.XmlResolver.Tests/XmlPreloadedResolverGetEntity.cs index 1747a9fee1788b..098e60462cefe1 100644 --- a/src/libraries/System.Private.Xml/tests/XmlResolver/System.Xml.XmlResolver.Tests/XmlPreloadedResolverGetEntity.cs +++ b/src/libraries/System.Private.Xml/tests/XmlResolver/System.Xml.XmlResolver.Tests/XmlPreloadedResolverGetEntity.cs @@ -89,19 +89,19 @@ public void XmlResolverGetKnownEntity() } [Fact] - public void XmlResolverGetEntityAsyncWithInvalidData() + public async Task XmlResolverGetEntityAsyncWithInvalidData() { var xmlResolver = new XmlPreloadedResolver(XmlKnownDtds.Xhtml10); - Assert.ThrowsAsync(() => xmlResolver.GetEntityAsync(null, null, null)); - Assert.ThrowsAsync(() => xmlResolver.GetEntityAsync(new Uri("https://DummyUri"), null, null)); - Assert.ThrowsAsync(() => + await Assert.ThrowsAsync(() => xmlResolver.GetEntityAsync(null, null, null)); + await Assert.ThrowsAsync(() => xmlResolver.GetEntityAsync(new Uri("https://DummyUri"), null, null)); + await Assert.ThrowsAsync(() => xmlResolver.GetEntityAsync(new Uri("-//W3C//ENTITIES Latin 1 for XHTML//EN", UriKind.RelativeOrAbsolute), null, typeof(string))); xmlResolver = new XmlPreloadedResolver(new XmlPreloadedResolver(), XmlKnownDtds.Xhtml10); - Assert.ThrowsAsync(() => + await Assert.ThrowsAsync(() => xmlResolver.GetEntityAsync(new Uri("https://DummyUri", UriKind.RelativeOrAbsolute), null, typeof(string))); - Assert.ThrowsAsync(() => + await Assert.ThrowsAsync(() => xmlResolver.GetEntityAsync(new Uri("-//W3C//ENTITIES Latin 1 for XHTML//EN", UriKind.RelativeOrAbsolute), null, typeof(TextReader))); } From 41a2067c078c67a60e5991c9d946902d465fc084 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 31 Jul 2025 20:54:16 +0000 Subject: [PATCH 07/10] Fix xUnit2027: Comparison of sets to linear containers have undefined results --- .../tests/ImmutableSortedSetBuilderTest.cs | 2 ++ .../tests/Common/JsonCreationHandlingTests.Enumerable.cs | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/libraries/System.Collections.Immutable/tests/ImmutableSortedSetBuilderTest.cs b/src/libraries/System.Collections.Immutable/tests/ImmutableSortedSetBuilderTest.cs index 6ec30b901014db..e4d7464cea2124 100644 --- a/src/libraries/System.Collections.Immutable/tests/ImmutableSortedSetBuilderTest.cs +++ b/src/libraries/System.Collections.Immutable/tests/ImmutableSortedSetBuilderTest.cs @@ -99,6 +99,7 @@ public void IndexOf() [Fact] public void EnumerateBuilderWhileMutating() { +#pragma warning disable xUnit2027 // Comparison of sets to linear containers have undefined results ImmutableSortedSet.Builder builder = ImmutableSortedSet.Empty.Union(Enumerable.Range(1, 10)).ToBuilder(); Assert.Equal(Enumerable.Range(1, 10), builder); @@ -116,6 +117,7 @@ public void EnumerateBuilderWhileMutating() // Verify that by obtaining a new enumerator, we can enumerate all the contents. Assert.Equal(Enumerable.Range(1, 11), builder); +#pragma warning restore xUnit2027 } [Fact] diff --git a/src/libraries/System.Text.Json/tests/Common/JsonCreationHandlingTests.Enumerable.cs b/src/libraries/System.Text.Json/tests/Common/JsonCreationHandlingTests.Enumerable.cs index b4a65b5d818974..3650a21ffdd791 100644 --- a/src/libraries/System.Text.Json/tests/Common/JsonCreationHandlingTests.Enumerable.cs +++ b/src/libraries/System.Text.Json/tests/Common/JsonCreationHandlingTests.Enumerable.cs @@ -11,6 +11,8 @@ namespace System.Text.Json.Serialization.Tests; +#pragma warning disable xUnit2027 // Comparison of sets to linear containers have undefined results + public abstract partial class JsonCreationHandlingTests : SerializerTests { [Fact] From c61cff7f58e122caf7d1283c1836d6314a4e712c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 3 Aug 2025 16:02:42 +0200 Subject: [PATCH 08/10] Fix xUnit2029: Do not use Assert.Empty to check if a value does not exist in a collection --- .../tests/Common/LoggingServiceCollectionExtensionsTest.cs | 2 +- src/libraries/System.Linq/tests/WhereTests.cs | 4 ++-- .../CompilationHelper.cs | 2 +- src/mono/wasm/Wasm.Build.Tests/SatelliteAssembliesTests.cs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggingServiceCollectionExtensionsTest.cs b/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggingServiceCollectionExtensionsTest.cs index a9369d6e21bdab..bba8105e69a8a3 100644 --- a/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggingServiceCollectionExtensionsTest.cs +++ b/src/libraries/Microsoft.Extensions.Logging/tests/Common/LoggingServiceCollectionExtensionsTest.cs @@ -55,7 +55,7 @@ public void ClearProviders_RemovesAllProvidersFromServiceCollection() services.AddLogging(builder => builder.ClearProviders()); - Assert.Empty(services.Where(desctriptor => desctriptor.ServiceType == typeof(ILoggerProvider))); + Assert.DoesNotContain(services, descriptor => descriptor.ServiceType == typeof(ILoggerProvider)); } } } diff --git a/src/libraries/System.Linq/tests/WhereTests.cs b/src/libraries/System.Linq/tests/WhereTests.cs index 21e5f0f86829b5..f877e7bbaba4a6 100644 --- a/src/libraries/System.Linq/tests/WhereTests.cs +++ b/src/libraries/System.Linq/tests/WhereTests.cs @@ -892,14 +892,14 @@ public void SameResultsRepeatCallsStringQuery() public void SingleElementPredicateFalse() { int[] source = [3]; - Assert.Empty(source.Where(IsEven)); + Assert.DoesNotContain(source, IsEven); } [Fact] public void PredicateFalseForAll() { int[] source = [9, 7, 15, 3, 27]; - Assert.Empty(source.Where(IsEven)); + Assert.DoesNotContain(source, IsEven); } [Fact] diff --git a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs index 7f56065297f171..37f6c74e172c0d 100644 --- a/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs +++ b/src/libraries/System.Text.Json/tests/System.Text.Json.SourceGeneration.Unit.Tests/CompilationHelper.cs @@ -829,7 +829,7 @@ internal static void AssertEqualDiagnosticMessages( internal static void AssertMaxSeverity(this IEnumerable diagnostics, DiagnosticSeverity maxSeverity) { - Assert.Empty(diagnostics.Where(diagnostic => diagnostic.Severity > maxSeverity)); + Assert.DoesNotContain(diagnostics, diagnostic => diagnostic.Severity > maxSeverity); } } diff --git a/src/mono/wasm/Wasm.Build.Tests/SatelliteAssembliesTests.cs b/src/mono/wasm/Wasm.Build.Tests/SatelliteAssembliesTests.cs index 92f710baef0dcf..f213e481f259f0 100644 --- a/src/mono/wasm/Wasm.Build.Tests/SatelliteAssembliesTests.cs +++ b/src/mono/wasm/Wasm.Build.Tests/SatelliteAssembliesTests.cs @@ -111,7 +111,7 @@ public void CheckThatSatelliteAssembliesAreNotAOTed(Configuration config, bool a // sanity check, in case we change file extensions Assert.Contains($"{info.ProjectName}.dll.bc", bitCodeFileNames); - Assert.Empty(bitCodeFileNames.Where(file => file.EndsWith(".resources.dll.bc"))); + Assert.DoesNotContain(bitCodeFileNames, file => file.EndsWith(".resources.dll.bc")); } #pragma warning restore xUnit1026 From f87131b2c759ac507d2df13caea2537c2ecf229f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Thu, 31 Jul 2025 21:08:48 +0000 Subject: [PATCH 09/10] Fix xUnit2031: Do not use Where clause with Assert.Single --- .../Logging/FailedHttpRequestLoggingTests.cs | 8 ++-- .../Logging/LoggingUriOutputTests.cs | 12 ++--- .../RedactedLogValueIntegrationTest.cs | 48 +++++++++---------- 3 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/FailedHttpRequestLoggingTests.cs b/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/FailedHttpRequestLoggingTests.cs index e1ab591fc472ef..2636a9424ae3fe 100644 --- a/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/FailedHttpRequestLoggingTests.cs +++ b/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/FailedHttpRequestLoggingTests.cs @@ -50,18 +50,18 @@ await Assert.ThrowsAsync(async () => var messages = sink.Writes.ToArray(); - var requestFailedMessage = Assert.Single(messages.Where(m => + var requestFailedMessage = Assert.Single(messages, m => { return m.EventId == EventIds.RequestFailed && m.LoggerName == InnerLoggerName; - })); - var pipelineFailedMessage = Assert.Single(messages.Where(m => + }); + var pipelineFailedMessage = Assert.Single(messages, m => { return m.EventId == EventIds.PipelineFailed && m.LoggerName == OuterLoggerName; - })); + }); } private const string ExceptionMessage = "Dummy error message"; diff --git a/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/LoggingUriOutputTests.cs b/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/LoggingUriOutputTests.cs index 8952b020d5d4f4..cb62d0cd6b5f19 100644 --- a/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/LoggingUriOutputTests.cs +++ b/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/LoggingUriOutputTests.cs @@ -122,13 +122,13 @@ await RemoteExecutor.Invoke(static async (syncApiStr, scopeHandlerStr) => if (scopeHandler) { - var pipelineStartMessage = Assert.Single(sink.Writes.Where(m => m.EventId == EventIds.PipelineStart)); + var pipelineStartMessage = Assert.Single(sink.Writes, m => m.EventId == EventIds.PipelineStart); Assert.Equal($"HTTP GET {baseUri}?*", pipelineStartMessage.Scope.ToString()); Assert.Equal($"Start processing HTTP request GET {baseUri}?*", pipelineStartMessage.Message); } else { - var requestStartMessage = Assert.Single(sink.Writes.Where(m => m.EventId == EventIds.RequestStart)); + var requestStartMessage = Assert.Single(sink.Writes, m => m.EventId == EventIds.RequestStart); Assert.Equal($"Sending HTTP request GET {baseUri}?*", requestStartMessage.Message); } }, syncApi.ToString(), scopeHandler.ToString()).DisposeAsync(); @@ -181,13 +181,13 @@ await RemoteExecutor.Invoke(static async (syncApiStr, disableUriQueryRedactionSt _ = await client.SendAsync(request); } - var pipelineStartMessage = Assert.Single(sink.Writes.Where(m => + var pipelineStartMessage = Assert.Single(sink.Writes, m => m.EventId == EventIds.PipelineStart && - m.LoggerName == "System.Net.Http.HttpClient.test.LogicalHandler")); + m.LoggerName == "System.Net.Http.HttpClient.test.LogicalHandler"); - var requestStartMessage = Assert.Single(sink.Writes.Where(m => + var requestStartMessage = Assert.Single(sink.Writes, m => m.EventId == EventIds.RequestStart && - m.LoggerName == "System.Net.Http.HttpClient.test.ClientHandler")); + m.LoggerName == "System.Net.Http.HttpClient.test.ClientHandler"); string expectedUri = disableUriQueryRedaction ? destinationUri : $"{baseUri}?*"; diff --git a/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/RedactedLogValueIntegrationTest.cs b/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/RedactedLogValueIntegrationTest.cs index e2c42c7bc0ecf4..fed0a3f8189000 100644 --- a/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/RedactedLogValueIntegrationTest.cs +++ b/src/libraries/Microsoft.Extensions.Http/tests/Microsoft.Extensions.Http.Tests/Logging/RedactedLogValueIntegrationTest.cs @@ -56,12 +56,12 @@ public async Task RedactLoggedHeadersNotCalled_AllValuesAreRedactedBeforeLogging var messages = sink.Writes.ToArray(); - var message = Assert.Single(messages.Where(m => + var message = Assert.Single(messages, m => { return m.EventId == EventIds.RequestPipelineRequestHeader && m.LoggerName == OuterLoggerName; - })); + }); Assert.StartsWith(LineEndingsHelper.Normalize( """ Request Headers: @@ -70,12 +70,12 @@ public async Task RedactLoggedHeadersNotCalled_AllValuesAreRedactedBeforeLogging """), message.Message); - message = Assert.Single(messages.Where(m => + message = Assert.Single(messages, m => { return m.EventId == EventIds.RequestHeader && m.LoggerName == InnerLoggerName; - })); + }); Assert.StartsWith(LineEndingsHelper.Normalize( """ Request Headers: @@ -84,12 +84,12 @@ public async Task RedactLoggedHeadersNotCalled_AllValuesAreRedactedBeforeLogging """), message.Message); - message = Assert.Single(messages.Where(m => + message = Assert.Single(messages, m => { return m.EventId == EventIds.ResponseHeader && m.LoggerName == InnerLoggerName; - })); + }); Assert.StartsWith(LineEndingsHelper.Normalize( """ Response Headers: @@ -98,12 +98,12 @@ public async Task RedactLoggedHeadersNotCalled_AllValuesAreRedactedBeforeLogging """), message.Message); - message = Assert.Single(messages.Where(m => + message = Assert.Single(messages, m => { return m.EventId == EventIds.RequestPipelineResponseHeader && m.LoggerName == OuterLoggerName; - })); + }); Assert.StartsWith(LineEndingsHelper.Normalize( """ Response Headers: @@ -142,48 +142,48 @@ public async Task RedactHeaderValueWithHeaderList_ValueIsRedactedBeforeLogging() var messages = sink.Writes.ToArray(); - var message = Assert.Single(messages.Where(m => + var message = Assert.Single(messages, m => { return m.EventId == EventIds.RequestPipelineRequestHeader && m.LoggerName == OuterLoggerName; - })); + }); Assert.StartsWith(LineEndingsHelper.Normalize( @"Request Headers: Authorization: * Cache-Control: no-cache "), message.Message); - message = Assert.Single(messages.Where(m => + message = Assert.Single(messages, m => { return m.EventId == EventIds.RequestHeader && m.LoggerName == InnerLoggerName; - })); + }); Assert.StartsWith(LineEndingsHelper.Normalize( @"Request Headers: Authorization: * Cache-Control: no-cache "), message.Message); - message = Assert.Single(messages.Where(m => + message = Assert.Single(messages, m => { return m.EventId == EventIds.ResponseHeader && m.LoggerName == InnerLoggerName; - })); + }); Assert.StartsWith(LineEndingsHelper.Normalize( @"Response Headers: X-Sensitive: * Y-Non-Sensitive: innocuous value "), message.Message); - message = Assert.Single(messages.Where(m => + message = Assert.Single(messages, m => { return m.EventId == EventIds.RequestPipelineResponseHeader && m.LoggerName == OuterLoggerName; - })); + }); Assert.StartsWith(LineEndingsHelper.Normalize( @"Response Headers: X-Sensitive: * @@ -223,48 +223,48 @@ public async Task RedactHeaderValueWithPredicate_ValueIsRedactedBeforeLogging() var messages = sink.Writes.ToArray(); - var message = Assert.Single(messages.Where(m => + var message = Assert.Single(messages, m => { return m.EventId == EventIds.RequestPipelineRequestHeader && m.LoggerName == OuterLoggerName; - })); + }); Assert.StartsWith(LineEndingsHelper.Normalize( @"Request Headers: Authorization: * Cache-Control: no-cache "), message.Message); - message = Assert.Single(messages.Where(m => + message = Assert.Single(messages, m => { return m.EventId == EventIds.RequestHeader && m.LoggerName == InnerLoggerName; - })); + }); Assert.StartsWith(LineEndingsHelper.Normalize( @"Request Headers: Authorization: * Cache-Control: no-cache "), message.Message); - message = Assert.Single(messages.Where(m => + message = Assert.Single(messages, m => { return m.EventId == EventIds.ResponseHeader && m.LoggerName == InnerLoggerName; - })); + }); Assert.StartsWith(LineEndingsHelper.Normalize( @"Response Headers: X-Sensitive: * Y-Non-Sensitive: innocuous value "), message.Message); - message = Assert.Single(messages.Where(m => + message = Assert.Single(messages, m => { return m.EventId == EventIds.RequestPipelineResponseHeader && m.LoggerName == OuterLoggerName; - })); + }); Assert.StartsWith(LineEndingsHelper.Normalize( @"Response Headers: X-Sensitive: * From a6b34ad160d073e023a37a61856986037729325f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20K=C3=B6plinger?= Date: Sun, 3 Aug 2025 12:55:56 +0200 Subject: [PATCH 10/10] Disable test that started erroring --- .../System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs index 30604e90567243..17fff878eb2ef3 100644 --- a/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs +++ b/src/libraries/System.Net.Sockets/tests/FunctionalTests/DisconnectTest.cs @@ -73,6 +73,7 @@ public async Task DisconnectAndReuse_ReconnectSync_ThrowsInvalidOperationExcepti } } + [ActiveIssue("https://github.com/dotnet/runtime/issues/118314")] [Theory] [InlineData(true)] [InlineData(false)]