microsoft / XamlBehaviorsWpf

Home for WPF XAML Behaviors on GitHub.
MIT License
839 stars 138 forks source link

Updated UnitTests to use the same strongnaming logic as the main SDK #178

Closed jstedfast closed 3 weeks ago

jstedfast commented 3 weeks ago

Description of Change

Describe your changes here.

Bugs Fixed

API Changes

List all API changes here (or just put None), example:

Added:

Changed:

Behavioral Changes

Describe any non-bug related behavioral changes that may change how users app behaves when upgrading to this version of the codebase.

PR Checklist

jstedfast commented 3 weeks ago

Okay, so I think we have to strongname UnitTests.dll so that InternalsVisibleTo works, but we also need to strongname Microsoft.Xaml.Behaviors.dll so that UnitTests.dll doesn't complain that it's loading an unsigned assembly.

jstedfast commented 3 weeks ago

Ugh! still failing:

Error: D:\a\XamlBehaviorsWpf\XamlBehaviorsWpf\Test\UnitTests\KeyTriggerTest.cs(20,25): error CS0281: Friend access was granted by 'Microsoft.Xaml.Behaviors, Version=1.1.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a', but the public key of the output assembly ('') does not match that specified by the InternalsVisibleTo attribute in the granting assembly. [D:\a\XamlBehaviorsWpf\XamlBehaviorsWpf\Test\UnitTests\UnitTests.csproj]

mgoertz-msft commented 3 weeks ago

Hmm, seems to me that SignAssembly and DelaySign should always be true for all assemblies. And in the official build the product assembly would actually get signed.

jstedfast commented 3 weeks ago

I got this building/running locally and the issue seemed to be some sort of incompatibility between msbuild and dotnet test not being able to run the built tests without having issues.

Once switching over to vstest.console.exe, it worked locally. Hopefully the same will be true on the bots.

jstedfast commented 3 weeks ago

Run microsoft/vstest-action@v1.0.0 with: testAssembly: Test\UnitTests\bin\Release\net462\UnitTests.dll resultLogsArtifactName: vs-test-result-logs ifNoFilesFound: warn env: DOTNET_ROOT: C:\Users\runneradmin\AppData\Local\Microsoft\dotnet GitAssemblyInformationalVersion: 1.1.135+b1f1bcd790 GitBuildVersion: 1.1.135.61873 GitBuildVersionSimple: 1.1.135 Downloading test tools... C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe Invoke-WebRequest -Uri https://aka.ms/local-worker-win-x6[4](https://github.com/microsoft/XamlBehaviorsWpf/actions/runs/10583947960/job/29327060389?pr=178#step:7:4) -OutFile D:\a_actions\microsoft\vstest-action\v1.0.0\dist\win-x64.zip Invoke-WebRequest : The remote name could not be resolved: 'localworker.blob.core.windows.net' At line:1 char:1

Error: The process 'C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe' failed with exit code 1 Warning: No files were found with the provided path: TestResults. No artifacts will be uploaded.

jstedfast commented 3 weeks ago

Looks like the vstest action is broken due to a link to a non-existent resource on the web.

I propose deleting the GitHub pipeline