提交 0c81ee52 编写于 作者: T Ty Overby 提交者: GitHub

Fix localization issues in compiler (#17035)

* use io exception message

* disable Culture test

* run tests on english ui culture

* use hresult detection code that works cross-language

* fix indentation

* Only run FileShareDeleteCompatibility_Xplat on an english machine

* Brace on new line
上级 365288c1
......@@ -6949,7 +6949,7 @@ public void FileShareDeleteCompatibility_Windows()
/// On Linux/Mac <see cref="FileShare.Delete"/> on its own doesn't do anything.
/// We need to create the actual memory map. This works on Windows as well.
/// </summary>
[ConditionalFact(typeof(WindowsOnly)), WorkItem(8896, "https://github.com/dotnet/roslyn/issues/8896")]
[ConditionalFact(typeof(WindowsOnly), typeof(IsEnglishLocal)), WorkItem(8896, "https://github.com/dotnet/roslyn/issues/8896")]
public void FileShareDeleteCompatibility_Xplat()
{
var bytes = TestResources.MetadataTests.InterfaceAndClass.CSClasses01;
......
......@@ -45,20 +45,23 @@ public class C
/// </summary>
public void M() { }
}");
var diags = new DiagnosticBag();
var badStream = new BrokenStream();
badStream.BreakHow = BrokenStream.BreakHowType.ThrowOnWrite;
DocumentationCommentCompiler.WriteDocumentationCommentXml(
comp,
null,
badStream,
diags,
default(CancellationToken));
diags.Verify(
// error CS1569: Error writing to XML documentation file: I/O error occurred.
Diagnostic(ErrorCode.ERR_DocFileGen).WithArguments("I/O error occurred.").WithLocation(1, 1));
using (new EnsureEnglishUICulture())
{
var diags = new DiagnosticBag();
var badStream = new BrokenStream();
badStream.BreakHow = BrokenStream.BreakHowType.ThrowOnWrite;
DocumentationCommentCompiler.WriteDocumentationCommentXml(
comp,
null,
badStream,
diags,
default(CancellationToken));
diags.Verify(
// error CS1569: Error writing to XML documentation file: I/O error occurred.
Diagnostic(ErrorCode.ERR_DocFileGen).WithArguments("I/O error occurred.").WithLocation(1, 1));
}
}
[ClrOnlyFact]
......
......@@ -472,7 +472,10 @@ End Class
Assert.Equal(ERRID.ERR_PublicKeyContainerFailure, err.Code)
Assert.Equal(2, err.Arguments.Count)
Assert.Equal("foo", DirectCast(err.Arguments(0), String))
Assert.True(DirectCast(err.Arguments(1), String).Contains("HRESULT: 0x80090016"))
Dim errorText = DirectCast(err.Arguments(1), String)
Assert.True(
errorText.Contains("HRESULT") AndAlso
errorText.Contains("0x80090016"))
Assert.True(other.Assembly.Identity.PublicKey.IsEmpty)
End Sub
......@@ -621,11 +624,13 @@ End Class
'c2.VerifyDiagnostics(Diagnostic(ERRID.ERR_PublicKeyContainerFailure).WithArguments("bogus", "Keyset does not exist (Exception from HRESULT: 0x80090016)"))
Dim err = c2.GetDiagnostics(CompilationStage.Emit).Single()
Assert.Equal(ERRID.ERR_PublicKeyContainerFailure, err.Code)
Assert.Equal(2, err.Arguments.Count)
Assert.Equal("bogus", DirectCast(err.Arguments(0), String))
Assert.True(DirectCast(err.Arguments(1), String).Contains("HRESULT: 0x80090016"))
Dim errorText = DirectCast(err.Arguments(1), String)
Assert.True(
errorText.Contains("HRESULT") AndAlso
errorText.Contains("0x80090016"))
End Sub
<Fact>
......@@ -1624,7 +1629,10 @@ End Class
Assert.Equal(ERRID.ERR_PublicKeyFileFailure, err.Code)
Assert.Equal(2, err.Arguments.Count)
Assert.Equal(s_keyPairFile, DirectCast(err.Arguments(0), String))
Assert.True(DirectCast(err.Arguments(1), String).EndsWith(" HRESULT: 0x80131423)", StringComparison.Ordinal))
Dim errorText = DirectCast(err.Arguments(1), String)
Assert.True(
errorText.Contains("HRESULT") AndAlso
errorText.Contains("0x80131423"))
End Sub
<Fact>
......@@ -1978,7 +1986,7 @@ End Class
<Assembly: System.Runtime.CompilerServices.InternalsVisibleTo("Bug769840_B, PublicKey=0024000004800000940000000602000000240000525341310004000001000100458a131798af87d9e33088a3ab1c6101cbd462760f023d4f41d97f691033649e60b42001e94f4d79386b5e087b0a044c54b7afce151b3ad19b33b332b83087e3b8b022f45b5e4ff9b9a1077b0572ff0679ce38f884c7bd3d9b4090e4a7ee086b7dd292dc20f81a3b1b8a0b67ee77023131e59831c709c81d11c6856669974cc4")>
Friend Class A
Public Value As Integer = 3
Public Value As Integer = 3
End Class
]]></file>
</compilation>, options:=TestOptions.ReleaseDll.WithStrongNameProvider(s_defaultProvider))
......
......@@ -36,23 +36,25 @@ End Class
]]>
</file>
</compilation>
Dim comp = CreateCompilationWithMscorlib(sources)
Dim diags = New DiagnosticBag()
Dim badStream = New BrokenStream()
badStream.BreakHow = BrokenStream.BreakHowType.ThrowOnWrite
DocumentationCommentCompiler.WriteDocumentationCommentXml(
comp,
assemblyName:=Nothing,
xmlDocStream:=badStream,
diagnostics:=diags,
cancellationToken:=Nothing)
AssertTheseDiagnostics(diags.ToReadOnlyAndFree(),
<errors><![CDATA[
Using(new EnsureEnglishUICulture())
Dim comp = CreateCompilationWithMscorlib(sources)
Dim diags = New DiagnosticBag()
Dim badStream = New BrokenStream()
badStream.BreakHow = BrokenStream.BreakHowType.ThrowOnWrite
DocumentationCommentCompiler.WriteDocumentationCommentXml(
comp,
assemblyName:=Nothing,
xmlDocStream:=badStream,
diagnostics:=diags,
cancellationToken:=Nothing)
AssertTheseDiagnostics(diags.ToReadOnlyAndFree(),
<errors><![CDATA[
BC37258: Error writing to XML documentation file: I/O error occurred.
]]></errors>)
End Using
End Sub
<Fact>
......
......@@ -135,7 +135,7 @@ public void Await()
runner.Console.Error.ToString());
}
[Fact]
[Fact(Skip="https://github.com/dotnet/roslyn/issues/17043")]
[WorkItem(7133, "http://github.com/dotnet/roslyn/issues/7133")]
public void TestDisplayResultsWithCurrentUICulture()
{
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册