-
Notifications
You must be signed in to change notification settings - Fork 742
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7374 from Youssef1313/issues/7372
fix: Don't use nullable reference types in generated code
- Loading branch information
Showing
4 changed files
with
50 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
src/SourceGenerators/XamlGenerationTests/TestNullable_ResourceDictionary.xaml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
<ResourceDictionary | ||
x:Class="UnoNullableContextGeneratedBug.TestTemplate" | ||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" | ||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" | ||
xmlns:local="using:UnoNullableContextGeneratedBug"> | ||
|
||
<DataTemplate x:Key="TestDataTemplate" x:DataType="local:TestViewModel"> | ||
<StackPanel> | ||
<!--This works--> | ||
<TextBlock Text="{x:Bind ObjectInstance, Mode=OneWay}"/> | ||
|
||
<!-- This generates code with a nullable error at compile time --> | ||
<TextBlock Text="{x:Bind ObjectInstance, Mode=TwoWay}"/> | ||
</StackPanel> | ||
</DataTemplate> | ||
|
||
</ResourceDictionary> |
24 changes: 24 additions & 0 deletions
24
src/SourceGenerators/XamlGenerationTests/TestNullable_ViewModel.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#nullable enable | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using System.Collections.ObjectModel; | ||
using System.ComponentModel; | ||
using System.Text; | ||
|
||
namespace UnoNullableContextGeneratedBug | ||
{ | ||
public class TestViewModel | ||
{ | ||
public TestViewModel() | ||
{ | ||
ObjectInstance = new ThrowawayClass(); | ||
} | ||
|
||
public ThrowawayClass? ObjectInstance { get; set; } = new ThrowawayClass(); | ||
} | ||
|
||
public class ThrowawayClass | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters