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

Using 3.1.1 and UWP #1741

Closed
jnyrup opened this issue Sep 28, 2023 · 3 comments · Fixed by #1885
Closed

Using 3.1.1 and UWP #1741

jnyrup opened this issue Sep 28, 2023 · 3 comments · Fixed by #1885

Comments

@jnyrup
Copy link
Contributor

jnyrup commented Sep 28, 2023

Describe the bug

In FluentAssertions we have a test project UWP.Specs exercising running FluentAssertions with UWP with <UseDotNetNativeToolchain>true</UseDotNetNativeToolchain> enabled.

With 3.0.4 I can I can run the test Determining_caller_identity_should_not_throw_for_native_programs from the Visual Studio Test Explorer.
With 3.1.1 I get build time and runtime diagnostics:

Build time warning

1>C:\Program Files (x86)\Microsoft SDKs\UWPNuGetPackages\microsoft.net.native.compiler\2.2.12-rel-31116-00\tools\Microsoft.NetNative.targets(809,5): warning : ILTransform : warning ILT0003: Method 'MSTestSettings.ValidateSettings(IMessageLogger)' will always throw an exception due to the missing method 'MSTestSettingsProvider.get_Settings()' in assembly 'Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices'. There may have been a missing assembly, or a dependency on a more recent Windows SDK release.

Runtime error

[Error] An exception occurred while test discoverer 'MSTestDiscoverer' was loading tests. Exception: Method 'MSTestSettingsProvider.get_Settings()' from assembly 'Microsoft.VisualStudio.TestPlatform.MSTestAdapter.PlatformServices' was not included in compilation, but was referenced in MSTestSettings.ValidateSettings(IMessageLogger). There may have been a missing assembly, or a dependency on a more recent Windows SDK release.

Steps To Reproduce

  1. Checkout https://github.com/fluentassertions/fluentassertions
  2. Change to release mode
  3. Right click on UWP.Specs and select build (it's excluded from the configuration manager)
  4. See that Determining_caller_identity_should_not_throw_for_native_programs succeeds
  5. Edit Tests\UWP.Specs\UWP.Specs.csproj to use 3.1.1
  6. Build UWP.Specs again
  7. See that Determining_caller_identity_should_not_throw_for_native_programs no longer runs.

Expected behavior

Determining_caller_identity_should_not_throw_for_native_programs should be executable

Actual behavior

Cannot execute Determining_caller_identity_should_not_throw_for_native_programs

Additional context

I tried to dig into this and it looks like this addition to MSTest.TestAdapter from #1669

internal static void ValidateSettings(IMessageLogger logger)
{
MSTestSettingsProvider.Settings.ValidateSettings(logger);
}

tries to reference code from MSTestAdapter.PlatformServices which is excluded for the UWP target.

#if !WINDOWS_UWP
/// <summary>
/// Member variable for Adapter settings.
/// </summary>
private static MSTestAdapterSettings? s_settings;
/// <summary>
/// Gets settings provided to the adapter.
/// </summary>
public static MSTestAdapterSettings Settings
{
get
{
s_settings ??= new MSTestAdapterSettings();
return s_settings;
}
}
/// <summary>
/// Reset the settings to its default.
/// </summary>
public static void Reset()
{
s_settings = null;
}
#endif

@Evangelink
Copy link
Member

Please @engyebrahim have a look at this issue.

@juanmalm
Copy link

Same issue here

@Evangelink
Copy link
Member

Hi @jnyrup! Sorry for the delay, I will be investigating the issue.

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

Successfully merging a pull request may close this issue.

4 participants