Skip to content

Commit 3e27b6b

Browse files
fix(vsix): RemoteControl.VS throw exception during VS closing.
1 parent cc19803 commit 3e27b6b

File tree

1 file changed

+32
-6
lines changed

1 file changed

+32
-6
lines changed

src/Uno.UI.RemoteControl.VS/EntryPoint.cs

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class EntryPoint
3939
private System.Diagnostics.Process _process;
4040

4141
private int RemoteControlServerPort;
42+
private bool _closing = false;
4243

4344
public EntryPoint(DTE2 dte2, string toolsPath, AsyncPackage asyncPackage, Action<Func<Task<Dictionary<string, string>>>> globalPropertiesProvider)
4445
{
@@ -96,12 +97,36 @@ private void SetupOutputWindow()
9697
.Add(UnoPlatformOutputPane);
9798
}
9899

99-
_debugAction = s => owPane.OutputString("[DEBUG] " + s + "\r\n");
100-
_infoAction = s => owPane.OutputString("[INFO] " + s + "\r\n");
101-
_infoAction = s => owPane.OutputString("[INFO] " + s + "\r\n");
102-
_verboseAction = s => owPane.OutputString("[VERBOSE] " + s + "\r\n");
103-
_warningAction = s => owPane.OutputString("[WARNING] " + s + "\r\n");
104-
_errorAction = e => owPane.OutputString("[ERROR] " + e + "\r\n");
100+
_debugAction = s => {
101+
if (!_closing)
102+
{
103+
owPane.OutputString("[DEBUG] " + s + "\r\n");
104+
}
105+
};
106+
_infoAction = s => {
107+
if (!_closing)
108+
{
109+
owPane.OutputString("[INFO] " + s + "\r\n");
110+
}
111+
};
112+
_verboseAction = s => {
113+
if (!_closing)
114+
{
115+
owPane.OutputString("[VERBOSE] " + s + "\r\n");
116+
}
117+
};
118+
_warningAction = s => {
119+
if (!_closing)
120+
{
121+
owPane.OutputString("[WARNING] " + s + "\r\n");
122+
}
123+
};
124+
_errorAction = e => {
125+
if (!_closing)
126+
{
127+
owPane.OutputString("[ERROR] " + e + "\r\n");
128+
}
129+
};
105130

106131
_infoAction($"Uno Remote Control initialized ({GetAssemblyVersion()})");
107132
}
@@ -171,6 +196,7 @@ private async Task SolutionEvents_BeforeClosingAsync()
171196
}
172197
finally
173198
{
199+
_closing = true;
174200
_process = null;
175201
}
176202
}

0 commit comments

Comments
 (0)