Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bump MSTest + VSTest and use MSTest.Sdk #203

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

Evangelink
Copy link
Collaborator

This is an alternative to #202 where I am using MSTest.Sdk feature we have developed.

This is our preferred way but decide what is the most comfortable for you.

More info:

@michael-hawker
Copy link
Member

To enable logs:

We have a flag for that here:

ENABLE_DIAGNOSTICS: false
- though we're trying to get it tied to the option within GitHub CommunityToolkit/Windows#453, but have been unsuccessful. Though we have an issue with slngen as well, so you need to modify lines 133 and 203 as well to remove ${{ env.ENABLE_DIAGNOSTICS == 'true' && ' -UseDiagnostics' || '' }}

I also saw there was an issue building with multiple entry points in the other steps:

 "D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\heads\WinAppSdk\ProjectTemplate.WinAppSdk.csproj" (default target) (9:6) ->

[5795](https://github.com/CommunityToolkit/Tooling-Windows-Submodule/actions/runs/10216147871/job/28277401688#step:10:5796)(PrepareForPublish target) ->

[5796](https://github.com/CommunityToolkit/Tooling-Windows-Submodule/actions/runs/10216147871/job/28277401688#step:10:5797)  C:\Program Files\dotnet\sdk\8.0.303\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(204,5): warning NETSDK1198: A publish profile with the name 'win-x64.pubxml' was not found in the project. Set the PublishProfile property to a valid file name. [D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\heads\WinAppSdk\ProjectTemplate.WinAppSdk.csproj]

[5797](https://github.com/CommunityToolkit/Tooling-Windows-Submodule/actions/runs/10216147871/job/28277401688#step:10:5798)

[5798](https://github.com/CommunityToolkit/Tooling-Windows-Submodule/actions/runs/10216147871/job/28277401688#step:10:5799)

[5799](https://github.com/CommunityToolkit/Tooling-Windows-Submodule/actions/runs/10216147871/job/28277401688#step:10:5800)"D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\ProjectTemplate.sln" (default target) (1:2) ->

[5800](https://github.com/CommunityToolkit/Tooling-Windows-Submodule/actions/runs/10216147871/job/28277401688#step:10:5801)"D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\heads\Tests.WinAppSdk\ProjectTemplate.Tests.WinAppSdk.csproj" (default target) (6:6) ->

[5801](https://github.com/CommunityToolkit/Tooling-Windows-Submodule/actions/runs/10216147871/job/28277401688#step:10:5802)(XamlPreCompile target) ->

[5802](https://github.com/CommunityToolkit/Tooling-Windows-Submodule/actions/runs/10216147871/job/28277401688#step:10:5803)  C:\Users\runneradmin\.nuget\packages\microsoft.net.test.sdk\17.10.0\build\netcoreapp3.1\Microsoft.NET.Test.Sdk.Program.cs(4,41): error CS0017: Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point. [D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\heads\Tests.WinAppSdk\ProjectTemplate.Tests.WinAppSdk.csproj]

@michael-hawker
Copy link
Member

FYI @Arlodotexe we should probably remove the broken slngen diagnostic flag inclusion from our workflows...

@Arlodotexe
Copy link
Member

FYI @Arlodotexe we should probably remove the broken slngen diagnostic flag inclusion from our workflows...

PR submitted #204

@Arlodotexe
Copy link
Member

Looks like this PR is having the same error as #202:

"D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\ProjectTemplate.sln" (default target) (1:2) ->
"D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\heads\Tests.WinAppSdk\ProjectTemplate.Tests.WinAppSdk.csproj" (default target) (6:6) ->
(XamlPreCompile target) -> 
  C:\Users\runneradmin\.nuget\packages\microsoft.net.test.sdk\17.10.0\build\netcoreapp3.1\Microsoft.NET.Test.Sdk.Program.cs(4,41): error CS0017: Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point. [D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\heads\Tests.WinAppSdk\ProjectTemplate.Tests.WinAppSdk.csproj]

@Arlodotexe
Copy link
Member

@Evangelink Do you have any insights on the error being thrown in CI? Did this build and run locally for you?

@Evangelink
Copy link
Collaborator Author

dotnet test locally is giving me:

image

and the failures on CommunityToolkit.Tooling.SampleGen.Tests.dll are:

failed PaneOption_GeneratesWithoutDiagnostics 2s 760ms
Assert.IsTrue failed. Expected no generated compilation errors. Got: 
[CS1069: The type name 'INotifyPropertyChanged' could not be found in the namespace 'System.ComponentModel'. This type has been forwarded to assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly.]
[CS1069: The type name 'PropertyChangedEventHandler' could not be found in the namespace 'System.ComponentModel'. This type has been forwarded to assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly.]
[CS1069: The type name 'PropertyChangedEventArgs' could not be found in the namespace 'System.ComponentModel'. This type has been forwarded to assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly.]
[CS0066: 'Sample.PropertyChanged': event must be of a delegate type]
[CS0012: The type 'INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.]
[CS0012: The type 'INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.]
[CS0012: The type 'INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.]
[CS1061: 'IGeneratedToolkitSampleOptionViewModel' does not contain a definition for 'PropertyChanged' and no accessible extension method 'PropertyChanged' accepting a first argument of type 'IGeneratedToolkitSampleOptionViewModel' could be found (are you missing a using directive or an assembly reference?)]
[CS0012: The type 'INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.]
[CS1061: 'IGeneratedToolkitSampleOptionViewModel' does not contain a definition for 'PropertyChanged' and no accessible extension method 'PropertyChanged' accepting a first argument of type 'IGeneratedToolkitSampleOptionViewModel' could be found (are you missing a using directive or an assembly reference?)]
[CS0012: The type 'INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.]
[CS0012: The type 'INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.]
[CS1069: The type name 'PropertyChangedEventArgs' could not be found in the namespace 'System.ComponentModel'. This type has been forwarded to assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly.]
[CS0012: The type 'INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.]
[CS0012: The type 'INotifyPropertyChanged' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'.]
[CS1069: The type name 'PropertyChangedEventArgs' could not be found in the namespace 'System.ComponentModel'. This type has been forwarded to assembly 'System.ObjectModel, Version=6.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a' Consider adding a reference to that assembly.]
Stack Trace:
   at CommunityToolkit.Tooling.SampleGen.Tests.Helpers.TestHelpers.AssertNoCompilationErrors(Compilation outputCompilation) in C:\src\Tooling-Windows-Submodule\CommunityToolkit.Tooling.SampleGen.Tests\Helpers\TestHelpers.cs:line 48
   at CommunityToolkit.Tooling.SampleGen.Tests.Helpers.TestHelpers.AssertNoCompilationErrors(SourceGeneratorRunResult result) in C:\src\Tooling-Windows-Submodule\CommunityToolkit.Tooling.SampleGen.Tests\Helpers\TestHelpers.cs:line 65
   at CommunityToolkit.Tooling.SampleGen.Tests.ToolkitSampleGeneratedPaneTests.PaneOption_GeneratesWithoutDiagnostics() in C:\src\Tooling-Windows-Submodule\CommunityToolkit.Tooling.SampleGen.Tests\ToolkitSampleGeneratedPaneTests.cs:line 50

@Evangelink
Copy link
Collaborator Author

@Arlodotexe This is now running tests successfully locally so I expect this to be good on CI, let's see.
image

@michael-hawker
Copy link
Member

Looks like similar errors in the two jobs:

"D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\ProjectTemplate.sln" (default target) (1:2) ->
"D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\heads\WinAppSdk\ProjectTemplate.WinAppSdk.csproj" (default target) (9:6) ->
(PrepareForPublish target) -> 
  C:\Program Files\dotnet\sdk\8.0.401\Sdks\Microsoft.NET.Sdk\targets\Microsoft.NET.Publish.targets(204,5): warning NETSDK1198: A publish profile with the name 'win-x64.pubxml' was not found in the project. Set the PublishProfile property to a valid file name. [D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\heads\WinAppSdk\ProjectTemplate.WinAppSdk.csproj]


"D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\ProjectTemplate.sln" (default target) (1:2) ->
"D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\heads\Tests.WinAppSdk\ProjectTemplate.Tests.WinAppSdk.csproj" (default target) (6:6) ->
(XamlPreCompile target) -> 
  C:\Users\runneradmin\.nuget\packages\microsoft.net.test.sdk\17.10.0\build\netcoreapp3.1\Microsoft.NET.Test.Sdk.Program.cs(4,41): error CS0017: Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point. [D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\heads\Tests.WinAppSdk\ProjectTemplate.Tests.WinAppSdk.csproj]

And in the new_experiment also:

"D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\components\CiTestExp\CiTestExp.sln" (default target) (1:2) ->
"D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\components\CiTestExp\heads\Uwp\CiTestExp.Uwp.csproj" (default target) (4:6) ->
(BuildNativePackage target) -> 
  C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.12-rel-31116-00\tools\Microsoft.NetNative.targets(809,5): error : Internal compiler error: Failed to parse 'S' [D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\components\CiTestExp\heads\Uwp\CiTestExp.Uwp.csproj]

@Arlodotexe
Copy link
Member

error : Internal compiler error: Failed to parse 'S' [D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\components\CiTestExp\heads\Uwp\CiTestExp.Uwp.csproj]

This is a transient error with .NET native, should pass with a rerun.

@Arlodotexe
Copy link
Member

Still seeing this error produced in CI:

"D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\heads\Tests.WinAppSdk\ProjectTemplate.Tests.WinAppSdk.csproj" (default target) (6:6) ->
(XamlPreCompile target) -> 
  C:\Users\runneradmin\.nuget\packages\microsoft.net.test.sdk\17.10.0\build\netcoreapp3.1\Microsoft.NET.Test.Sdk.Program.cs(4,41): error CS0017: Program has more than one entry point defined. Compile with /main to specify the type that contains the entry point. [D:\a\Tooling-Windows-Submodule\Tooling-Windows-Submodule\tooling\ProjectTemplate\heads\Tests.WinAppSdk\ProjectTemplate.Tests.WinAppSdk.csproj]

@Evangelink
Copy link
Collaborator Author

Sorry I will investigate later today. It makes no sense why it's working locally.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants