Skip to content

Commit

Permalink
"Attach to Hazelnut" button is no longer disabled after attaching
Browse files Browse the repository at this point in the history
- Temporarily made it so that "Attach to Hazelnut" button isn't disabled when attaching to Hazelnut (it caused problems because if the debugger is attached when closing Hazelnut the button won't be re-enabled)
  • Loading branch information
peter1745 committed Mar 23, 2022
1 parent e42ac72 commit 511fa7b
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
23 changes: 19 additions & 4 deletions HazelToolsVS/Debugging/HazelDebuggerSession.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
using System;
using System.ComponentModel.Design;
using System.IO;
using Mono.Debugging.Client;
using Mono.Debugging.Soft;
using Mono.Debugger.Soft;

namespace HazelToolsVS.Debugging
{
Expand All @@ -26,7 +28,7 @@ protected override void OnRun(DebuggerStartInfo startInfo)
case HazelSessionType.AttachHazelnutDebugger:
{
m_IsAttached = true;
m_AttachToHazelnutMenuItem.Enabled = false;
//m_AttachToHazelnutMenuItem.Enabled = false;
base.OnRun(hazelStartInfo);
break;
}
Expand All @@ -38,7 +40,7 @@ protected override void OnRun(DebuggerStartInfo startInfo)
protected override void OnAttachToProcess(ProcessInfo processInfo)
{
base.OnAttachToProcess(processInfo);
m_AttachToHazelnutMenuItem.Enabled = false;
//m_AttachToHazelnutMenuItem.Enabled = false;
}

protected override string GetConnectingMessage(DebuggerStartInfo dsi)
Expand All @@ -50,7 +52,19 @@ protected override void OnConnectionError(Exception ex)
{
// The session was manually terminated
if (HasExited)
{
//m_AttachToHazelnutMenuItem.Enabled = true;
base.OnConnectionError(ex);
return;
}

if (ex is VMDisconnectedException || ex is IOException)
{
HasExited = true;
base.OnConnectionError(ex);
//m_AttachToHazelnutMenuItem.Enabled = true;
return;
}

string message = "An error occured when trying to attach to Hazelnut. Please make sure that Hazelnut is running and that it's up-to-date.";
message += Environment.NewLine;
Expand All @@ -71,22 +85,23 @@ protected override void OnConnectionError(Exception ex)
}

_ = HazelToolsPackage.Instance.ShowErrorMessageBoxAsync("Connection Error", message);
m_AttachToHazelnutMenuItem.Enabled = true;
//m_AttachToHazelnutMenuItem.Enabled = true;
base.OnConnectionError(ex);
}

protected override void OnExit()
{
if (m_IsAttached)
{
m_IsAttached = false;
base.OnDetach();
}
else
{
base.OnExit();
}

m_AttachToHazelnutMenuItem.Enabled = true;
//m_AttachToHazelnutMenuItem.Enabled = true;
}
}
}
2 changes: 1 addition & 1 deletion HazelToolsVS/LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Peter Nilsson
Copyright (c) 2022 Studio Cherno

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
2 changes: 1 addition & 1 deletion HazelToolsVS/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
<Metadata>
<Identity Id="HazelToolsVS" Version="1.2.0" Language="en-US" Publisher="Peter Nilsson" />
<Identity Id="HazelToolsVS" Version="1.2.0" Language="en-US" Publisher="Studio Cherno" />
<DisplayName>Hazel Tools</DisplayName>
<Description xml:space="preserve">Visual Studio integration with the Hazelnut editor, including C# script debugging support</Description>
<MoreInfo>https://github.com/peter1745/HazelTools-VisualStudio</MoreInfo>
Expand Down

0 comments on commit 511fa7b

Please sign in to comment.