Exemple #1
0
        internal static void SetSourceLocation(object sender, SourceLocationFoundEventArgs args)
        {
            object target                    = args.Target;
            Type   targetType                = target.GetType();
            XamlDebuggerXmlReader reader     = (XamlDebuggerXmlReader)sender;
            bool shouldStoreAttachedProperty = false;

            if (reader.CollectNonActivitySourceLocation)
            {
                shouldStoreAttachedProperty = !targetType.Equals(typeof(string));
            }
            else
            {
                if (typeof(Activity).IsAssignableFrom(targetType))
                {
                    if (!typeof(IExpressionContainer).IsAssignableFrom(targetType))
                    {
                        if (!typeof(IValueSerializableExpression).IsAssignableFrom(targetType))
                        {
                            shouldStoreAttachedProperty = true;
                        }
                    }
                }
            }

            shouldStoreAttachedProperty = shouldStoreAttachedProperty && !args.IsValueNode;

            if (shouldStoreAttachedProperty)
            {
                SourceLocation sourceLocation = args.SourceLocation;
                XamlDebuggerXmlReader.SetStartLine(target, sourceLocation.StartLine);
                XamlDebuggerXmlReader.SetStartColumn(target, sourceLocation.StartColumn);
                XamlDebuggerXmlReader.SetEndLine(target, sourceLocation.EndLine);
                XamlDebuggerXmlReader.SetEndColumn(target, sourceLocation.EndColumn);
            }
        }