Skip to content

Commit 003b855

Browse files
Prompt user when resolving clipboard contents (#123)
* Add a prompt to confirm if user wants to resolve clipboard contents. * Optionally remember the user's choice. * Update README and supporting images. * Update assembly versions to 2.3.0.0. * Update the latest release date.
1 parent ac6c0fd commit 003b855

15 files changed

+115
-58
lines changed

BUILDING.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Building
2+
* You will need Visual Studio 2022+ installed to build this solution.
3+
* Access to nuget.org is needed to fetch and restore package dependencies. Please note the terms of usage for the following dependency files:
4+
* symsrv.dll and dbghelp.dll (originally part of the x64 / AMD64 Windows Debugger package, part of Windows SDK and many other tools) are used under the terms published [here](https://docs.microsoft.com/en-us/legal/windows-sdk/redist#debugging-tools-for-windows).
5+
* The DIA SDK files - msdia140.dll and msdia140.dll.manifest - are components of Visual Studio 2022 used under the terms as published [here](https://docs.microsoft.com/en-us/visualstudio/releases/2022/redistribution).
6+
* [XELite](https://www.nuget.org/packages/Microsoft.SqlServer.XEvent.XELite/) is used for importing Microsoft SQL Extended Event (XEL) files.
7+
* Other packages from Microsoft .NET family are used as well.
8+
* Tests are implemented using [MSTest v2](https://docs.microsoft.com/en-us/visualstudio/test/mstest-update-to-mstestv2?view=vs-2022#why-upgrade-to-mstestv2). Please try to ensure all the tests are passing before submitting a PR.
9+
* Prior to running tests, you need to execute the [downloadsyms.ps1](./Tests/TestCases/downloadsyms.ps1) file once as shown below:
10+
``` cmd
11+
cd .\SQLCallStackResolver\Tests\TestCases
12+
powershell < .\downloadsyms.ps1
13+
```
14+
Monitor for any warnings shown by the script and address them if needed.
15+
* When a Pull Request (PR) is submitted for this project, there is a [GitHub Actions workflow](./.github/workflows/build.yml) which will build the project and run tests. PRs cannot merge till the workflow succeeds.

Engine/GlobalUsings.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
global using System.Collections.Concurrent;
88
global using System.Collections.Generic;
99
global using System.Collections.Immutable;
10-
global using System.Diagnostics;
1110
global using System.Diagnostics.Contracts;
1211
global using System.Globalization;
1312
global using System.IO;

Engine/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,6 @@
1111
[assembly: AssemblyCulture("")]
1212
[assembly: ComVisible(false)]
1313
[assembly: Guid("782bbd60-ee45-43cd-8a4f-0505efe4ff1a")]
14-
[assembly: AssemblyVersion("2.2.0.0")]
15-
[assembly: AssemblyFileVersion("2.2.0.0")]
14+
[assembly: AssemblyVersion("2.3.0.0")]
15+
[assembly: AssemblyFileVersion("2.3.0.0")]
1616
[assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

GUI/App.config

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
<?xml version="1.0" encoding="utf-8"?>
22
<configuration>
3-
<startup>
3+
<configSections>
4+
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
5+
<section name="Microsoft.SqlServer.Utils.Misc.SQLCallStackResolver.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
6+
</sectionGroup>
7+
</configSections>
8+
<startup>
49
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
510
</startup>
611
<appSettings>
@@ -15,4 +20,8 @@
1520
<dependentAssembly><assemblyIdentity name="System.Memory" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" /><bindingRedirect oldVersion="0.0.0.0-4.0.1.2" newVersion="4.0.1.2" /></dependentAssembly>
1621
</assemblyBinding>
1722
</runtime>
23+
<userSettings><Microsoft.SqlServer.Utils.Misc.SQLCallStackResolver.Properties.Settings>
24+
<setting name="promptForClipboardPaste" serializeAs="String"><value>True</value></setting>
25+
<setting name="choiceForClipboardPaste" serializeAs="String"><value>False</value></setting>
26+
</Microsoft.SqlServer.Utils.Misc.SQLCallStackResolver.Properties.Settings></userSettings>
1827
</configuration>

GUI/MainForm.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,20 @@ private void ResolveCallstacks_Click(object sender, EventArgs e) {
2626
}
2727

2828
private void ResolveCallStackFromClipboardButton_Click(object sender, EventArgs e) {
29+
if (Properties.Settings.Default.promptForClipboardPaste) {
30+
var resProceed = MessageBox.Show(this, "Proceeding will paste the contents of your clipboard and attempt to resolve them. Are you sure?", "Proceed with paste from clipboard", MessageBoxButtons.YesNo, MessageBoxIcon.Information);
31+
var resRememberChoice = MessageBox.Show(this, "Should we remember your choice for the future?", "Save your choice?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
32+
33+
Properties.Settings.Default.promptForClipboardPaste = (resRememberChoice == DialogResult.No);
34+
Properties.Settings.Default.choiceForClipboardPaste = (resProceed == DialogResult.Yes);
35+
Properties.Settings.Default.Save();
36+
}
37+
38+
if (!Properties.Settings.Default.choiceForClipboardPaste) {
39+
this.UpdateStatus((Properties.Settings.Default.promptForClipboardPaste ? "You chose to not" : "You have chosen never to") + " paste clipboard contents. Nothing to do!");
40+
return;
41+
}
42+
2943
callStackInput.Clear();
3044
finalOutput.Clear();
3145
callStackInput.Text = Clipboard.GetText();

GUI/Properties/AssemblyInfo.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
[assembly: AssemblyCulture("")]
1212
[assembly: ComVisible(false)]
1313
[assembly: Guid("f65803b0-f5b2-4fa4-99b2-c91600e77e26")]
14-
[assembly: AssemblyVersion("2.2.0.0")]
15-
[assembly: AssemblyFileVersion("2.2.0.0")]
14+
[assembly: AssemblyVersion("2.3.0.0")]
15+
[assembly: AssemblyFileVersion("2.3.0.0")]
1616
[assembly: NeutralResourcesLanguage("en")]
1717
[assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]

GUI/Properties/Settings.Designer.cs

Lines changed: 31 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

GUI/Properties/Settings.settings

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
<?xml version='1.0' encoding='utf-8'?><SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Microsoft.SqlServer.Utils.Misc.SQLCallStackResolver.Properties" GeneratedClassName="Settings"><Profiles /><Settings><Setting Name="promptForClipboardPaste" Type="System.Boolean" Scope="User"><Value Profile="(Default)">True</Value></Setting><Setting Name="choiceForClipboardPaste" Type="System.Boolean" Scope="User"><Value Profile="(Default)">False</Value></Setting></Settings></SettingsFile>

GUI/SQLCallstackResolver.GUI.csproj

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,11 @@
7070
</Compile>
7171
<Compile Include="Program.cs" />
7272
<Compile Include="Properties\AssemblyInfo.cs" />
73+
<Compile Include="Properties\Settings.Designer.cs">
74+
<AutoGen>True</AutoGen>
75+
<DesignTimeSharedInput>True</DesignTimeSharedInput>
76+
<DependentUpon>Settings.settings</DependentUpon>
77+
</Compile>
7378
<Compile Include="SQLBuildsForm.cs">
7479
<SubType>Form</SubType>
7580
</Compile>
@@ -94,6 +99,10 @@
9499
<SubType>Designer</SubType>
95100
</EmbeddedResource>
96101
<None Include="App.config" />
102+
<None Include="Properties\Settings.settings">
103+
<Generator>SettingsSingleFileGenerator</Generator>
104+
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
105+
</None>
97106
</ItemGroup>
98107
<ItemGroup>
99108
<ProjectReference Include="..\Engine\SQLCallstackResolver.Engine.csproj">

0 commit comments

Comments
 (0)