diff --git a/Avalonia.sln b/Avalonia.sln
index f49a3c8563..64ae13c66c 100644
--- a/Avalonia.sln
+++ b/Avalonia.sln
@@ -105,6 +105,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ControlCatalog.Desktop", "s
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ControlCatalog.iOS", "samples\ControlCatalog.iOS\ControlCatalog.iOS.csproj", "{57E0455D-D565-44BB-B069-EE1AA20F8337}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.DesignerSupport.Tests", "tests\Avalonia.DesignerSupport.Tests\Avalonia.DesignerSupport.Tests.csproj", "{52F55355-D120-42AC-8116-8410A7D602FA}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Avalonia.DesignerSupport.TestApp", "tests\Avalonia.DesignerSupport.TestApp\Avalonia.DesignerSupport.TestApp.csproj", "{F1381F98-4D24-409A-A6C5-1C5B1E08BB08}"
+EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "VirtualizationTest", "samples\VirtualizationTest\VirtualizationTest.csproj", "{FBCAF3D0-2808-4934-8E96-3F607594517B}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Interop", "Interop", "{A0CC0258-D18C-4AB3-854F-7101680FC3F9}"
@@ -1633,6 +1637,82 @@ Global
{57E0455D-D565-44BB-B069-EE1AA20F8337}.Release|iPhoneSimulator.Build.0 = Release|iPhoneSimulator
{57E0455D-D565-44BB-B069-EE1AA20F8337}.Release|NetCoreOnly.ActiveCfg = Release|iPhoneSimulator
{57E0455D-D565-44BB-B069-EE1AA20F8337}.Release|x86.ActiveCfg = Release|iPhone
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|NetCoreOnly.ActiveCfg = Debug|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Ad-Hoc|x86.Build.0 = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|Any CPU.Build.0 = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|iPhone.ActiveCfg = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|iPhone.Build.0 = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|NetCoreOnly.ActiveCfg = Debug|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|x86.ActiveCfg = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.AppStore|x86.Build.0 = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|NetCoreOnly.ActiveCfg = Debug|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|NetCoreOnly.Build.0 = Debug|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Debug|x86.Build.0 = Debug|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Release|iPhone.Build.0 = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Release|NetCoreOnly.ActiveCfg = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Release|NetCoreOnly.Build.0 = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Release|x86.ActiveCfg = Release|Any CPU
+ {52F55355-D120-42AC-8116-8410A7D602FA}.Release|x86.Build.0 = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|iPhone.Build.0 = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|iPhoneSimulator.Build.0 = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|NetCoreOnly.ActiveCfg = Debug|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|x86.ActiveCfg = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Ad-Hoc|x86.Build.0 = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|Any CPU.ActiveCfg = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|Any CPU.Build.0 = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|iPhone.ActiveCfg = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|iPhone.Build.0 = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|iPhoneSimulator.Build.0 = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|NetCoreOnly.ActiveCfg = Debug|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|x86.ActiveCfg = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.AppStore|x86.Build.0 = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|iPhone.ActiveCfg = Debug|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|iPhone.Build.0 = Debug|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|NetCoreOnly.ActiveCfg = Debug|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|NetCoreOnly.Build.0 = Debug|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Debug|x86.Build.0 = Debug|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|iPhone.ActiveCfg = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|iPhone.Build.0 = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|NetCoreOnly.ActiveCfg = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|NetCoreOnly.Build.0 = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|x86.ActiveCfg = Release|Any CPU
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08}.Release|x86.Build.0 = Release|Any CPU
{FBCAF3D0-2808-4934-8E96-3F607594517B}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
{FBCAF3D0-2808-4934-8E96-3F607594517B}.Ad-Hoc|Any CPU.Build.0 = Release|Any CPU
{FBCAF3D0-2808-4934-8E96-3F607594517B}.Ad-Hoc|iPhone.ActiveCfg = Release|Any CPU
@@ -2258,6 +2338,7 @@ Global
{050CC912-FF49-4A8B-B534-9544017446DD}.Debug|iPhoneSimulator.ActiveCfg = Debug|Any CPU
{050CC912-FF49-4A8B-B534-9544017446DD}.Debug|iPhoneSimulator.Build.0 = Debug|Any CPU
{050CC912-FF49-4A8B-B534-9544017446DD}.Debug|NetCoreOnly.ActiveCfg = Debug|Any CPU
+ {050CC912-FF49-4A8B-B534-9544017446DD}.Debug|NetCoreOnly.Build.0 = Debug|Any CPU
{050CC912-FF49-4A8B-B534-9544017446DD}.Debug|x86.ActiveCfg = Debug|Any CPU
{050CC912-FF49-4A8B-B534-9544017446DD}.Debug|x86.Build.0 = Debug|Any CPU
{050CC912-FF49-4A8B-B534-9544017446DD}.Release|Any CPU.ActiveCfg = Release|Any CPU
@@ -2267,6 +2348,7 @@ Global
{050CC912-FF49-4A8B-B534-9544017446DD}.Release|iPhoneSimulator.ActiveCfg = Release|Any CPU
{050CC912-FF49-4A8B-B534-9544017446DD}.Release|iPhoneSimulator.Build.0 = Release|Any CPU
{050CC912-FF49-4A8B-B534-9544017446DD}.Release|NetCoreOnly.ActiveCfg = Release|Any CPU
+ {050CC912-FF49-4A8B-B534-9544017446DD}.Release|NetCoreOnly.Build.0 = Release|Any CPU
{050CC912-FF49-4A8B-B534-9544017446DD}.Release|x86.ActiveCfg = Release|Any CPU
{050CC912-FF49-4A8B-B534-9544017446DD}.Release|x86.Build.0 = Release|Any CPU
{F40FC0A2-1BC3-401C-BFC1-928EC4D4A9CE}.Ad-Hoc|Any CPU.ActiveCfg = Release|Any CPU
@@ -2418,6 +2500,8 @@ Global
{D0A739B9-3C68-4BA6-A328-41606954B6BD} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{2B888490-D14A-4BCA-AB4B-48676FA93C9B} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{57E0455D-D565-44BB-B069-EE1AA20F8337} = {9B9E3891-2366-4253-A952-D08BCEB71098}
+ {52F55355-D120-42AC-8116-8410A7D602FA} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}
+ {F1381F98-4D24-409A-A6C5-1C5B1E08BB08} = {C5A00AC3-B34C-4564-9BDD-2DA473EF4D8B}
{FBCAF3D0-2808-4934-8E96-3F607594517B} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{A0CC0258-D18C-4AB3-854F-7101680FC3F9} = {9B9E3891-2366-4253-A952-D08BCEB71098}
{C7A69145-60B6-4882-97D6-A3921DD43978} = {A0CC0258-D18C-4AB3-854F-7101680FC3F9}
diff --git a/build.cake b/build.cake
index 4dfbf67c10..8728eae90a 100644
--- a/build.cake
+++ b/build.cake
@@ -194,6 +194,7 @@ Task("Run-Unit-Tests")
RunCoreTest("./tests/Avalonia.Markup.Xaml.UnitTests", parameters, false);
RunCoreTest("./tests/Avalonia.Styling.UnitTests", parameters, false);
RunCoreTest("./tests/Avalonia.Visuals.UnitTests", parameters, false);
+ RunCoreTest("./tests/Avalonia.DesignerSupport.UnitTests", parameters, false);
if (parameters.IsRunningOnWindows)
{
RunCoreTest("./tests/Avalonia.Direct2D1.UnitTests", parameters, true);
diff --git a/build/XUnit.props b/build/XUnit.props
index 1d7da7257d..15412d19e7 100644
--- a/build/XUnit.props
+++ b/build/XUnit.props
@@ -8,7 +8,7 @@
-
+
diff --git a/tests/Avalonia.DesignerSupport.TestApp/App.xaml b/tests/Avalonia.DesignerSupport.TestApp/App.xaml
new file mode 100644
index 0000000000..214bcd8797
--- /dev/null
+++ b/tests/Avalonia.DesignerSupport.TestApp/App.xaml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/Avalonia.DesignerSupport.TestApp/App.xaml.cs b/tests/Avalonia.DesignerSupport.TestApp/App.xaml.cs
new file mode 100644
index 0000000000..653a51232b
--- /dev/null
+++ b/tests/Avalonia.DesignerSupport.TestApp/App.xaml.cs
@@ -0,0 +1,17 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using Avalonia.Markup.Xaml;
+
+namespace Avalonia.DesignerSupport.TestApp
+{
+ public class App : Application
+ {
+ public override void Initialize()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+ }
+}
diff --git a/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj
new file mode 100644
index 0000000000..76017f96bd
--- /dev/null
+++ b/tests/Avalonia.DesignerSupport.TestApp/Avalonia.DesignerSupport.TestApp.csproj
@@ -0,0 +1,37 @@
+
+
+ Exe
+ netcoreapp2.0
+
+
+
+ %(Filename)
+
+
+ Designer
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/Avalonia.DesignerSupport.TestApp/MainWindow.xaml b/tests/Avalonia.DesignerSupport.TestApp/MainWindow.xaml
new file mode 100644
index 0000000000..6938bd8c49
--- /dev/null
+++ b/tests/Avalonia.DesignerSupport.TestApp/MainWindow.xaml
@@ -0,0 +1,5 @@
+
+
+
\ No newline at end of file
diff --git a/tests/Avalonia.DesignerSupport.TestApp/MainWindow.xaml.cs b/tests/Avalonia.DesignerSupport.TestApp/MainWindow.xaml.cs
new file mode 100644
index 0000000000..972e47c4cd
--- /dev/null
+++ b/tests/Avalonia.DesignerSupport.TestApp/MainWindow.xaml.cs
@@ -0,0 +1,13 @@
+using Avalonia.Controls;
+using Avalonia.Markup.Xaml;
+
+namespace Avalonia.DesignerSupport.TestApp
+{
+ public class MainWindow : Window
+ {
+ public MainWindow()
+ {
+ AvaloniaXamlLoader.Load(this);
+ }
+ }
+}
diff --git a/tests/Avalonia.DesignerSupport.TestApp/Program.cs b/tests/Avalonia.DesignerSupport.TestApp/Program.cs
new file mode 100644
index 0000000000..c7c60a4eca
--- /dev/null
+++ b/tests/Avalonia.DesignerSupport.TestApp/Program.cs
@@ -0,0 +1,24 @@
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using System.Threading.Tasks;
+using Avalonia.Controls;
+
+namespace Avalonia.DesignerSupport.TestApp
+{
+ static class Program
+ {
+ ///
+ /// The main entry point for the application.
+ ///
+ static void Main()
+ {
+ BuildAvaloniaApp().Start();
+ }
+
+ private static AppBuilder BuildAvaloniaApp()
+ {
+ return AppBuilder.Configure().UsePlatformDetect();
+ }
+ }
+}
diff --git a/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj b/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj
new file mode 100644
index 0000000000..94c2ed934d
--- /dev/null
+++ b/tests/Avalonia.DesignerSupport.Tests/Avalonia.DesignerSupport.Tests.csproj
@@ -0,0 +1,21 @@
+
+
+ netcoreapp2.0
+ Library
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/tests/Avalonia.DesignerSupport.Tests/DesignerSupportTests.cs b/tests/Avalonia.DesignerSupport.Tests/DesignerSupportTests.cs
new file mode 100644
index 0000000000..5386877876
--- /dev/null
+++ b/tests/Avalonia.DesignerSupport.Tests/DesignerSupportTests.cs
@@ -0,0 +1,119 @@
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Net;
+using System.Net.Sockets;
+using System.Runtime.InteropServices;
+using System.Text;
+using System.Threading;
+using System.Threading.Tasks;
+using Avalonia.Remote.Protocol;
+using Avalonia.Remote.Protocol.Designer;
+using Xunit;
+using Xunit.Extensions;
+
+namespace Avalonia.DesignerSupport.Tests
+{
+ public class DesignerSupportTests
+ {
+ private const string DesignerAppPath = "../../../../../src/tools/Avalonia.Designer.HostApp/bin/$BUILD/netcoreapp2.0/Avalonia.Designer.HostApp.dll";
+
+ [SkippableTheory,
+ InlineData(
+ @"..\..\..\..\..\tests/Avalonia.DesignerSupport.TestApp/bin/$BUILD/netcoreapp2.0/",
+ "Avalonia.DesignerSupport.TestApp",
+ "Avalonia.DesignerSupport.TestApp.dll",
+ @"..\..\..\..\..\tests\Avalonia.DesignerSupport.TestApp\MainWindow.xaml"),
+ InlineData(
+ @"..\..\..\..\..\samples\ControlCatalog.NetCore\bin\$BUILD\netcoreapp2.0\",
+ "ControlCatalog.NetCore",
+ "ControlCatalog.dll",
+ @"..\..\..\..\..\samples\ControlCatalog\MainWindow.xaml")]
+ public async Task Designer_In_Win32_Mode_Should_Provide_Valid_Hwnd(
+ string outputDir,
+ string executableName,
+ string assemblyName,
+ string xamlFile)
+ {
+ Skip.IfNot(RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
+
+ var xaml = File.ReadAllText(xamlFile);
+ string buildType;
+#if DEBUG
+ buildType = "Debug";
+#else
+ buildType = "Release";
+#endif
+ outputDir = outputDir.Replace("$BUILD", buildType);
+
+ var sessionId = Guid.NewGuid();
+ long handle = 0;
+
+ var resultMessageReceivedToken = new CancellationTokenSource();
+
+ var tcpListener = new TcpListener(IPAddress.Loopback, 0);
+ tcpListener.Start();
+ var port = ((IPEndPoint)tcpListener.LocalEndpoint).Port;
+ tcpListener.Stop();
+ var transport = new BsonTcpTransport();
+ transport.Listen(IPAddress.Loopback, port, conn =>
+ {
+ conn.OnMessage += async (_, msg) =>
+ {
+ if (msg is StartDesignerSessionMessage start)
+ {
+ Assert.Equal(sessionId, Guid.Parse(start.SessionId));
+ await conn.Send(new UpdateXamlMessage
+ {
+ AssemblyPath = Path.Combine(outputDir, assemblyName),
+ Xaml = xaml
+ });
+ }
+ else if (msg is UpdateXamlResultMessage result)
+ {
+ handle = result.Handle != null ? long.Parse(result.Handle) : 0;
+ resultMessageReceivedToken.Cancel();
+ conn.Dispose();
+ }
+ };
+ });
+
+ var cmdline =
+ $"exec --runtimeconfig \"{outputDir}{executableName}.runtimeconfig.json\" --depsfile \"{outputDir}{executableName}.deps.json\" "
+ + $" \"{DesignerAppPath.Replace("$BUILD", buildType)}\" "
+ + $"--transport tcp-bson://127.0.0.1:{port}/ --session-id {sessionId} --method win32 \"{outputDir}{executableName}.dll\"";
+
+ using (var proc = new Process
+ {
+ StartInfo = new ProcessStartInfo("dotnet", cmdline)
+ {
+ UseShellExecute = false,
+ RedirectStandardOutput = true,
+ RedirectStandardError = true,
+ CreateNoWindow = true,
+ },
+ EnableRaisingEvents = true
+ })
+ {
+ proc.Start();
+
+ var cancelled = false;
+ try
+ {
+ await Task.Delay(10000, resultMessageReceivedToken.Token);
+ }
+ catch (TaskCanceledException)
+ {
+ cancelled = true;
+ }
+
+ Assert.True(cancelled);
+ Assert.NotEqual(0, handle);
+ proc.Kill();
+ proc.WaitForExit();
+ }
+ }
+ }
+}