diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index c0fa8186..b38aea89 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,7 +18,7 @@ on: env: DOTNET_VERSION: ${{ '7.0.x' }} - ENABLE_DIAGNOSTICS: false + ENABLE_DIAGNOSTICS: true #COREHOST_TRACE: 1 COREHOST_TRACEFILE: corehosttrace.log MULTI_TARGET_DIRECTORY: tooling/MultiTarget @@ -68,6 +68,22 @@ jobs: # Steps represent a sequence of tasks that will be executed as part of the job steps: + - name: Configure Pagefile + uses: al-cheb/configure-pagefile-action@v1.3 + with: + minimum-size: 32GB + maximum-size: 32GB + disk-root: "C:" + + - name: Enable User-Mode Dumps collecting + if: ${{ env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '' }} + shell: powershell + run: | + New-Item '${{ github.workspace }}\CrashDumps' -Type Directory + Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpFolder' -Type ExpandString -Value '${{ github.workspace }}\CrashDumps' + Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpCount' -Type DWord -Value '10' + Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\Windows Error Reporting\LocalDumps' -Name 'DumpType' -Type DWord -Value '2' + - name: Install .NET SDK v${{ env.DOTNET_VERSION }} uses: actions/setup-dotnet@v3 with: @@ -106,8 +122,13 @@ jobs: run: powershell -version 5.1 -command "./UseUnoWinUI.ps1 3" -ErrorAction Stop if: ${{ matrix.platform == 'WinUI3' }} + - name: MSBuild (With diagnostics) + if: ${{ env.ENABLE_DIAGNOSTICS == 'true' }} + run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release -m /bl -v:diag + - name: MSBuild - run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release -m -p:UseDotNetNativeToolchain=false + if: ${{ env.ENABLE_DIAGNOSTICS == 'false' }} + run: msbuild.exe CommunityToolkit.AllComponents.sln /restore /nowarn:MSB4011 -p:Configuration=Release -m # Build All Packages - name: pack experiments @@ -125,7 +146,7 @@ jobs: # Run tests - name: Setup VSTest Path - uses: darenm/Setup-VSTest@v1 + uses: darenm/Setup-VSTest@v1.2 - name: Install Testspace Module uses: testspace-com/setup-testspace@v1 @@ -152,6 +173,36 @@ jobs: name: build-logs path: ./**/*.*log + - name: Artifact - ILC Repro + uses: actions/upload-artifact@v3 + if: ${{ (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} + with: + name: ilc-repro + path: ./*.zip + + # https://github.com/dorny/paths-filter#custom-processing-of-changed-files + - name: Detect If any Dump Files + uses: dorny/paths-filter@v2.11.1 + id: filter + with: + list-files: shell + filters: | + dump: + - added: '${{ github.workspace }}/CrashDumps/*.dmp' + + - name: Artifact - WER crash dumps + uses: actions/upload-artifact@v3 + if: ${{ steps.filter.outputs.dump == 'true' && (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} + with: + name: CrashDumps-${{ matrix.platform }} + path: '${{ github.workspace }}/CrashDumps' + + - name: Analyze Dump + if: ${{ steps.filter.outputs.dump == 'true' && (env.ENABLE_DIAGNOSTICS == 'true' || env.COREHOST_TRACE != '') && always() }} + run: | + dotnet tool install --global dotnet-dump + dotnet-dump analyze ${{ steps.filter.outputs.dump_files }} -c "clrstack" -c "pe -lines" -c "exit" + wasm-linux: runs-on: ubuntu-latest diff --git a/components/Behaviors/samples/Assets/StackedNotificationsBehavior.png b/components/Behaviors/samples/Assets/StackedNotificationsBehavior.png new file mode 100644 index 00000000..a90aed35 Binary files /dev/null and b/components/Behaviors/samples/Assets/StackedNotificationsBehavior.png differ diff --git a/components/Behaviors/samples/Behaviors.Samples.csproj b/components/Behaviors/samples/Behaviors.Samples.csproj index 2f1a83e6..9f3e1b2a 100644 --- a/components/Behaviors/samples/Behaviors.Samples.csproj +++ b/components/Behaviors/samples/Behaviors.Samples.csproj @@ -15,7 +15,7 @@ - Always + PreserveNewest diff --git a/components/Behaviors/samples/StackedNotificationsBehavior.md b/components/Behaviors/samples/StackedNotificationsBehavior.md new file mode 100644 index 00000000..22c6699e --- /dev/null +++ b/components/Behaviors/samples/StackedNotificationsBehavior.md @@ -0,0 +1,77 @@ +--- +title: StackedNotificationsBehavior +author: vgromfeld +description: A behavior to add stacked notifications to a WinUI InfoBar control. +keywords: StackedNotificationsBehavior, Control, Layout, InfoBar, Behavior +dev_langs: + - csharp +category: Xaml +subcategory: Behaviors +discussion-id: 0 +issue-id: 0 +icon: Assets/StackedNotificationsBehavior.png +--- + +The `StackedNotificationsBehavior` allows you to provide notifications within your app using an `InfoBar` control. This is a replacement for the prior `InAppNotification` control in the Toolkit. + +With the default settings, a notification will be displayed until it is dismissed by the user. Any subsequent notifications will be displayed +in the order of being sent afterwards one-by-one. + +## Example + +Clicking on the button multiple times will queue up multiple messages to be displayed one after another. + +> [!Sample StackedNotificationsBehaviorCustomSample] + +## Notification options + +By default, the properties provided on the attached `InfoBar` will be used, like `ContentTemplate` or `IsIconVisible`. + +However, there are a number of options available on the `Notification` class to override these. When set, these will override any defaults +or modified properties set on the parent `InfoBar` itself. They will be restored to the previously set value on the `InfoBar` after the message has been displayed. + +> [!WARNING] +> Properties set on the `InfoBar` will be modified directly by the behavior with notification overrides, this means any bindings will +> be broken by that change when it is overridden or restored by the notification. Therefore, it is best to only provide constants on the +> parent `InfoBar` itself that will be consistent for all messages and set any dynamic options in the `Notification` options. + +When a `Duration` is provided, if the user has their pointer over the message, it will not be dismissed. It will instead reset the time before +being dismissed once the pointer has left the active notification. + +## Migrating from InAppNotification + +If you previously used the `InAppNotification` component from the Windows Community Toolkit, like so: + +```xml + +``` + +You can simply replace it with an `InfoBar` control and add the attached behavior: + +```xml + + + + + +``` + +There are some changes to the `Show` method, however a simple text based one has been provided for backwards compatibility, +otherwise it's best to construct your own `Notification` object for greater flexibility or set common properties on the +parent `InfoBar` itself. + +> [!NOTE] +> There is no `StackMode` property to control the behavior of the queue. Providing a stable queue of messages one after another +> provides the best user experience as it reduces the risk when interacting with a notification for a new one to suddenly appear +> and replace the one being displayed. + +The `ShowDismissButton` property should be mapped to the `InfoBar.IsClosable` property instead. Similar to any adjustments to position +should be handled by the layout of the `InfoBar` control itself within the XAML layout. + +The `Closing` and `Closed` events can be mapped to those on the `InfoBar` as well. + +### Complete example + +This example shows sending simple text based notifications that will appear only for 2 seconds: + +> [!Sample StackedNotificationsBehaviorToolkitSample] diff --git a/components/Behaviors/samples/StackedNotificationsBehaviorCustomSample.xaml b/components/Behaviors/samples/StackedNotificationsBehaviorCustomSample.xaml new file mode 100644 index 00000000..1c57592f --- /dev/null +++ b/components/Behaviors/samples/StackedNotificationsBehaviorCustomSample.xaml @@ -0,0 +1,27 @@ + + + + +