diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 6a069454..0dbdb54a 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -17,7 +17,6 @@ variables: PathToSamplesSln: 'samples/XCT.Sample.sln' PathToCommunityToolkitUnitTestCsproj: 'src/CommunityToolkit/Xamarin.CommunityToolkit.UnitTests/Xamarin.CommunityToolkit.UnitTests.csproj' PathToMarkupUnitTestCsproj: 'src/Markup/Xamarin.CommunityToolkit.Markup.UnitTests/Xamarin.CommunityToolkit.Markup.UnitTests.csproj' - PathToMsBuildOnMacOS: 'mono /Applications/Visual\ studio.app/Contents/Resources/lib/monodevelop/bin/MSBuild/Current/bin/MSBuild.dll' Codeql.Enabled: true resources: @@ -349,16 +348,35 @@ jobs: version: $(NETCORE_TEST_VERSION_2_1) includePreviewVersions: false - - task: CmdLine@2 - displayName: 'Build Markup' + # restore, build and pack the packages + - task: MSBuild@1 + displayName: Build Xamarin.CommunityToolkit.csproj inputs: - script: '$(PathToMsBuildOnMacOS) $(PathToMarkupCsproj) /p:Configuration=Release /restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false' - - - task: CmdLine@2 - displayName: 'Build Community Toolkit' + solution: $(PathToCommunityToolkitCsproj) + configuration: Release + msbuildArguments: '/restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false' + + - task: MSBuild@1 + displayName: Pack Community Toolkit NuGets inputs: - script: '$(PathToMsBuildOnMacOS) $(PathToCommunityToolkitCsproj) /p:Configuration=Release /restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false' - + solution: $(PathToCommunityToolkitCsproj) + configuration: Release + msbuildArguments: '/t:Pack /p:PackageVersion=$(NugetPackageVersion)' + + - task: MSBuild@1 + displayName: Build Markup Project + inputs: + solution: $(PathToMarkupCsproj) + configuration: Release + msbuildArguments: '/restore /t:Build /p:ContinuousIntegrationBuild=true /p:Deterministic=false' + + - task: MSBuild@1 + displayName: Pack Markup NuGet + inputs: + solution: $(PathToMarkupCsproj) + configuration: Release + msbuildArguments: '/t:Pack /p:PackageVersion=$(NugetPackageVersion)' + - task: CmdLine@2 displayName: 'Run Markup Unit Tests' inputs: @@ -368,16 +386,6 @@ jobs: displayName: 'Run Community Toolkit Unit Tests' inputs: script: 'dotnet test $(PathToCommunityToolkitUnitTestCsproj) -c Release -p:BuildInParallel=false' - - - task: CmdLine@2 - displayName: 'Pack Markup NuGets' - inputs: - script: '$(PathToMsBuildOnMacOS) $(PathToMarkupUnitTestCsproj) /p:Configuration=Release /t:Pack /p:PackageVersion=$(NugetPackageVersion)' - - - task: CmdLine@2 - displayName: 'Pack CommunityToolkit NuGets' - inputs: - script: '$(PathToMsBuildOnMacOS) $(PathToCommunityToolkitCsproj) /p:Configuration=Release /t:Pack /p:PackageVersion=$(NugetPackageVersion)' - ${{ if eq(variables['System.TeamProject'], 'devdiv') }}: - template: sign-artifacts/jobs/v2.yml@internal-templates diff --git a/src/CommunityToolkit/Xamarin.CommunityToolkit/Views/MediaElement/MacOS/MediaElementRenderer.macos.cs b/src/CommunityToolkit/Xamarin.CommunityToolkit/Views/MediaElement/MacOS/MediaElementRenderer.macos.cs index b554456a..66adb256 100644 --- a/src/CommunityToolkit/Xamarin.CommunityToolkit/Views/MediaElement/MacOS/MediaElementRenderer.macos.cs +++ b/src/CommunityToolkit/Xamarin.CommunityToolkit/Views/MediaElement/MacOS/MediaElementRenderer.macos.cs @@ -78,7 +78,7 @@ namespace Xamarin.CommunityToolkit.UI.Views } else if (uriSource.Uri != null) { - asset = AVUrlAsset.Create(NSUrl.FromString(uriSource.Uri.AbsoluteUri)); + asset = AVUrlAsset.Create(NSUrl.FromString(uriSource.Uri.AbsoluteUri) ?? throw new ArgumentException("Invalid Uri", "Source")); } else { @@ -88,7 +88,7 @@ namespace Xamarin.CommunityToolkit.UI.Views else { if (Element.Source is XCT.FileMediaSource fileSource) - asset = AVAsset.FromUrl(NSUrl.FromFilename(fileSource.File)); + asset = AVAsset.FromUrl(NSUrl.FromFilename(fileSource.File ?? throw new ArgumentException("Invalid file", "Source"))); } _ = asset ?? throw new NullReferenceException();