Skip to content

Commit

Permalink
Removes auto attach feature
Browse files Browse the repository at this point in the history
Only used by developers and requires a bunch of Windows specific DLLs that are missing on most build sytstems

Work done for #196
  • Loading branch information
atruskie committed Mar 6, 2020
1 parent a0e3d58 commit 60dc9d3
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 286 deletions.
4 changes: 4 additions & 0 deletions docs/debugging.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Debugging

https://marketplace.visualstudio.com/items?itemName=DennisMaxJung.vscode-dotnet-auto-attach
https://marketplace.visualstudio.com/items?itemName=ViktarKarpach.DebugAttachManager
27 changes: 0 additions & 27 deletions src/Acoustics.Shared/Acoustics.Shared.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -13,33 +13,6 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
</PropertyGroup>
<ItemGroup>
<Reference Include="envdte, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\envdte.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="envdte100, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
<HintPath>..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\envdte100.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="envdte80, Version=8.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\envdte80.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="envdte90, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\envdte90.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
<Reference Include="envdte90a, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<HintPath>..\..\..\..\..\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\PublicAssemblies\envdte90a.dll</HintPath>
<SpecificVersion>False</SpecificVersion>
<EmbedInteropTypes>True</EmbedInteropTypes>
</Reference>
</ItemGroup>
<ItemGroup>
<None Include="..\AP.Settings.json">
<Link>AP.Settings.json</Link>
Expand Down
234 changes: 0 additions & 234 deletions src/Acoustics.Shared/Debugging/AutoAttachVs.cs

This file was deleted.

15 changes: 10 additions & 5 deletions src/Acoustics.Shared/Meta.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,12 @@ public static class Meta

public static readonly int NowYear = DateTime.Now.Year;

private static readonly Assembly[] OurAssemblies =
AppDomain.CurrentDomain
.GetAssemblies()
.Where(OurCodePredicate)
.ToArray();

public static string Organization { get; } = "QUT";

public static string Website { get; } = "http://research.ecosounds.org/";
Expand All @@ -29,11 +35,10 @@ public static class Meta

public static string Repository { get; } = "https://github.com/QutBioacoustics/audio-analysis";

private static readonly Assembly[] OurAssemblies =
AppDomain.CurrentDomain
.GetAssemblies()
.Where(OurCodePredicate)
.ToArray();
public static string GetDocsUrl(string page)
{
return $"{Repository}/blob/master/docs/{page}";
}

public static IEnumerable<TypeInfo> GetTypesFromQutAssemblies<T>()
{
Expand Down
31 changes: 11 additions & 20 deletions src/AnalysisPrograms/Production/MainEntryUtilities.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,12 @@ namespace AnalysisPrograms
using Acoustics.Shared;
using Acoustics.Shared.Contracts;
using Acoustics.Shared.Logging;
using log4net.Core;
#if DEBUG
using Acoustics.Shared.Debugging;
#endif
using AnalysisPrograms.Production;
using AnalysisPrograms.Production.Arguments;
using AnalysisPrograms.Production.Parsers;

using log4net;
using log4net.Core;
using McMaster.Extensions.CommandLineUtils;
using static System.Environment;

Expand Down Expand Up @@ -115,39 +112,34 @@ public static void SetLogVerbosity(LogVerbosity logVerbosity, bool quietConsole
//Logging.TestLogging();
}

[Conditional("DEBUG")]
internal static void AttachDebugger(DebugOptions options)
{
if (options == DebugOptions.No)
{
return;
}
#if DEBUG

if (!Debugger.IsAttached && !IsMsTestRunningMe)
{
if (options == DebugOptions.Prompt)
{
var prompt =
$@"Do you wish to debug?
\tAttach now or press [Y] and [ENTER] to attach. Press [N] or [ENTER] to continue.
See {Meta.GetDocsUrl("debugging.md")} for help.";

var response = Prompt.GetYesNo(
"Do you wish to debug? Attach now or press [Y] and [ENTER] to attach. Press [N] or [ENTER] to continue.",
prompt,
defaultAnswer: false,
promptColor: ConsoleColor.Cyan);
options = response ? DebugOptions.Yes : DebugOptions.No;
}

if (options == DebugOptions.Yes || options == DebugOptions.YesSilent)
{
var vsProcess =
VisualStudioAttacher.GetVisualStudioForSolutions(
new List<string> { "AudioAnalysis.sln" });

if (vsProcess != null)
{
VisualStudioAttacher.AttachVisualStudioToProcess(vsProcess, Process.GetCurrentProcess());
}
else
{
// try and attach the old fashioned way
Debugger.Launch();
}
// try and attach the old fashioned way
Debugger.Launch();
}

// ReSharper disable once ConditionIsAlwaysTrueOrFalse
Expand All @@ -160,7 +152,6 @@ internal static void AttachDebugger(DebugOptions options)
}
}
}
#endif
}

internal static void BeforeExecute(MainArgs main, CommandLineApplication application)
Expand Down

0 comments on commit 60dc9d3

Please sign in to comment.