Skip to content

Commit 156f016

Browse files
authored
Fix Formatting and On Enter integration tests (#10788)
Since the end of last week, these tests have been failing. Seems like something changed on the platform side, perhaps a default value of a setting. Have started a thread with the editor team to see if we need to do more.
2 parents aa024eb + cdcef8e commit 156f016

File tree

3 files changed

+26
-1
lines changed

3 files changed

+26
-1
lines changed

src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/AbstractRazorEditorTest.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,9 @@ public override async Task InitializeAsync()
4444

4545
VisualStudioLogging.AddCustomLoggers();
4646

47+
// Our expected test results have spaces not tabs
48+
await TestServices.Shell.SetInsertSpacesAsync(ControlledHangMitigatingCancellationToken);
49+
4750
_projectFilePath = await CreateAndOpenBlazorProjectAsync(ControlledHangMitigatingCancellationToken);
4851

4952
await TestServices.SolutionExplorer.RestoreNuGetPackagesAsync(ControlledHangMitigatingCancellationToken);

src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/InProcess/ShellInProcess.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,10 @@
44
using System.IO;
55
using System.Threading;
66
using System.Threading.Tasks;
7+
using Microsoft.VisualStudio.Razor;
78
using Microsoft.VisualStudio.Shell.Interop;
9+
using Microsoft.VisualStudio.TextManager.Interop;
10+
using Xunit;
811

912
namespace Microsoft.VisualStudio.Extensibility.Testing;
1013

@@ -22,4 +25,16 @@ public async Task<string> GetActiveDocumentFileNameAsync(CancellationToken cance
2225
var documentPath = (string)documentPathObj;
2326
return Path.GetFileName(documentPath);
2427
}
28+
29+
public async Task SetInsertSpacesAsync(CancellationToken cancellationToken)
30+
{
31+
var textManager = await GetRequiredGlobalServiceAsync<SVsTextManager, IVsTextManager4>(cancellationToken);
32+
33+
var langPrefs3 = new LANGPREFERENCES3[] { new LANGPREFERENCES3() { guidLang = RazorConstants.RazorLanguageServiceGuid } };
34+
Assert.Equal(VSConstants.S_OK, textManager.GetUserPreferences4(null, langPrefs3, null));
35+
36+
langPrefs3[0].fInsertTabs = 0;
37+
38+
Assert.Equal(VSConstants.S_OK, textManager.SetUserPreferences4(null, langPrefs3, null));
39+
}
2540
}

src/Razor/test/Microsoft.VisualStudio.Razor.IntegrationTests/VisualStudioLogging.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,14 @@ private static void FeedbackLoggerInternal(string filePath, params string[] expe
8989
var files = new List<string>();
9090
foreach (var feedbackFileProvider in feedbackFileProviders)
9191
{
92-
files.AddRange(feedbackFileProvider.GetFiles());
92+
try
93+
{
94+
files.AddRange(feedbackFileProvider.GetFiles());
95+
}
96+
catch
97+
{
98+
// If one of the providers has issues, we don't want it causing us to not be able to report our stuff properly
99+
}
93100
}
94101

95102
_ = CollectFeedbackItemsAsync(files, filePath, expectedFileParts);

0 commit comments

Comments
 (0)