[NO-MERGE, NO-REVIEW] Experiment: try remove test exclusions#125335
[NO-MERGE, NO-REVIEW] Experiment: try remove test exclusions#125335mrek-msft wants to merge 6 commits intodotnet:mainfrom
Conversation
|
Tagging subscribers to this area: @dotnet/area-extensions-configuration |
There was a problem hiding this comment.
Pull request overview
This is an explicitly marked experimental/no-merge PR that removes [ActiveIssue] test exclusions for iOS and tvOS platforms on two test files, in order to observe pipeline results when those tests are allowed to run on those platforms. It also contains an intentional throw new Exception("test foo bar") inserted into a test method as part of the experiment.
Changes:
- Removal of
[ActiveIssue]exclusions for iOS/tvOS from two tests inArrayTests.cs(issues #60583). - Removal of
[ActiveIssue]exclusion for iOS/tvOS from one test inConfigurationExtensionTest.cs(issue #60584), plus an injectedthrow new Exception("test foo bar")that unconditionally fails the test.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/libraries/Microsoft.Extensions.Configuration/tests/FunctionalTests/ArrayTests.cs |
Removes [ActiveIssue] attributes from two tests, enabling them to run on iOS/tvOS |
src/libraries/Microsoft.Extensions.Configuration.UserSecrets/tests/ConfigurationExtensionTest.cs |
Removes [ActiveIssue] attribute from one test and adds a throw new Exception("test foo bar") that makes the test unconditionally fail |
You can also share your feedback on Copilot code review. Take the survey.
| [ActiveIssue("https://github.com/dotnet/runtime/issues/60584", TestPlatforms.iOS | TestPlatforms.tvOS)] | ||
| public void AddUserSecrets_FindsAssemblyAttribute() | ||
| { | ||
| throw new Exception("test foo bar"); |
There was a problem hiding this comment.
A throw new Exception("test foo bar") statement has been intentionally added at the top of the AddUserSecrets_FindsAssemblyAttribute test method. This will cause the test to unconditionally throw an exception and fail immediately, without executing any of the actual test logic. This appears to be debug/experimental code that must not be merged. The PR title says "NO-MERGE, NO-REVIEW" but this change would break the test suite if somehow merged.
| throw new Exception("test foo bar"); |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.
Comments suppressed due to low confidence (2)
src/libraries/Microsoft.Extensions.Configuration/tests/FunctionalTests/ConfigurationTests.cs:875
- This test writes files directly into
_basePath(AppContext.BaseDirectory) and then relies on the default configuration base path to resolve "test.json"/"xmltest.xml". On iOS/tvOS, writing into AppContext.BaseDirectory commonly fails (read-only), which is why this was previously excluded. Consider creating the files under the test file system/temp directory and callingSetBasePath(...)explicitly for determinism, or keep the platform exclusion until the underlying issue is resolved.
[Fact]
public void GetDefaultBasePathForSources()
{
var builder = new ConfigurationBuilder();
var jsonConfigFilePath = Path.Combine(_basePath, "test.json");
var xmlConfigFilePath = Path.Combine(_basePath, "xmltest.xml");
_fileSystem.WriteFile(jsonConfigFilePath, _jsonConfigFileContent, absolute: true);
_fileSystem.WriteFile(xmlConfigFilePath, _xmlConfigFileContent, absolute: true);
builder.AddJsonFile("test.json").AddXmlFile("xmltest.xml");
src/libraries/Microsoft.Extensions.DependencyModel/tests/CompilationLibraryTests.cs:58
- Removing the iOS/tvOS ActiveIssue re-enables this test on Apple mobile, but it creates a 'refs' directory and writes a file under AppContext.BaseDirectory. On iOS/tvOS the app base directory is typically not writable, so this will throw during Directory.CreateDirectory/File.WriteAllText. Consider writing the temp assembly to a writable temp directory (e.g., Path.GetTempPath()) and cleaning it up, or keep the platform exclusion until the underlying issue is fixed.
[Fact]
public void ResolveReferencePathsAcceptsNullCustomResolvers()
{
var library = TestLibraryFactory.Create();
var assemblyPath = Path.Combine(AppContext.BaseDirectory, "refs", library.Name + ".dll");
Directory.CreateDirectory(Path.GetDirectoryName(assemblyPath));
You can also share your feedback on Copilot code review. Take the survey.
| [Fact] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/60583", TestPlatforms.iOS | TestPlatforms.tvOS)] | ||
| public void DifferentConfigSources_Merged_KeysAreSorted() | ||
| { | ||
| var config = BuildConfig(); |
There was a problem hiding this comment.
On Apple mobile the constructor writes the config files under Path.GetTempPath(), but BuildConfig() adds sources using only the file names and does not set the builder base path to that temp directory. When this test is re-enabled on iOS/tvOS, the providers will look under the default base path (typically AppContext.BaseDirectory) and won't find the temp files. Fix by setting the base path/file provider to the directory you wrote the files into (and track full paths for cleanup), or keep the platform exclusion.
| [Fact] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/60583", TestPlatforms.iOS | TestPlatforms.tvOS)] | ||
| public void DifferentConfigSources_Merged_WithOverwrites() | ||
| { |
There was a problem hiding this comment.
Same Apple mobile path issue as the earlier test: files may be created under Path.GetTempPath() but BuildConfig() reads from the default base path when only file names are provided. Re-enabling on iOS/tvOS without setting the builder base path will make this test fail to locate its inputs.
| [Fact] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/60584", TestPlatforms.iOS | TestPlatforms.tvOS)] | ||
| public void AddUserSecrets_FindsAssemblyAttributeFromType() | ||
| { |
There was a problem hiding this comment.
Re-enabling this test on iOS/tvOS can still fail because it depends on PathHelper.GetSecretsPathFromSecretsId finding a user profile location (APPDATA/HOME/SpecialFolder paths). Consider setting DOTNET_USER_SECRETS_FALLBACK_DIR to a temp directory during the test run (and restoring it) to avoid platform-specific failures, or keep the platform exclusion.
| [Fact] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/60584", TestPlatforms.iOS | TestPlatforms.tvOS)] | ||
| public void AddUserSecrets_With_SecretsId_Passed_Explicitly() | ||
| { |
There was a problem hiding this comment.
Re-enabling this test on iOS/tvOS may still fail if PathHelper.GetSecretsPathFromSecretsId cannot resolve a user-secrets root and throws InvalidOperationException. Consider forcing a writable user-secrets root for tests via DOTNET_USER_SECRETS_FALLBACK_DIR (temp directory) or keep the platform exclusion until the platform behavior is addressed.
| [Fact] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/60583", TestPlatforms.iOS | TestPlatforms.tvOS)] | ||
| public void OnLoadErrorWillBeCalledOnJsonParseError() | ||
| { | ||
| _fileSystem.WriteFile(Path.Combine(_basePath, "error.json"), @"{""JsonKey1"": ", absolute: true); |
There was a problem hiding this comment.
This test writes error.json to _basePath (AppContext.BaseDirectory) via absolute: true. Re-enabling it on iOS/tvOS (by removing the ActiveIssue) is likely to fail because the app base directory is generally not writable on those platforms. Use the existing _fileSystem.RootPath/_fileProvider for writable test files (or another temp location) and ensure the configuration builder is pointed at that path, or keep the platform exclusion.
|
/azp run runtime-ioslike |
|
Azure Pipelines successfully started running 1 pipeline(s). |
|
/azp help |
Supported commands
See additional documentation. |
|
/azp list |
|
/azp run runtime-ioslike |
|
No pipelines are associated with this pull request. |
|
/azp run runtime-ioslike, runtime-ioslikesimulator |
|
Azure Pipelines successfully started running 1 pipeline(s), but failed to run 1 pipeline(s). |
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
Comments suppressed due to low confidence (3)
src/libraries/Microsoft.Extensions.DependencyModel/tests/CompilationLibraryTests.cs:60
- This test creates and writes a reference file under AppContext.BaseDirectory ("refs/.dll"). On iOS/tvOS AppContext.BaseDirectory is typically not writable (app bundle), which is what the removed platform exclusion was protecting. If the underlying issue is fixed and the exclusion can be removed, update the test to write into a writable temp directory (and ensure cleanup), or add an appropriate platform guard (e.g., temp base path / SkipOnPlatform) so it remains reliable on Apple mobile.
[Fact]
public void ResolveReferencePathsAcceptsNullCustomResolvers()
{
var library = TestLibraryFactory.Create();
var assemblyPath = Path.Combine(AppContext.BaseDirectory, "refs", library.Name + ".dll");
Directory.CreateDirectory(Path.GetDirectoryName(assemblyPath));
File.WriteAllText(assemblyPath, "hello");
src/libraries/Microsoft.Extensions.Configuration/tests/FunctionalTests/ConfigurationTests.cs:365
- OnLoadErrorWillBeCalledOnJsonParseError writes "error.json" to _basePath, which is set to AppContext.BaseDirectory. That location is not reliably writable on iOS/tvOS, which is what the removed ActiveIssue skip was guarding. If you want this to run on Apple mobile, adjust the test to write under the DisposableFileSystem root (or another temp directory) and configure the builder base path/file provider accordingly, instead of using AppContext.BaseDirectory.
[Fact]
public void OnLoadErrorWillBeCalledOnJsonParseError()
{
_fileSystem.WriteFile(Path.Combine(_basePath, "error.json"), @"{""JsonKey1"": ", absolute: true);
FileConfigurationProvider provider = null;
src/libraries/Microsoft.Extensions.Configuration/tests/FunctionalTests/ConfigurationTests.cs:872
- GetDefaultBasePathForSources writes test files to AppContext.BaseDirectory via _basePath. That directory is often read-only on iOS/tvOS, which is why this test had a platform exclusion. If this is meant to run on Apple mobile now, consider using a writable temp directory for the files and explicitly setting the builder base path/file provider so the test isn’t dependent on AppContext.BaseDirectory being writable.
[Fact]
public void GetDefaultBasePathForSources()
{
var builder = new ConfigurationBuilder();
var jsonConfigFilePath = Path.Combine(_basePath, "test.json");
var xmlConfigFilePath = Path.Combine(_basePath, "xmltest.xml");
_fileSystem.WriteFile(jsonConfigFilePath, _jsonConfigFileContent, absolute: true);
_fileSystem.WriteFile(xmlConfigFilePath, _xmlConfigFileContent, absolute: true);
| [Fact] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/60583", TestPlatforms.iOS | TestPlatforms.tvOS)] | ||
| public void DifferentConfigSources_Merged_WithOverwrites() | ||
| { | ||
| var config = BuildConfig(); |
There was a problem hiding this comment.
On Apple mobile, this fixture writes its config files to Path.GetTempPath(), but BuildConfig() uses relative paths without calling SetBasePath / configuring a file provider. That means the builder will typically look under the default base path (often AppContext.BaseDirectory), not the temp directory where the files were written, which is what the removed iOS/tvOS exclusion was guarding. If the exclusion is being removed, update the test to set the builder base path to the same directory used for file creation and ensure cleanup deletes the full paths (not just file names).
| [Fact] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/60584", TestPlatforms.iOS | TestPlatforms.tvOS)] | ||
| public void AddUserSecrets_FindsAssemblyAttributeFromType() | ||
| { |
There was a problem hiding this comment.
These tests depend on PathHelper.GetSecretsPathFromSecretsId(), which throws if no user-secrets root can be determined from APPDATA/HOME/GetFolderPath. The removed iOS/tvOS exclusion likely existed because those values aren’t reliably available/usable on Apple mobile test environments. If you want this test enabled on iOS/tvOS, make it self-contained by setting DOTNET_USER_SECRETS_FALLBACK_DIR to a temp directory for the duration of the test (and restoring it), so the secrets path is always resolvable and writable.
| [Fact] | ||
| [ActiveIssue("https://github.com/dotnet/runtime/issues/60584", TestPlatforms.iOS | TestPlatforms.tvOS)] | ||
| public void AddUserSecrets_With_SecretsId_Passed_Explicitly() | ||
| { |
There was a problem hiding this comment.
These tests depend on PathHelper.GetSecretsPathFromSecretsId(), which throws if no user-secrets root can be determined from APPDATA/HOME/GetFolderPath. The removed iOS/tvOS exclusion likely existed because those values aren’t reliably available/usable on Apple mobile test environments. If you want this test enabled on iOS/tvOS, make it self-contained by setting DOTNET_USER_SECRETS_FALLBACK_DIR to a temp directory for the duration of the test (and restoring it), so the secrets path is always resolvable and writable.
Just for running pipelines on this experiment.