Skip to content

Commit

Permalink
Prompt user when resolving clipboard contents (#123)
Browse files Browse the repository at this point in the history
* 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.
  • Loading branch information
arvindshmicrosoft authored Jun 19, 2023
1 parent ac6c0fd commit 003b855
Show file tree
Hide file tree
Showing 15 changed files with 115 additions and 58 deletions.
15 changes: 15 additions & 0 deletions BUILDING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
# Building
* You will need Visual Studio 2022+ installed to build this solution.
* Access to nuget.org is needed to fetch and restore package dependencies. Please note the terms of usage for the following dependency files:
* 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).
* 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).
* [XELite](https://www.nuget.org/packages/Microsoft.SqlServer.XEvent.XELite/) is used for importing Microsoft SQL Extended Event (XEL) files.
* Other packages from Microsoft .NET family are used as well.
* 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.
* Prior to running tests, you need to execute the [downloadsyms.ps1](./Tests/TestCases/downloadsyms.ps1) file once as shown below:
``` cmd
cd .\SQLCallStackResolver\Tests\TestCases
powershell < .\downloadsyms.ps1
```
Monitor for any warnings shown by the script and address them if needed.
* 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.
1 change: 0 additions & 1 deletion Engine/GlobalUsings.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
global using System.Collections.Concurrent;
global using System.Collections.Generic;
global using System.Collections.Immutable;
global using System.Diagnostics;
global using System.Diagnostics.Contracts;
global using System.Globalization;
global using System.IO;
Expand Down
4 changes: 2 additions & 2 deletions Engine/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("782bbd60-ee45-43cd-8a4f-0505efe4ff1a")]
[assembly: AssemblyVersion("2.2.0.0")]
[assembly: AssemblyFileVersion("2.2.0.0")]
[assembly: AssemblyVersion("2.3.0.0")]
[assembly: AssemblyFileVersion("2.3.0.0")]
[assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
11 changes: 10 additions & 1 deletion GUI/App.config
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<configSections>
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
<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" />
</sectionGroup>
</configSections>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
</startup>
<appSettings>
Expand All @@ -15,4 +20,8 @@
<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>
</assemblyBinding>
</runtime>
<userSettings><Microsoft.SqlServer.Utils.Misc.SQLCallStackResolver.Properties.Settings>
<setting name="promptForClipboardPaste" serializeAs="String"><value>True</value></setting>
<setting name="choiceForClipboardPaste" serializeAs="String"><value>False</value></setting>
</Microsoft.SqlServer.Utils.Misc.SQLCallStackResolver.Properties.Settings></userSettings>
</configuration>
14 changes: 14 additions & 0 deletions GUI/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,20 @@ private void ResolveCallstacks_Click(object sender, EventArgs e) {
}

private void ResolveCallStackFromClipboardButton_Click(object sender, EventArgs e) {
if (Properties.Settings.Default.promptForClipboardPaste) {
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);
var resRememberChoice = MessageBox.Show(this, "Should we remember your choice for the future?", "Save your choice?", MessageBoxButtons.YesNo, MessageBoxIcon.Question);

Properties.Settings.Default.promptForClipboardPaste = (resRememberChoice == DialogResult.No);
Properties.Settings.Default.choiceForClipboardPaste = (resProceed == DialogResult.Yes);
Properties.Settings.Default.Save();
}

if (!Properties.Settings.Default.choiceForClipboardPaste) {
this.UpdateStatus((Properties.Settings.Default.promptForClipboardPaste ? "You chose to not" : "You have chosen never to") + " paste clipboard contents. Nothing to do!");
return;
}

callStackInput.Clear();
finalOutput.Clear();
callStackInput.Text = Clipboard.GetText();
Expand Down
4 changes: 2 additions & 2 deletions GUI/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
[assembly: AssemblyCulture("")]
[assembly: ComVisible(false)]
[assembly: Guid("f65803b0-f5b2-4fa4-99b2-c91600e77e26")]
[assembly: AssemblyVersion("2.2.0.0")]
[assembly: AssemblyFileVersion("2.2.0.0")]
[assembly: AssemblyVersion("2.3.0.0")]
[assembly: AssemblyFileVersion("2.3.0.0")]
[assembly: NeutralResourcesLanguage("en")]
[assembly: System.Runtime.Versioning.TargetFrameworkAttribute(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
31 changes: 31 additions & 0 deletions GUI/Properties/Settings.Designer.cs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions GUI/Properties/Settings.settings
Original file line number Diff line number Diff line change
@@ -0,0 +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>
9 changes: 9 additions & 0 deletions GUI/SQLCallstackResolver.GUI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,11 @@
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Properties\Settings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings.settings</DependentUpon>
</Compile>
<Compile Include="SQLBuildsForm.cs">
<SubType>Form</SubType>
</Compile>
Expand All @@ -94,6 +99,10 @@
<SubType>Designer</SubType>
</EmbeddedResource>
<None Include="App.config" />
<None Include="Properties\Settings.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Engine\SQLCallstackResolver.Engine.csproj">
Expand Down
Loading

0 comments on commit 003b855

Please sign in to comment.