diff --git a/Plugin.SegmentedControl.Maui/Utils/HandlerCleanUpHelper.cs b/Plugin.SegmentedControl.Maui/Utils/HandlerCleanUpHelper.cs index 3250c14..cb04257 100644 --- a/Plugin.SegmentedControl.Maui/Utils/HandlerCleanUpHelper.cs +++ b/Plugin.SegmentedControl.Maui/Utils/HandlerCleanUpHelper.cs @@ -109,7 +109,7 @@ private static IEnumerable GetActivePages(Shell shell) } } - return hashSet; + return hashSet.Where(p => p != null); } private static IEnumerable WalkToPage(Element element) @@ -125,7 +125,10 @@ private static IEnumerable WalkToPage(Element element) case ShellSection shellSection: IShellSectionController controller = shellSection; var children = controller.GetItems().OfType(); - return children.Select(c => c.Page); + var childPages = children + .Select(c => c.Page) + .SelectMany(p => PageHelper.GetNavigationTree(p)); + return childPages; } return []; diff --git a/Plugin.SegmentedControl.Maui/Utils/PageHelper.cs b/Plugin.SegmentedControl.Maui/Utils/PageHelper.cs index c766d56..adc9a4b 100644 --- a/Plugin.SegmentedControl.Maui/Utils/PageHelper.cs +++ b/Plugin.SegmentedControl.Maui/Utils/PageHelper.cs @@ -33,6 +33,11 @@ private static string PrintNavigationPath(IEnumerable pages) internal static IEnumerable GetNavigationTree(Page page, bool modal = false) { + if (page == null) + { + yield break; + } + var navigation = page.Navigation; switch (page) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c22909f..39ab6e5 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -22,7 +22,6 @@ trigger: - Docs/* variables: - solution: 'Plugin.SegmentedControl.Maui.sln' buildPlatform: 'Any CPU' buildConfiguration: 'Release' majorVersion: 1 @@ -96,19 +95,23 @@ steps: displayName: 'NuGet restore' inputs: command: restore - projects: '$(solution)' + projects: | + Plugin.SegmentedControl.Maui/**/*.csproj + Tests/**/*.Tests.csproj - task: DotNetCoreCLI@2 - displayName: 'Build solution' + displayName: 'Build projects' inputs: - projects: '$(solution)' + projects: | + Plugin.SegmentedControl.Maui/**/*.csproj + Tests/**/*.Tests.csproj arguments: '--no-restore --configuration $(buildConfiguration)' - task: DotNetCoreCLI@2 displayName: 'Run UnitTests' inputs: command: test - projects: '**/*.Tests.csproj' + projects: 'Tests/**/*.Tests.csproj' arguments: '--no-restore --no-build --configuration $(buildConfiguration) /p:CollectCoverage=true /p:Exclude="[Microsoft*]*%2C[Mono*]*%2C[xunit*]*%2C[*.Testdata]*" /p:CoverletOutput=UnitTests.coverage.cobertura.xml /p:MergeWith=$(Build.SourcesDirectory)/Tests/CoverletOutput/coverage.json /p:CoverletOutputFormat=cobertura' - task: reportgenerator@5