yield return Create(Ldc_I4, lineInfo.LineNumber); //lineNumber
yield return Create(Ldc_I4, lineInfo.LinePosition); //linePosition
- yield return Create(Call, module.ImportMethodReference(("Xamarin.Forms.Xaml", "Xamarin.Forms.Xaml.Diagnostics", "VisualDiagnostics"),
+ yield return Create(Call, module.ImportMethodReference(("Xamarin.Forms.Core", "Xamarin.Forms.Xaml.Diagnostics", "VisualDiagnostics"),
methodName: "RegisterSourceInfo",
parameterTypes: new[] {
("mscorlib", "System", "Object"),
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Xamarin.Forms.Internals;
+using Xamarin.Forms.Xaml.Diagnostics;
namespace Xamarin.Forms
{
SetInheritedBindingContext(this, null);
}
+ VisualDiagnostics.SendVisualTreeChanged(this, value);
+
OnParentSet();
OnPropertyChanged();
<PackageReference Include="System.Dynamic.Runtime" Version="4.3.0" />
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
</ItemGroup>
+ <ItemGroup>
+ <Folder Include="Xaml\Diagnostics\" />
+ </ItemGroup>
<PropertyGroup>
<GitInfoReportImportance>high</GitInfoReportImportance>
</PropertyGroup>
// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
+
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
public static XamlSourceInfo GetXamlSourceInfo(object obj) => sourceInfos.TryGetValue(obj, out var sourceinfo) ? sourceinfo : null;
}
- public class XamlSourceInfo
- {
- public XamlSourceInfo(Uri sourceUri, int lineNumber, int linePosition)
- {
- SourceUri = sourceUri;
- LineNumber = lineNumber;
- LinePosition = linePosition;
- }
-
- public Uri SourceUri { get; }
- public int LineNumber { get; }
- public int LinePosition { get; }
-
- public void Deconstruct(out Uri sourceUri, out int lineNumber, out int linePosition)
- {
- sourceUri = SourceUri;
- lineNumber = LineNumber;
- linePosition = LinePosition;
- }
- }
-
- public class VisualTreeChangeEventArgs : EventArgs
- {
- public VisualTreeChangeEventArgs(object parent, object child, int childIndex, VisualTreeChangeType changeType)
- {
- Parent = parent;
- Child = child;
- ChildIndex = childIndex;
- ChangeType = changeType;
- }
-
- public object Parent { get; }
- public object Child { get; }
- public int ChildIndex { get; }
- public VisualTreeChangeType ChangeType { get; }
- }
-
public enum VisualTreeChangeType
{
Add = 0,
--- /dev/null
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System;
+
+namespace Xamarin.Forms.Xaml.Diagnostics
+{
+ public class VisualTreeChangeEventArgs : EventArgs
+ {
+ public VisualTreeChangeEventArgs(object parent, object child, int childIndex, VisualTreeChangeType changeType)
+ {
+ Parent = parent;
+ Child = child;
+ ChildIndex = childIndex;
+ ChangeType = changeType;
+ }
+
+ public object Parent { get; }
+ public object Child { get; }
+ public int ChildIndex { get; }
+ public VisualTreeChangeType ChangeType { get; }
+ }
+}
--- /dev/null
+// Copyright (c) Microsoft Corporation.
+// Licensed under the MIT License.
+
+using System;
+
+namespace Xamarin.Forms.Xaml.Diagnostics
+{
+ public class XamlSourceInfo
+ {
+ public XamlSourceInfo(Uri sourceUri, int lineNumber, int linePosition)
+ {
+ SourceUri = sourceUri;
+ LineNumber = lineNumber;
+ LinePosition = linePosition;
+ }
+
+ public Uri SourceUri { get; }
+ public int LineNumber { get; }
+ public int LinePosition { get; }
+
+ public void Deconstruct(out Uri sourceUri, out int lineNumber, out int linePosition)
+ {
+ sourceUri = SourceUri;
+ lineNumber = LineNumber;
+ linePosition = LinePosition;
+ }
+ }
+}
//If it's a BindableProberty, SetValue
if (xpe == null && TrySetValue(xamlelement, property, attached, value, lineInfo, serviceProvider, out xpe)) {
- if (!(node is ValueNode) && value != null && !value.GetType().GetTypeInfo().IsValueType && XamlFilePathAttribute.GetFilePathForObject(context.RootElement) is string path) {
+ if (!(node is ValueNode) && value != null && !value.GetType().GetTypeInfo().IsValueType && XamlFilePathAttribute.GetFilePathForObject(context.RootElement) is string path)
VisualDiagnostics.RegisterSourceInfo(value, new Uri(path, UriKind.Relative), ((IXmlLineInfo)node).LineNumber, ((IXmlLineInfo)node).LinePosition);
- VisualDiagnostics.SendVisualTreeChanged(xamlelement, value);
- }
return;
}
//If we can assign that value to a normal property, let's do it
if (xpe == null && TrySetProperty(xamlelement, localName, value, lineInfo, serviceProvider, context, out xpe)) {
- if (!(node is ValueNode) && value != null && !value.GetType().GetTypeInfo().IsValueType && XamlFilePathAttribute.GetFilePathForObject(context.RootElement) is string path) {
+ if (!(node is ValueNode) && value != null && !value.GetType().GetTypeInfo().IsValueType && XamlFilePathAttribute.GetFilePathForObject(context.RootElement) is string path)
VisualDiagnostics.RegisterSourceInfo(value, new Uri(path, UriKind.Relative), ((IXmlLineInfo)node).LineNumber, ((IXmlLineInfo)node).LinePosition);
- VisualDiagnostics.SendVisualTreeChanged(xamlelement, value);
- }
return;
}
//If it's an already initialized property, add to it
if (xpe == null && TryAddToProperty(xamlelement, propertyName, value, xKey, lineInfo, serviceProvider, context, out xpe)) {
- if (!(node is ValueNode) && value != null && !value.GetType().GetTypeInfo().IsValueType && XamlFilePathAttribute.GetFilePathForObject(context.RootElement) is string path) {
+ if (!(node is ValueNode) && value != null && !value.GetType().GetTypeInfo().IsValueType && XamlFilePathAttribute.GetFilePathForObject(context.RootElement) is string path)
VisualDiagnostics.RegisterSourceInfo(value, new Uri(path, UriKind.Relative), ((IXmlLineInfo)node).LineNumber, ((IXmlLineInfo)node).LinePosition);
- VisualDiagnostics.SendVisualTreeChanged(xamlelement, value);
- }
return;
}
#pragma warning disable CS0612 // Type or member is obsolete
[assembly: TypeForwardedTo(typeof(Xamarin.Forms.Xaml.Internals.INameScopeProvider))]
#pragma warning restore CS0612 // Type or member is obsolete
+
+[assembly: TypeForwardedTo(typeof(Xamarin.Forms.Xaml.Diagnostics.DebuggerHelper))]
+[assembly: TypeForwardedTo(typeof(Xamarin.Forms.Xaml.Diagnostics.VisualDiagnostics))]
+[assembly: TypeForwardedTo(typeof(Xamarin.Forms.Xaml.Diagnostics.VisualTreeChangeEventArgs))]
+[assembly: TypeForwardedTo(typeof(Xamarin.Forms.Xaml.Diagnostics.XamlSourceInfo))]