fix for issue #8
This commit is contained in:
		
							parent
							
								
									14fbf8f7c7
								
							
						
					
					
						commit
						2b43b35598
					
				
					 4 changed files with 31 additions and 20 deletions
				
			
		|  | @ -15,6 +15,10 @@ This is an open source project, join! | |||
| 
 | ||||
| Twitter: @GanzhaVitalii | ||||
| 
 | ||||
| Version 1.9: | ||||
| * Fixed defect #8: VS 2015 stops working when looking at Test Manager Window | ||||
| 
 | ||||
| 
 | ||||
| Version 1.8: | ||||
| * Users now will be able to select their own sounds (Issue #5) | ||||
| * There will be a different sound when any of the tests have failed (Issue #7) | ||||
|  |  | |||
|  | @ -5,11 +5,6 @@ | |||
|     <VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">12.0</VisualStudioVersion> | ||||
|     <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath> | ||||
|     <TargetFrameworkProfile /> | ||||
|     <FileUpgradeFlags> | ||||
|     </FileUpgradeFlags> | ||||
|     <UpgradeBackupLocation> | ||||
|     </UpgradeBackupLocation> | ||||
|     <OldToolsVersion>12.0</OldToolsVersion> | ||||
|     <StartAction>Program</StartAction> | ||||
|     <StartProgram>$(DevEnvDir)\devenv.exe</StartProgram> | ||||
|     <StartArguments>/rootsuffix Exp</StartArguments> | ||||
|  | @ -66,11 +61,13 @@ | |||
|     <Reference Include="Microsoft.VisualStudio.Shell.Interop.12.0"> | ||||
|       <EmbedInteropTypes>true</EmbedInteropTypes> | ||||
|     </Reference> | ||||
|     <Reference Include="Microsoft.VisualStudio.TestWindow.Core"> | ||||
|     <!--<Reference Include="Microsoft.VisualStudio.TestWindow.Core"> | ||||
|       <HintPath>$(DevEnvDir)\CommonExtensions\Microsoft\TestWindow\Microsoft.VisualStudio.TestWindow.Core.dll</HintPath> | ||||
|     </Reference> | ||||
|       <Private>False</Private> | ||||
|     </Reference>--> | ||||
|     <Reference Include="Microsoft.VisualStudio.TestWindow.Interfaces"> | ||||
|       <HintPath>$(DevEnvDir)\CommonExtensions\Microsoft\TestWindow\Microsoft.VisualStudio.TestWindow.Interfaces.dll</HintPath> | ||||
|       <Private>False</Private> | ||||
|     </Reference> | ||||
|     <Reference Include="Microsoft.VisualStudio.TextManager.Interop" /> | ||||
|     <Reference Include="Microsoft.VisualStudio.Shell.12.0" /> | ||||
|  | @ -218,10 +215,7 @@ | |||
|     <None Include="Key.snk" /> | ||||
|   </ItemGroup> | ||||
|   <ItemGroup> | ||||
|     <Content Include="ReleaseNotes.txt"> | ||||
|       <CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||||
|       <IncludeInVSIX>true</IncludeInVSIX> | ||||
|     </Content> | ||||
|     <Content Include="ReleaseNotes.txt" /> | ||||
|     <None Include="Resources\test-failed.wav" /> | ||||
|     <Content Include="speaker.ico"> | ||||
|       <CopyToOutputDirectory>Always</CopyToOutputDirectory> | ||||
|  |  | |||
|  | @ -10,7 +10,6 @@ namespace VitaliiGanzha.VsDingExtension | |||
|     using EnvDTE80; | ||||
|     using Microsoft.VisualStudio.ComponentModelHost; | ||||
|     using Microsoft.VisualStudio.Shell; | ||||
|     using Microsoft.VisualStudio.TestWindow.Controller; | ||||
|     using Microsoft.VisualStudio.TestWindow.Extensibility; | ||||
|     using Task = System.Threading.Tasks.Task; | ||||
| 
 | ||||
|  | @ -161,8 +160,15 @@ namespace VitaliiGanzha.VsDingExtension | |||
|         { | ||||
|             if (Options.IsBeepOnTestComplete && operationStateChangedEventArgs.State.HasFlag(TestOperationStates.TestExecutionFinished)) | ||||
|             { | ||||
|                 var testOperation = ((TestRunRequest)operationStateChangedEventArgs.Operation); | ||||
|                 var isTestsFailed = testOperation.DominantTestState == TestState.Failed; | ||||
|                 try | ||||
|                 { | ||||
|                     // Issue #8: VS 2015 stops working when looking at Test Manager Window #8  | ||||
|                     // This extention can't take dependency on Microsoft.VisualStudio.TestWindow.Core.dll | ||||
|                     // Because it will crash VS 2015. But DominantTestState is defined in that assembly. | ||||
|                     // So as a workaround - cast it to dynamic (ewww, but alternative - to create new project/build and publish it separately.) | ||||
|                     var testOperation = (dynamic)(operationStateChangedEventArgs.Operation); | ||||
|                     var dominantTestState = (TestState)testOperation.DominantTestState; | ||||
|                     var isTestsFailed = dominantTestState == TestState.Failed; | ||||
|                     var eventType = isTestsFailed ? EventType.TestsCompletedFailure : EventType.TestsCompletedSuccess; | ||||
|                     if (Options.IsBeepOnTestFailed && isTestsFailed) | ||||
|                     { | ||||
|  | @ -173,6 +179,13 @@ namespace VitaliiGanzha.VsDingExtension | |||
|                         HandleEventSafe(eventType, "Test execution has been completed."); | ||||
|                     } | ||||
|                 } | ||||
|                 catch (Exception ex) | ||||
|                 { | ||||
|                     ActivityLog.LogError(GetType().FullName, ex.Message); | ||||
|                     // Unable to get dominate test status, beep default sound for test | ||||
|                     HandleEventSafe(EventType.TestsCompletedSuccess, "Test execution has been completed."); | ||||
|                 } | ||||
|             } | ||||
|         } | ||||
|         #endregion | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,7 +1,7 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | ||||
| <PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011"> | ||||
|   <Metadata> | ||||
|     <Identity Id="26ba08d0-0d25-4479-8684-3054dd122876" Version="1.8" Language="en-US" Publisher="Vitalii Ganzha" /> | ||||
|     <Identity Id="26ba08d0-0d25-4479-8684-3054dd122876" Version="1.9" Language="en-US" Publisher="Vitalii Ganzha" /> | ||||
|     <DisplayName>Visual Studio Ding extension</DisplayName> | ||||
|     <Description xml:space="preserve">This small extension will play notification sounds when following events occur: | ||||
| - Build Complete | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue