diff --git a/eng/Version.Details.xml b/eng/Version.Details.xml
index 7d373b76ff..83c8730ef3 100644
--- a/eng/Version.Details.xml
+++ b/eng/Version.Details.xml
@@ -6,13 +6,13 @@
https://dev.azure.com/microsoft/ProjectReunion/_git/WindowsAppSDK
f51f55b53b094d28a8fb117fe79fa354a3287c3b
-
+
https://dev.azure.com/microsoft/LiftedIXP/_git/DCPP
- 943a920dac1612ac395a09f42af287a08e6eddac
+ 26df64c7fa2693f44c179a7ba4c9df3257b76865
-
+
https://dev.azure.com/microsoft/LiftedIXP/_git/DCPP
- 943a920dac1612ac395a09f42af287a08e6eddac
+ 26df64c7fa2693f44c179a7ba4c9df3257b76865
diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CSharpPagePass2.cs b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CSharpPagePass2.cs
index 10cd4f1524..da91e55650 100644
--- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CSharpPagePass2.cs
+++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CSharpPagePass2.cs
@@ -598,8 +598,8 @@ private void Output_GetBindingConnectorCase(ConnectionIdElement element, bool is
}
private void Output_GetBindingConnectorMethod()
{
-this.Write(" /// \r\n /// GetBindingConnector(int connectionId, object t" +
- "arget)\r\n /// \r\n ");
+this.Write("\r\n /// \r\n /// GetBindingConnector(int connectionId, object" +
+ " target)\r\n /// \r\n ");
this.Write(this.ToStringHelper.ToStringWithCulture(GeneratedCodeAttribute));
@@ -1098,41 +1098,8 @@ private void Output_BindingsClasses()
foreach (BoundEventAssignment evt in element.BoundEventAssignments)
{
Output_ApiInformationCall_Push(evt.ApiInformation, Indent.ThreeTabs);
-this.Write(" this.");
-
-this.Write(this.ToStringHelper.ToStringWithCulture(evt.EventHandlerCodeName));
-
-this.Write(" = (");
-
-this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.Declaration()));
-
-this.Write(") =>\r\n {\r\n");
-
- PushIndent();
- if (!evt.PathStep.ValueType.IsDelegate())
- {
-this.Write(" ");
-
-this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));
-
-this.Write(";\r\n");
-
- }
- else
- {
-this.Write(" ");
-
-this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));
-
-this.Write("(");
-
-this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.ForCall()));
-
-this.Write(");\r\n");
-
- }
- PopIndent();
-this.Write(" };\r\n (");
+ Output_NullCheckedEventAssignment(evt);
+this.Write(" (");
this.Write(this.ToStringHelper.ToStringWithCulture(ObjectCast(element.Type.ToString(), "target")));
@@ -2744,6 +2711,54 @@ void Output_NullCheckedAssignment(BindPathStep step, LanguageSpecificString val
}
PopIndent();
}
+ void Output_NullCheckedEventAssignment(BoundEventAssignment evt)
+ {
+this.Write(" this.");
+
+this.Write(this.ToStringHelper.ToStringWithCulture(evt.EventHandlerCodeName));
+
+this.Write(" = (");
+
+this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.Declaration()));
+
+this.Write(") =>\r\n {\r\n");
+
+ foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) {
+this.Write(" if (");
+
+this.Write(this.ToStringHelper.ToStringWithCulture(parent.CodeGen().PathExpression));
+
+this.Write(" != null)\r\n {\r\n");
+
+ PushIndent();
+ }
+ if (!evt.PathStep.ValueType.IsDelegate()) {
+this.Write(" ");
+
+this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));
+
+this.Write(";\r\n");
+
+ } else {
+this.Write(" ");
+
+this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));
+
+this.Write("(");
+
+this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.ForCall()));
+
+this.Write(");\r\n");
+
+ }
+ foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) {
+ PopIndent();
+this.Write(" }\r\n");
+
+ }
+this.Write(" };\r\n");
+
+ }
void Output_UpdateErrors(BindUniverse bindUniverse)
{
var twoWayWithIndeiSteps = bindUniverse.INDEIPathSteps;
diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CSharpPagePass2.tt b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CSharpPagePass2.tt
index f49177d569..2c3abe1527 100644
--- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CSharpPagePass2.tt
+++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CSharpPagePass2.tt
@@ -318,6 +318,7 @@ namespace <#=Model.CodeInfo.ClassName.Namespace#>
<#+ private void Output_GetBindingConnectorMethod()#>
<#+ {#>
+
///
/// GetBindingConnector(int connectionId, object target)
///
@@ -561,19 +562,7 @@ namespace <#=Model.CodeInfo.ClassName.Namespace#>
<#+ foreach (BoundEventAssignment evt in element.BoundEventAssignments)#>
<#+ {#>
<#+ Output_ApiInformationCall_Push(evt.ApiInformation, Indent.ThreeTabs); #>
- this.<#=evt.EventHandlerCodeName#> = (<#=evt.Parameters.Declaration()#>) =>
- {
-<#+ PushIndent();#>
-<#+ if (!evt.PathStep.ValueType.IsDelegate())#>
-<#+ {#>
- <#=evt.PathStep.CodeGen().PathExpression#>;
-<#+ }#>
-<#+ else#>
-<#+ {#>
- <#=evt.PathStep.CodeGen().PathExpression#>(<#=evt.Parameters.ForCall()#>);
-<#+ }#>
-<#+ PopIndent();#>
- };
+<#+ Output_NullCheckedEventAssignment(evt); #>
(<#=ObjectCast(element.Type.ToString(), "target")#>).<#=evt.MemberName#> += <#=evt.EventHandlerCodeName#>;
<#+ Output_ApiInformationCall_Pop(evt.ApiInformation, Indent.ThreeTabs); #>
<#+ }#>
@@ -1473,6 +1462,27 @@ namespace <#=Model.CodeInfo.ClassName.Namespace#>
<#+ PopIndent();#>
<#+ } #>
+<#+ void Output_NullCheckedEventAssignment(BoundEventAssignment evt) #>
+<#+ { #>
+ this.<#=evt.EventHandlerCodeName#> = (<#=evt.Parameters.Declaration()#>) =>
+ {
+<#+ foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) { #>
+ if (<#=parent.CodeGen().PathExpression#> != null)
+ {
+<#+ PushIndent(); #>
+<#+ } #>
+<#+ if (!evt.PathStep.ValueType.IsDelegate()) { #>
+ <#=evt.PathStep.CodeGen().PathExpression#>;
+<#+ } else { #>
+ <#=evt.PathStep.CodeGen().PathExpression#>(<#=evt.Parameters.ForCall()#>);
+<#+ } #>
+<#+ foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) { #>
+<#+ PopIndent(); #>
+ }
+<#+ } #>
+ };
+<#+ } #>
+
<#+ void Output_UpdateErrors(BindUniverse bindUniverse) #>
<#+ { #>
<#+ var twoWayWithIndeiSteps = bindUniverse.INDEIPathSteps; #>
diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PageBinding.cs b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PageBinding.cs
index c57240691c..cfdddc647c 100644
--- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PageBinding.cs
+++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PageBinding.cs
@@ -633,37 +633,7 @@ private void Output_ConnectionId_Case(ConnectionIdElement element)
foreach (BoundEventAssignment evt in element.BoundEventAssignments) {
Output_ApiInformationCall_Push(evt.ApiInformation, Indent.ThreeTabs);
-this.Write(" targetElement.");
-
-this.Write(this.ToStringHelper.ToStringWithCulture(evt.MemberName));
-
-this.Write("([this](");
-
-this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.Declaration()));
-
-this.Write(")\r\n {\r\n");
-
- if (!evt.PathStep.ValueType.IsDelegate()) {
-this.Write(" ");
-
-this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));
-
-this.Write(";\r\n");
-
- } else {
-this.Write(" ");
-
-this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));
-
-this.Write("(");
-
-this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.ForCall()));
-
-this.Write(");\r\n");
-
- }
-this.Write(" });\r\n");
-
+ Output_NullCheckedEventAssignment(evt);
Output_ApiInformationCall_Pop(evt.ApiInformation, Indent.ThreeTabs);
}
if (element.CanBeInstantiatedLater && (element.HasBindAssignments || element.HasBoundEventAssignments))
@@ -847,6 +817,56 @@ void Output_NullCheckedAssignment(BindPathStep step, LanguageSpecificString val
}
PopIndent();
+ }
+ void Output_NullCheckedEventAssignment(BoundEventAssignment evt)
+ {
+this.Write(" targetElement.");
+
+this.Write(this.ToStringHelper.ToStringWithCulture(evt.MemberName));
+
+this.Write("([this](");
+
+this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.Declaration()));
+
+this.Write(")\r\n {\r\n");
+
+ PushIndent(Indent.ThreeTabs);
+ foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) {
+this.Write(" if (");
+
+this.Write(this.ToStringHelper.ToStringWithCulture(parent.CodeGen().PathExpression));
+
+this.Write(" != nullptr)\r\n {\r\n");
+
+ PushIndent();
+ }
+ if (!evt.PathStep.ValueType.IsDelegate()) {
+this.Write(" ");
+
+this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));
+
+this.Write(";\r\n");
+
+ } else {
+this.Write(" ");
+
+this.Write(this.ToStringHelper.ToStringWithCulture(evt.PathStep.CodeGen().PathExpression));
+
+this.Write("(");
+
+this.Write(this.ToStringHelper.ToStringWithCulture(evt.Parameters.ForCall()));
+
+this.Write(");\r\n");
+
+ }
+ foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) {
+ PopIndent();
+this.Write(" }\r\n");
+
+ }
+ PopIndent();
+this.Write(" });\r\n");
+
}
private void Output_UpdateChildListeners_Call(BindPathStep step, string parameter)
{
diff --git a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PageBinding.tt b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PageBinding.tt
index 082f340f04..0b9983b38b 100644
--- a/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PageBinding.tt
+++ b/src/XamlCompiler/BuildTasks/Microsoft/Xaml/XamlCompiler/CodeGenerators/CppWinRT/CppWinRT_PageBinding.tt
@@ -525,14 +525,7 @@
<#=element.ObjectCodeName#> = targetElement;
<#+ foreach (BoundEventAssignment evt in element.BoundEventAssignments) { #>
<#+ Output_ApiInformationCall_Push(evt.ApiInformation, Indent.ThreeTabs); #>
- targetElement.<#=evt.MemberName#>([this](<#=evt.Parameters.Declaration()#>)
- {
-<#+ if (!evt.PathStep.ValueType.IsDelegate()) { #>
- <#=evt.PathStep.CodeGen().PathExpression#>;
-<#+ } else { #>
- <#=evt.PathStep.CodeGen().PathExpression#>(<#=evt.Parameters.ForCall()#>);
-<#+ }#>
- });
+<#+ Output_NullCheckedEventAssignment(evt); #>
<#+ Output_ApiInformationCall_Pop(evt.ApiInformation, Indent.ThreeTabs); #>
<#+ }#>
<#+ if (element.CanBeInstantiatedLater && (element.HasBindAssignments || element.HasBoundEventAssignments))#>
@@ -638,6 +631,29 @@
<#+ PopIndent();#>
<#+ } #>
+<#+ void Output_NullCheckedEventAssignment(BoundEventAssignment evt) #>
+<#+ { #>
+ targetElement.<#=evt.MemberName#>([this](<#=evt.Parameters.Declaration()#>)
+ {
+<#+ PushIndent(Indent.ThreeTabs);#>
+<#+ foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) { #>
+ if (<#=parent.CodeGen().PathExpression#> != nullptr)
+ {
+<#+ PushIndent(); #>
+<#+ } #>
+<#+ if (!evt.PathStep.ValueType.IsDelegate()) { #>
+ <#=evt.PathStep.CodeGen().PathExpression#>;
+<#+ } else { #>
+ <#=evt.PathStep.CodeGen().PathExpression#>(<#=evt.Parameters.ForCall()#>);
+<#+ }#>
+<#+ foreach (var parent in evt.PathStep.Parents.Where(parent => parent.NeedsCheckForNull)) { #>
+<#+ PopIndent(); #>
+ }
+<#+ } #>
+<#+ PopIndent();#>
+ });
+<#+ } #>
+
<#+ private void Output_UpdateChildListeners_Call(BindPathStep step, string parameter)#>
<#+ {#>
<#+ if (step.NeedsUpdateChildListeners)#>