Skip to content

Failed build, functional evaluation of RichSuggestBox component tests #272

@Arlodotexe

Description

@Arlodotexe

Background

See also:

Problem

Following these steps to test:

  1. Generate solution with ./tooling/GenerateSingleSolution.ps1 -c RichSuggestBox
  2. When VS loads, navigate to folder components->RichSuggestBox->heads
  3. Unload RichSuggestBox.Wasm
  4. Right-click RichSuggestBox.Wasdk and select "Run Tests"

Results in this build error:

Severity Code Description Project File Line Suppression State
Error (active) CS0122 'RichSuggestBox.CommitSuggestionAsync(object)' is inaccessible due to its protection level RichSuggestBox.Tests.Wasdk V:\Windows\components\RichSuggestBox\tests\Test_RichSuggestBox.cs 362

Solution

This seems to be happening because RichSuggestBox.CommitSuggestionAsync is marked internal, which means InternalsVisibleTo isn't working as expected for test projects.

Specifically, the single-component solution template uses the AssemblyName ProjectTemplateExperiment.Tests.WinAppSdk, which doesn't match values accepted by our single-component tests InternalsVisibleTo declaration, in the format $(ToolkitComponentName).Tests.WinAppSdk.

The single-component project template is still using Experiment in the AssemblyName and RootNamespace instead of just using the component name. Correcting this should fix the overall problem.

Tested: Following the repro steps again after these changes results in a successful build.

Assessment of related code

While doing this, it would be wise to check similar files for consistency:

These are simple enough to change, but the nature of the change-- updating the MSBuild definitions for RootNamespace and AssemblyName in the single-solution component template-- needs further consideration of the side-effects this change brings.

Full change evaluation

In total, what needs to change when RootNamespace and AssemblyName are updated in a test head like this?

  • These changes are exclusive to highlighted single-component test heads, not to do with the gallery or our nuget packages.
  • Since we're using shproj instead of csproj for unit tests:
    • The root namespace is defined by the test head.
    • The root namespace may differ from the namespace used in shared test projects.
  • Tl;dr; namespaces can safely differ across shproj, but we should want consistency here.
  • Anywhere we have "ComponentNameExperiment" rather than "ComponentName" is a leftover artifact from when we first created our tooling for Labs.
  • Since we're aligning these for tests, we can align test code namespaces in the upstream repositories on tooling merge.

These changes will be submitted in a PR as prerequisite to the original ticket.

Metadata

Metadata

Assignees

Labels

dev loop ➰For issues that impact the core dev-loop of building experimentsregressionWhat was working is now broketesting 🏗

Type

No type

Projects

Status

✅ Done

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions