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

Csc invoked in XamlPrecompile doesn't get Nullable passed #6088

Closed
huoyaoyuan opened this issue Jan 26, 2021 · 0 comments · Fixed by #6093
Closed

Csc invoked in XamlPrecompile doesn't get Nullable passed #6088

huoyaoyuan opened this issue Jan 26, 2021 · 0 comments · Fixed by #6093

Comments

@huoyaoyuan
Copy link
Member

Issue Description

Csc invoked in XamlPrecompile doesn't get Nullable passed, and results in warning for NRT disabled when the project file has <Nullable>enable</Nullable>.

Root cause of dotnet/roslyn#46420 .

Steps to Reproduce

  1. Create a WinUI 3 template application.
  2. Ensure there is some xaml.
  3. Add <Nullable>enable</Nullable> in project file.
  4. Write some code with nullable reference type, such as a string? field in App.

Expected Behavior

Build without warning.

Actual Behavior

The IDE reports no warning. Build output reports warning CS8632: nullable reference types can only be used under #nullable enable.

Analysis

https://github.com/dotnet/roslyn/blob/4f1711c578fd260221f968696ab07b125581b9e1/src/Compilers/Core/MSBuildTask/Microsoft.CSharp.Core.targets#L113

The <Nullable> property is missing in Microsoft.CSharp.CurrentVersion.targets:

NoConfig="true"
NoLogo="$(NoLogo)"
NoStandardLib="$(NoCompilerStandardLib)"
NoWin32Manifest="$(NoWin32Manifest)"
Optimize="$(Optimize)"

Versions & Configurations

Visual Studio 16.8 - 16.9 Preview 3

Attach a binlog

(Not necessary I think)

@huoyaoyuan huoyaoyuan added bug needs-triage Have yet to determine what bucket this goes in. labels Jan 26, 2021
@benvillalobos benvillalobos removed the needs-triage Have yet to determine what bucket this goes in. label Feb 3, 2021
@AR-May AR-May added the triaged label Feb 21, 2024
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.

3 participants