Skip to content
This repository was archived by the owner on Aug 12, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions RaspberryDebugger/Commands/DebugStartCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -205,24 +205,26 @@ await NeonHelper.WaitForAsync(async () =>

if (!launchReady) return;

OpenWebBrowser(projectProperties, foundWebServer, connection);
await Task.Delay(3000);
OpenWebBrowser(projectProperties, projectSettings, foundWebServer, connection);
}
}

/// <summary>
/// Open web browser for debugging
/// </summary>
/// <param name="projectProperties">Related project properties</param>
/// <param name="projectSettings"></param>
/// <param name="foundWebServer">Active WebServer: Kestrel or Other (NGiNX, Apache, etc.)</param>
/// <param name="connection">LinuxSshProxy connection</param>
private static void OpenWebBrowser(
ProjectProperties projectProperties,
WebServer foundWebServer,
private static void OpenWebBrowser(ProjectProperties projectProperties,
ProjectSettings projectSettings,
WebServer foundWebServer,
LinuxSshProxy connection)
{
// only '/' present or full relative uri
const int fullRelativeUri = 2;
var baseUri = $"http://{connection.Name}.local";
var baseUri = projectSettings.UseWebServerProxy ? $"http://{connection.Name}.local" : $"http://{connection.Name}";

var relativeBrowserUri = projectProperties.AspRelativeBrowserUri.FirstOrDefault() == '/'
? projectProperties.AspRelativeBrowserUri
Expand Down
28 changes: 14 additions & 14 deletions RaspberryDebugger/Commands/ProxyWebServer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,13 +37,13 @@ private static (bool, WebServer) SearchKrestel(int aspPort, LinuxSshProxy connec
{
// search for dotnet kestrel web server
var appKestrelListeningScript =
$@"
if lsof -i -P -n | grep --quiet 'dotnet\|TCP\|:{aspPort}' ; then
exit 0
else
exit 1
fi
";
$"""
if lsof -i -P -n | grep --quiet 'dotnet\|TCP\|:{aspPort}' ; then
exit 0
else
exit 1
fi
""";

var response = ExecSudoCmd(appKestrelListeningScript, connection);

Expand All @@ -62,13 +62,13 @@ private static (bool, WebServer) SearchReverseProxy(int aspPort, LinuxSshProxy c
{
// search for web server running as reverse proxy
var appWebServerListeningScript =
$@"
if lsof -i -P -n | grep --quiet 'TCP 127.0.0.1:{aspPort}' ; then
exit 0
else
exit 1
fi
";
$"""
if lsof -i -P -n | grep --quiet 'TCP 127.0.0.1:{aspPort}' ; then
exit 0
else
exit 1
fi
""";

var response = ExecSudoCmd(appWebServerListeningScript, connection);

Expand Down
391 changes: 224 additions & 167 deletions RaspberryDebugger/Connection/Connection.cs

Large diffs are not rendered by default.

10 changes: 9 additions & 1 deletion RaspberryDebugger/Connection/Status.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ internal class Status
/// </summary>
/// <param name="processor">The chip architecture.</param>
/// <param name="hasUnzip">Indicates whether <b>unzip</b> is installed.</param>
/// <param name="hasLsof">Indicates whether <b>lsof</b> is installed.</param>
/// <param name="hasDebugger">Indicates whether the debugger is installed.</param>
/// <param name="installedSdks">The installed .NET Core SDKs.</param>
/// <param name="path">The current value of the PATH environment variable.</param>
Expand All @@ -43,6 +44,7 @@ public Status(
string processor,
string path,
bool hasUnzip,
bool hasLsof,
bool hasDebugger,
IEnumerable<Sdk> installedSdks,
string model,
Expand All @@ -56,6 +58,7 @@ public Status(
this.Processor = processor;
this.Path = path;
this.HasUnzip = hasUnzip;
this.HasLsof = hasLsof;
this.HasDebugger = hasDebugger;
this.InstalledSdks = installedSdks?.ToList();
this.RaspberryModel = model;
Expand All @@ -77,7 +80,12 @@ public Status(
/// Returns <c>true</c> if <b>unzip</b> is installed on the Raspberry Pi.
/// This is required and will be installed automatically.
/// </summary>
private bool HasUnzip { get; set; }
public bool HasUnzip { get; set; }
/// <summary>
/// Returns <c>true</c> if <b>lsof</b> is installed on the Raspberry Pi.
/// This is required and will be installed automatically.
/// </summary>
public bool HasLsof { get; set; }

/// <summary>
/// Indicates whether the <b>vsdbg</b> debugger is installed.
Expand Down
51 changes: 43 additions & 8 deletions RaspberryDebugger/DebugHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -283,20 +283,40 @@ private static async Task<bool> PublishProjectAsync(DTE2 dte, Solution solution,

var errorList = dte?.ToolWindows.ErrorList.ErrorItems;

var warnings = 0;
var messages = 0;
if (errorList?.Count > 0)
{
var errors = 0;
for (var i = 1; i <= errorList.Count; i++)
{
var error = errorList.Item(i);
Log.Error($"{error.FileName}({error.Line},{error.Column}: {error.Description})");
switch (error.ErrorLevel)
{
case vsBuildErrorLevel.vsBuildErrorLevelHigh:
Log.Error($"{error.FileName}({error.Line},{error.Column}: {error.Description})");
errors++;
break;
case vsBuildErrorLevel.vsBuildErrorLevelMedium:
Log.Warning($"{error.FileName}({error.Line},{error.Column}: {error.Description})");
warnings++;
break;
default:
Log.Info($"{error.FileName}({error.Line},{error.Column}: {error.Description})");
messages++;
break;
}
}

Log.Error($"Build failed: [{errorList.Count}] errors");
Log.Error("See the Build/Output panel for more information");
return false;
if (errors > 0)
{
Log.Error($"Build failed: [{errors}] errors");
Log.Error("See the Build/Output panel for more information");
return false;
}
}

Log.Info("Build succeeded");
Log.Info($"Build succeeded{(warnings > 0 ? $", with {warnings} warnigns" : null)}{(messages > 0 ? $", with {messages} messages" : null)}");

// Publish the project so all required binaries and assets end up
// in the output folder.
Expand All @@ -312,7 +332,7 @@ private static async Task<bool> PublishProjectAsync(DTE2 dte, Solution solution,
await Task.Yield();

const string allowedVariableNames =
@"
"""
ALLUSERSPROFILE
APPDATA
architecture
Expand Down Expand Up @@ -351,7 +371,7 @@ private static async Task<bool> PublishProjectAsync(DTE2 dte, Solution solution,
USERNAME
USERPROFILE
windir
";
""";

var allowedVariables = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase);
var environmentVariables = new Dictionary<string, string>();
Expand Down Expand Up @@ -570,6 +590,22 @@ public static ConnectionInfo GetDebugConnectionInfo(ProjectProperties projectPro
return null;
}

// Ensure that linux libraries are installed.
if (!await connection.SetupLinuxDependenciesAsync())
{
await ThreadHelper.JoinableTaskFactory.SwitchToMainThreadAsync();

MessageBoxEx.Show(
"Cannot install the Linux dependencies on the Raspberry.\r\n\r\nCheck the Debug Output for more details.",
"Linux Dependencies Installation Failed",
MessageBoxButtons.OK,
MessageBoxIcon.Error);

connection.Dispose();

return null;
}

// Upload the program binaries.
if (await connection.UploadProgramAsync(
projectProperties?.Name,
Expand All @@ -592,4 +628,3 @@ public static ConnectionInfo GetDebugConnectionInfo(ProjectProperties projectPro
}
}
}

4 changes: 2 additions & 2 deletions RaspberryDebugger/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("3.2.0.0")]
[assembly: AssemblyFileVersion("3.2.0.0")]
[assembly: AssemblyVersion("3.3.0.0")]
[assembly: AssemblyFileVersion("3.3.0.0")]
16 changes: 8 additions & 8 deletions RaspberryDebugger/RaspberryDebugger.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -153,21 +153,21 @@
<Version>15.0.6142705</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.ManagedInterfaces">
<Version>17.2.32505.113</Version>
<Version>17.5.33428.366</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.ProjectSystem">
<Version>15.8.243</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.2.32505.173" ExcludeAssets="runtime">
<PackageReference Include="Microsoft.VisualStudio.SDK" Version="17.7.37357" ExcludeAssets="runtime">
<IncludeAssets>compile; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Utilities">
<Version>17.2.32505.113</Version>
<Version>17.7.37355</Version>
</PackageReference>
<PackageReference Include="Microsoft.VisualStudio.Utilities.Internal">
<Version>16.3.36</Version>
<Version>16.3.42</Version>
</PackageReference>
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.3.2088">
<PackageReference Include="Microsoft.VSSDK.BuildTools" Version="17.7.2196">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
<PrivateAssets>all</PrivateAssets>
</PackageReference>
Expand All @@ -181,16 +181,16 @@
<Version>2.18.2</Version>
</PackageReference>
<PackageReference Include="Newtonsoft.Json">
<Version>13.0.1</Version>
<Version>13.0.3</Version>
</PackageReference>
<PackageReference Include="ObjectListView.Official">
<Version>2.9.1</Version>
</PackageReference>
<PackageReference Include="Polly">
<Version>7.2.3</Version>
<Version>7.2.4</Version>
</PackageReference>
<PackageReference Include="StreamJsonRpc">
<Version>2.11.35</Version>
<Version>2.16.36</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
Expand Down
3 changes: 3 additions & 0 deletions RaspberryDebugger/source.extension.vsixmanifest
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ Raspberry Debugger forked from nforgeio/RaspberryDebugger</Description>
<InstallationTarget Version="[17.4,18.0)" Id="Microsoft.VisualStudio.Pro">
<ProductArchitecture>amd64</ProductArchitecture>
</InstallationTarget>
<InstallationTarget Version="[17.4,18.0)" Id="Microsoft.VisualStudio.Enterprise">
<ProductArchitecture>amd64</ProductArchitecture>
</InstallationTarget>
</Installation>
<Dependencies>
<Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
Expand Down