Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 23 additions & 40 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,17 +29,19 @@ env:
# Azure Pipelines' last preview package was 99.0.0-preview1416, so GitHub runs continue at 1417.
# Keeping the number at four digits keeps SemVer's lexical ordering of `previewNNNN` correct.
PreviewNumberOffset: 1416
NET_VERSION: '10.0.x'
# global.json pins the .NET 11 SDK, which builds everything; the unit tests also need the .NET 8, 9 and 10 runtimes
NET_VERSION: '11.0.x'
# .NET 11 is a release candidate until GA, and after GA the 'preview' feed stays on the last RC (as the 8.0, 9.0 and 10.0 feeds do), so switch to 'ga' together with global.json
NET_QUALITY: 'preview'
PathToSolution: 'AsyncAwaitBestPractices.slnx'
PathToSampleAppCsproj: 'sample/HackerNews.csproj'
PathToUnitTestsCsproj: 'src/AsyncAwaitBestPractices.UnitTests/AsyncAwaitBestPractices.UnitTests.csproj'
PathToAsyncAwaitBestPracticesCsproj: 'src/AsyncAwaitBestPractices/AsyncAwaitBestPractices.csproj'
PathToAsyncAwaitBestPracticesMVVMCsproj: 'src/AsyncAwaitBestPractices.MVVM/AsyncAwaitBestPractices.MVVM.csproj'
Xcode_Version: 'latest-stable'

jobs:
build_sample:
name: Build .NET MAUI Sample App (${{ matrix.name }})
name: Build Blazor Sample App (${{ matrix.name }})
runs-on: ${{ matrix.image }}
timeout-minutes: 60
strategy:
Expand All @@ -49,50 +51,31 @@ jobs:
- name: Windows
image: windows-latest
- name: macOS
image: xcode-27
image: macos-latest

steps:
- name: Checkout
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- name: Set Xcode v${{ env.Xcode_Version }}
if: runner.os == 'macOS'
uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0
with:
xcode-version: ${{ env.Xcode_Version }}

- name: Download iOS Platform
if: runner.os == 'macOS'
run: |
xcodebuild -downloadPlatform iOS

echo "Installed Simulator SDKs:"
xcodebuild -showsdks

- name: Use .NET SDK v${{ env.NET_VERSION }}
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: ${{ env.NET_VERSION }}
dotnet-quality: 'ga'
dotnet-quality: ${{ env.NET_QUALITY }}

- name: Install .NET MAUI Workload
- name: Build Sample App
shell: bash
run: |
dotnet workload install maui
dotnet workload update
run: dotnet build "$PathToSampleAppCsproj"

- name: Build Sample App
# bash on GitHub runners runs with pipefail, so a failing `dotnet list` fails the step
- name: Check Sample App Dependencies Vulnerabilities
if: ${{ !cancelled() }}
shell: bash
run: |
if [ "$RUNNER_OS" = "macOS" ]; then
# HackerNews.csproj builds iOS for a device (ios-arm64), which requires code signing by default.
# This workflow has no Apple certificate or provisioning profile, so the macOS build skips code signing.
dotnet build "$PathToSampleAppCsproj" -p:EnableCodeSigning=false
else
dotnet build "$PathToSampleAppCsproj"
fi
dotnet list "$PathToSampleAppCsproj" package --vulnerable --include-transitive | tee "$RUNNER_TEMP/vulnerable-packages.txt"
if grep -q 'has the following vulnerable packages' "$RUNNER_TEMP/vulnerable-packages.txt"; then exit 1; fi

build_test_library:
name: Build + Test Library
Expand Down Expand Up @@ -124,15 +107,22 @@ jobs:
"NugetPackageVersion=$nugetPackageVersion" >> $env:GITHUB_ENV
"NuGet Package Version: ``$nugetPackageVersion``" >> $env:GITHUB_STEP_SUMMARY

- name: Use .NET SDKs 8.0.x, 9.0.x, ${{ env.NET_VERSION }}
# The unit tests run on these three runtimes; each SDK brings its runtime
- name: Use .NET SDKs 8.0.x, 9.0.x, 10.0.x
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: |
8.0.x
9.0.x
${{ env.NET_VERSION }}
10.0.x
dotnet-quality: 'ga'

- name: Use .NET SDK v${{ env.NET_VERSION }}
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: ${{ env.NET_VERSION }}
dotnet-quality: ${{ env.NET_QUALITY }}

- name: Run UnitTests
run: dotnet test $env:PathToUnitTestsCsproj -c Release --settings ".runsettings" --collect "code coverage" --logger trx --results-directory "$env:RUNNER_TEMP"

Expand Down Expand Up @@ -196,13 +186,6 @@ jobs:
if ($output -cmatch 'has the following vulnerable packages') { exit 1 }
exit 0

- name: Check Sample App Dependencies Vulnerabilities
if: ${{ !cancelled() }}
run: |
dotnet list $env:PathToSampleAppCsproj package --vulnerable --include-transitive | Tee-Object -Variable output
if ($output -cmatch 'has the following vulnerable packages') { exit 1 }
exit 0

- name: Copy NuGet Packages to Staging Directory
if: ${{ !startsWith(github.ref, 'refs/tags/') }}
run: |
Expand Down
19 changes: 6 additions & 13 deletions .github/workflows/dotnet-format-daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,18 +14,9 @@ jobs:
- name: Install .NET SDK
uses: actions/setup-dotnet@a98b56852c35b8e3190ac28c8c2271da59106c68 # v6.0.0
with:
dotnet-version: '10.0.x'
dotnet-quality: 'ga'

- uses: actions/setup-java@de7274f081f381c8f8158605e0321c36c376e2e6 # v6.0.1
with:
distribution: 'microsoft'
java-version: '21'

- name: Install .NET MAUI Workload
run: |
dotnet workload install maui
dotnet workload update
dotnet-version: '11.0.x'
# .NET 11 is a release candidate until GA, and after GA the 'preview' feed stays on the last RC (as the 8.0, 9.0 and 10.0 feeds do), so switch to 'ga' together with global.json
dotnet-quality: 'preview'

- name: Build solution
run: dotnet build AsyncAwaitBestPractices.slnx
Expand All @@ -34,8 +25,10 @@ jobs:
# Roslyn's "Add [Obsolete]" code fix, which adds the [Obsolete] attribute to every member that
# uses or overrides an obsolete API (see https://github.com/dotnet/format/issues/1230).
# Excluding them here only affects `dotnet format`; `dotnet build` still reports these warnings.
# The Bad page is excluded because it is the starting point of the talk's live coding,
# and `dotnet format` would apply the CA2016 code fix to it.
- name: Run dotnet format
run: dotnet format samples/CommunityToolkit.Maui.Sample.slnx --exclude-diagnostics CS0612 CS0618 CS0672 CS1062 CS1064
run: dotnet format AsyncAwaitBestPractices.slnx --exclude-diagnostics CS0612 CS0618 CS0672 CS1062 CS1064 --exclude sample/Components/Pages/NewsPage_BadAsyncAwaitPractices.cs

- name: Check for changes
id: format
Expand Down
3 changes: 0 additions & 3 deletions AsyncAwaitBestPractices.slnx
Original file line number Diff line number Diff line change
@@ -1,16 +1,13 @@
<Solution>
<Configurations>
<Platform Name="Any CPU" />
<Platform Name="iPhone" />
<Platform Name="iPhoneSimulator" />
</Configurations>
<Folder Name="/Sample/">
<Project Path="sample/HackerNews.csproj" />
</Folder>
<Folder Name="/Solution Items/">
<File Path=".editorconfig" />
<File Path="Directory.Build.props" />
<File Path="Directory.Build.targets" />
<File Path="global.json" />
</Folder>
<Folder Name="/Tests/">
Expand Down
12 changes: 0 additions & 12 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,6 @@
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>

<!-- MAUI Specific -->
<MauiPackageVersion>10.0.0</MauiPackageVersion>
<MauiStrictXamlCompilation>true</MauiStrictXamlCompilation>
<SkipValidateMauiImplicitPackageReferences>true</SkipValidateMauiImplicitPackageReferences>
<MauiEnableXamlCBindingWithSourceCompilation>true</MauiEnableXamlCBindingWithSourceCompilation>

<!-- Prevent NuGet Pacakge Vulnerabilities -->
<NuGetAudit>enable</NuGetAudit>
<NuGetAuditMode>all</NuGetAuditMode>
Expand Down Expand Up @@ -48,10 +42,6 @@
CS1712: Type parameter has no matching typeparam tag in the XML comment
CS1723: XML comment has cref attribute that refers to a type parameter
CS1734: XML comment has a paramref tag, but there is no parameter by that name
CsWinRT1028: Class implements WinRT interfaces but isn't marked partial
CsWinRT1030: Class implements WinRT interfaces that require unsafe code
XC0045: Binding: Property not found
XC0103: Consider attributing the markup extension with [RequireService] or [AcceptEmptyServiceProvider] if it doesn't require any
NU1900 Error communicating with package source, while getting vulnerability information.
NU1901 Package with low severity detected
NU1902 Package with moderate severity detected
Expand All @@ -64,8 +54,6 @@
<WarningsAsErrors>
nullable,
CS0419,CS0618,CS1570,CS1571,CS1572,CS1573,CS1574,CS1580,CS1581,CS1584,CS1587,CS1589,CS1590,CS1591,CS1592,CS1598,CS1658,CS1710,CS1711,CS1712,CS1723,CS1734,
CsWinRT1028,CsWinRT1030,
XC0045,XC0103,
NU1900,NU1901,NU1902,NU1903,NU1904,NU1905,
NUnit1001,NUnit1002,NUnit1003,NUnit1004,NUnit1005,NUnit1006,NUnit1007,NUnit1008,NUnit1009,NUnit1010,NUnit1011,NUnit1012,NUnit1013,NUnit1014,NUnit1015,NUnit1016,NUnit1017,NUnit1018,NUnit1019,NUnit1020,NUnit1021,NUnit1022,NUnit1023,NUnit1024,NUnit1025,NUnit1026,NUnit1027,NUnit1028,NUnit1029,NUnit1030,NUnit1031,NUnit1032,NUnit1033,
NUnit2001,NUnit2002,NUnit2003,NUnit2004,NUnit2005,NUnit2006,NUnit2007,NUnit2008,NUnit2009,NUnit2010,NUnit2011,NUnit2012,NUnit2013,NUnit2014,NUnit2015,NUnit2016,NUnit2017,NUnit2018,NUnit2019,NUnit2020,NUnit2021,NUnit2022,NUnit2023,NUnit2024,NUnit2025,NUnit2026,NUnit2027,NUnit2028,NUnit2029,NUnit2030,NUnit2031,NUnit2032,NUnit2033,
Expand Down
45 changes: 0 additions & 45 deletions Directory.Build.targets

This file was deleted.

4 changes: 2 additions & 2 deletions global.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"sdk": {
"version": "10.0.402",
"version": "11.0.100-rc.3.26522.148",
"rollForward": "latestFeature",
"allowPrerelease": false
"allowPrerelease": true
}
}
31 changes: 0 additions & 31 deletions sample/App.cs

This file was deleted.

9 changes: 0 additions & 9 deletions sample/AppShell.cs

This file was deleted.

20 changes: 20 additions & 0 deletions sample/Components/App.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<!DOCTYPE html>
<html lang="en">

<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<base href="/" />
@* An empty icon stops the browser from requesting /favicon.ico, which this app does not serve *@
<link rel="icon" href="data:," />
<link rel="stylesheet" href="app.css" />
<HeadOutlet @rendermode="InteractiveServer" />
</head>

<body>
@* No prerendering: each page initializes once, on the browser tab's circuit, where the talk's SynchronizationContext rules apply. Prerendering would run OnInitialized twice. *@
<Routes @rendermode="new InteractiveServerRenderMode(prerender: false)" />
<script src="_framework/blazor.web.js"></script>
</body>

</html>
22 changes: 22 additions & 0 deletions sample/Components/Layout/MainLayout.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
@inherits LayoutComponentBase
@using System.Runtime.InteropServices

<div class="demo-bar">
<nav class="demo-links" aria-label="Sample versions">
<NavLink class="demo-link" href="" Match="NavLinkMatch.All">Bad async/await</NavLink>
<NavLink class="demo-link" href="good" Match="NavLinkMatch.All">Good async/await</NavLink>
</nav>

<span class="demo-runtime">@RuntimeInformation.FrameworkDescription · Runtime async: <strong>@(RuntimeAsyncStatus.IsEnabled ? "on" : "off")</strong></span>
</div>

<main class="app-pane">
@Body
</main>

<div id="blazor-error-ui" data-nosnippet>
An unhandled error has occurred.
<a href="." class="reload">Reload</a>
@* Unlike the template's span, a button can be reached and pressed from the keyboard; blazor.web.js finds it by the dismiss class, whatever the element *@
<button type="button" class="dismiss" aria-label="Dismiss">&#x1F5D9;</button>
</div>
8 changes: 8 additions & 0 deletions sample/Components/Pages/Error.razor
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
@page "/Error"

<PageTitle>Refresh Failed</PageTitle>

<section class="error-panel">
<h1>Refresh failed</h1>
<p>The app hit an unexpected error while loading Hacker News.</p>
</section>
Loading
Loading