diff --git a/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Dialogs/DebugProgram/DotNetFrameworkStartDebuggingOptionsPage.cs b/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Dialogs/DebugProgram/DotNetFrameworkStartDebuggingOptionsPage.cs index 16092228d4..e1e677b633 100644 --- a/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Dialogs/DebugProgram/DotNetFrameworkStartDebuggingOptionsPage.cs +++ b/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Dialogs/DebugProgram/DotNetFrameworkStartDebuggingOptionsPage.cs @@ -18,12 +18,15 @@ You should have received a copy of the GNU General Public License */ using System; +using System.Collections.Generic; using System.IO; +using System.Linq; using dnSpy.Contracts.Debugger; using dnSpy.Contracts.Debugger.DotNet.CorDebug; using dnSpy.Contracts.Debugger.StartDebugging; using dnSpy.Contracts.Debugger.StartDebugging.Dialog; using dnSpy.Contracts.MVVM; +using dnSpy.Debugger.DotNet.CorDebug.Properties; using dnSpy.Debugger.DotNet.CorDebug.Utilities; namespace dnSpy.Debugger.DotNet.CorDebug.Dialogs.DebugProgram { @@ -34,6 +37,16 @@ sealed class DotNetFrameworkStartDebuggingOptionsPage : DotNetCommonStartDebuggi // Shouldn't be localized public override string DisplayName => ".NET Framework"; + public ListVM RuntimeVersionsVM { get; } = new ListVM(CreateRuntimeVersions()); + + static string[] CreateRuntimeVersions() { + var list = new List { + dnSpy_Debugger_DotNet_CorDebug_Resources.DbgAsm_Autodetect, + }; + list.AddRange(DotNetHelpers.GetInstalledFrameworkVersions().OrderByDescending(x => x)); + return list.ToArray(); + } + public DotNetFrameworkStartDebuggingOptionsPage(IPickFilename pickFilename, IPickDirectory pickDirectory) : base(pickFilename, pickDirectory) { } @@ -74,10 +87,18 @@ DotNetFrameworkStartDebuggingOptions GetDefaultOptions(string filename, string b DotNetFrameworkStartDebuggingOptions CreateOptions(string breakKind) => InitializeDefault(new DotNetFrameworkStartDebuggingOptions(), breakKind); - void Initialize(DotNetFrameworkStartDebuggingOptions options) => base.Initialize(options); + void Initialize(DotNetFrameworkStartDebuggingOptions options) { + base.Initialize(options); + if (options.DebuggeeVersion is null) + RuntimeVersionsVM.SelectedIndex = 0; + else + RuntimeVersionsVM.SelectedItem = options.DebuggeeVersion; + } public override StartDebuggingOptionsInfo GetOptions() { - var options = GetOptions(new DotNetFrameworkStartDebuggingOptions()); + var options = GetOptions(new DotNetFrameworkStartDebuggingOptions { + DebuggeeVersion = RuntimeVersionsVM.SelectedIndex == 0 ? null : RuntimeVersionsVM.SelectedItem + }); var flags = StartDebuggingOptionsInfoFlags.None; if (File.Exists(options.Filename)) { var extension = Path.GetExtension(options.Filename); diff --git a/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Impl/DotNetFrameworkDbgEngineImpl.cs b/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Impl/DotNetFrameworkDbgEngineImpl.cs index b36a20164d..6b696218ac 100644 --- a/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Impl/DotNetFrameworkDbgEngineImpl.cs +++ b/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Impl/DotNetFrameworkDbgEngineImpl.cs @@ -46,7 +46,7 @@ public DotNetFrameworkDbgEngineImpl(DbgEngineImplDependencies deps, DbgManager d } protected override CLRTypeDebugInfo CreateDebugInfo(CorDebugStartDebuggingOptions options) => - new DesktopCLRTypeDebugInfo(); + new DesktopCLRTypeDebugInfo(((DotNetFrameworkStartDebuggingOptions)options).DebuggeeVersion); protected override CLRTypeAttachInfo CreateAttachInfo(CorDebugAttachToProgramOptions options) => new DesktopCLRTypeAttachInfo(((DotNetFrameworkAttachToProgramOptions)options).DebuggeeVersion); diff --git a/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Properties/dnSpy.Debugger.DotNet.CorDebug.Resources.Designer.cs b/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Properties/dnSpy.Debugger.DotNet.CorDebug.Resources.Designer.cs index 7894401d64..ffa9d4fdc3 100644 --- a/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Properties/dnSpy.Debugger.DotNet.CorDebug.Resources.Designer.cs +++ b/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Properties/dnSpy.Debugger.DotNet.CorDebug.Resources.Designer.cs @@ -69,6 +69,15 @@ public static string DbgAsm_Args { } } + /// + /// Looks up a localized string similar to Autodetect. + /// + public static string DbgAsm_Autodetect { + get { + return ResourceManager.GetString("DbgAsm_Autodetect", resourceCulture); + } + } + /// /// Looks up a localized string similar to _Break at. /// @@ -105,6 +114,15 @@ public static string DbgAsm_HostArgs { } } + /// + /// Looks up a localized string similar to _Runtime Version. + /// + public static string DbgAsm_RuntimeVersion { + get { + return ResourceManager.GetString("DbgAsm_RuntimeVersion", resourceCulture); + } + } + /// /// Looks up a localized string similar to _Timeout. /// diff --git a/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Properties/dnSpy.Debugger.DotNet.CorDebug.Resources.resx b/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Properties/dnSpy.Debugger.DotNet.CorDebug.Resources.resx index cee5a6093d..4edcdf81f8 100644 --- a/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Properties/dnSpy.Debugger.DotNet.CorDebug.Resources.resx +++ b/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Properties/dnSpy.Debugger.DotNet.CorDebug.Resources.resx @@ -129,6 +129,12 @@ Host Ar_guments + + _Runtime Version + + + Autodetect + _Timeout diff --git a/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Themes/wpf.styles.templates.xaml b/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Themes/wpf.styles.templates.xaml index e240461eb4..876aa62a61 100644 --- a/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Themes/wpf.styles.templates.xaml +++ b/Extensions/dnSpy.Debugger/dnSpy.Debugger.DotNet.CorDebug/Themes/wpf.styles.templates.xaml @@ -28,6 +28,7 @@ + @@ -46,8 +47,11 @@