Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Force English output #146

Open
sm-g opened this issue Dec 2, 2018 · 10 comments
Open

Force English output #146

sm-g opened this issue Dec 2, 2018 · 10 comments
Assignees

Comments

@sm-g
Copy link

sm-g commented Dec 2, 2018

For non-english Windows exceptions during tests written in console in local language. As result, VisualStudio's "find message in code" feature not working (cannot just click on exception to go to sources).

There is workaround for me as user - tweak ProcessInvocation.exe.config/ProcessInvocation86.exe.config inside one of AppData\Local\Microsoft\VisualStudio\15.0_82d42fe1\Extensions folders.

Setting Thread.Current(UI)Culture to InvariantCulture should help.

Maybe it should be optional.

@jcansdale
Copy link
Owner

Sorry I missed this issue. What language are you using? Could you send me a sample stack trace?

I do have workarounds in place for a few languages. I'm happy you add yours as well!

@sm-g
Copy link
Author

sm-g commented Dec 23, 2018

I'm using ru-RU. Stack trace:

System.NotImplementedException: Метод или операция не реализована.
   в My.Application.Services.ImportActionsService.<InitializeImplementation>d__10.MoveNext()
--- Конец трассировка стека из предыдущего расположения, где возникло исключение ---
   в System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
   в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   в System.Runtime.CompilerServices.TaskAwaiter`1.GetResult()

@jcansdale
Copy link
Owner

That's strange, I thought I'd added support for Russian. 😕

Could I see a stack trace with line numbers as well? I can't see any on that one.

@sm-g
Copy link
Author

sm-g commented Dec 23, 2018

------ Test started: Assembly: My.Common.Tests.dll ------

Test 'My.Common.EnumerationTests.FromValue_ReturnsFirstOfItemsWithThisValue' failed:   Expected: 0
  But was:  1
	   в My.Common.EnumerationTests.FromValue_ReturnsFirstOfItemsWithThisValue() в C:\x\test\My.Common.Tests\EnumerationTests.cs:строка 26

0 passed, 1 failed, 0 skipped, took 1,08 seconds (NUnit 3.11.0).

@jcansdale jcansdale self-assigned this Dec 24, 2018
@jcansdale
Copy link
Owner

@sm-g,

I was wondering if there are any tricks I should know about using Cyrillic text in C# source?

image

System.ArgumentException : parsing "^(\s*(à|at|à|bei|ved|?)) (?<methodName>[^\\]+)$" - Quantifier {x,y} following nothing.
   at System.Text.RegularExpressions.RegexParser.ScanRegex()
   at System.Text.RegularExpressions.RegexParser.Parse(String re, RegexOptions op)

I've tried this before and struggled to make it work. The text appears fine in Visual Studio but breaks when I try to create a Regex or output it. 😕

@jcansdale
Copy link
Owner

I think this might be the trick. 🤞

image

@jcansdale
Copy link
Owner

jcansdale commented Jan 5, 2019

@sm-g,

Could you give this version a try and let me know if it works? With any luck it will now recognize Russian/Cyrillic stack frames.

TestDriven.VSPackage-5.0.18092.zip

@sm-g
Copy link
Author

sm-g commented Jan 18, 2019

@jcansdale Not as expected:

Test 'TDDKata.CalculatorTests.Add_OneNumber_ShouldReturnThatNumber' failed: System.Exception : Выдано исключение типа "System.Exception".
	CalculatorTests.cs(21,0): at TDDKata.CalculatorTests.Add_OneNumber_ShouldReturnThatNumber()

With my solution I have Exception of type 'System.Exception' was thrown.

added support for Russian

Why you need to support each lang individually? Changing thread culture does not work?

@jcansdale
Copy link
Owner

@sm-g,

Are you able to double click on the following line?

CalculatorTests.cs(21,0): at TDDKata.CalculatorTests.Add_OneNumber_ShouldReturnThatNumber()

Why you need to support each lang individually? Changing thread culture does not work?

I'm reluctant to change the thread culture explicitly as this could change whether some tests pass or fail for some people.

Do you get different results when running NUnit/xUnit from the command line?

Would setting the culture like this be an option?

namespace NUnit.Tests
{
  using System;
  using NUnit.Framework;

  [TestFixture]
  [Culture("fr-FR")]
  public class FrenchCultureTests
  {
    // ...
  }
}

@sm-g
Copy link
Author

sm-g commented Jan 19, 2019

Yes, double click works. But I want also all exceptions to be not localized.

Thread culture could be an option, so only people who explicitly set it could have changes.

Sorry, but I have no time to check your other questions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants