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

Problem with person fullname in pt_BR #328

Closed
weguest opened this issue Oct 4, 2020 · 15 comments
Closed

Problem with person fullname in pt_BR #328

weguest opened this issue Oct 4, 2020 · 15 comments
Labels

Comments

@weguest
Copy link

weguest commented Oct 4, 2020

I got this message on generate a person fullname in pt_BR: "System.ArgumentOutOfRangeException: 'Index was out of range. ".
When i use other languages, works fine.

@bchavez
Copy link
Owner

bchavez commented Oct 4, 2020

Are you using .NET 5? Possibly related #327

@weguest
Copy link
Author

weguest commented Oct 4, 2020

Net Core 3.1

@bchavez
Copy link
Owner

bchavez commented Oct 4, 2020

You'll have to give me some code that fails. I can't reproduce with new Person("pt_BR").FullName.Dump();

image

@weguest
Copy link
Author

weguest commented Oct 4, 2020

Here, i figure out the problem is when it gets the city name in person object.

"You'll have to give me some code that fails"

var f = new Faker("pt_BR");
Console.WriteLine(f.Person.FullName);

Its broke because the person object is null.

@bchavez
Copy link
Owner

bchavez commented Oct 4, 2020

Sorry Jose, but the code does not fail on my machine:

image

Try providing a full stack trace of the exception so we can try to narrow this down further.

Thanks,
Brian

@weguest
Copy link
Author

weguest commented Oct 4, 2020

image

I create a new net core 3.1 console application, add Bogus nugget package, and i got this message like the screenshot.

@weguest
Copy link
Author

weguest commented Oct 4, 2020

at System.ThrowHelper.ThrowArgumentOutOfRange_IndexException()
at System.Collections.Generic.List1.get_Item(Int32 index) at Bogus.Bson.BArray.get_Item(Int32 index) at Bogus.Randomizer.ArrayElement(BArray props, Nullable1 min, Nullable`1 max)
at Bogus.DataSet.b__27_0(Match x)
at System.Text.RegularExpressions.Regex.Replace(MatchEvaluator evaluator, Regex regex, String input, Int32 count, Int32 startat)
at System.Text.RegularExpressions.Regex.Replace(String input, MatchEvaluator evaluator)
at Bogus.DataSet.ParseTokens(String value)
at Bogus.DataSet.GetFormattedValue(String path)
at Bogus.DataSets.Address.City()
at Bogus.Person.Populate()
at Bogus.Person..ctor(Randomizer randomizer, String locale)
at Bogus.Faker.get_Person()
at ConsoleApp1.Program.Main(String[] args) in C:\Users\jose.braz.ext\source\repos\ConsoleApp1\ConsoleApp1\Program.cs:line 16

@bchavez
Copy link
Owner

bchavez commented Oct 4, 2020

Very strange. What version of the Bogus NuGet package are you using?

@weguest
Copy link
Author

weguest commented Oct 4, 2020

image
31.0.2

@weguest
Copy link
Author

weguest commented Oct 4, 2020

Very strange... I try to debug, and its fail on get the city name inside the person object.

@bchavez
Copy link
Owner

bchavez commented Oct 4, 2020

I cannot reproduce the exception with 31.0.2. Can you try 30.0.4 does exception still happen?

@weguest
Copy link
Author

weguest commented Oct 4, 2020

30.0.4 works fine!

@bchavez
Copy link
Owner

bchavez commented Oct 4, 2020

Thanks Jose, must be this change here in v31.0.2:

image

I can reproduce now. I will release a fix once I find a solution.

@bchavez bchavez added the bug label Oct 4, 2020
@weguest
Copy link
Author

weguest commented Oct 4, 2020

Thanks!

@bchavez bchavez closed this as completed in 50840f4 Oct 4, 2020
@bchavez
Copy link
Owner

bchavez commented Oct 4, 2020

Thanks Jose. Turns out this is a bug in faker.js too:
https://rawgit.com/Marak/faker.js/master/examples/browser/index.html
image

I released v31.0.3 with the fix. Let me know if it works or if you have any problems with the new Bogus v31.0.3 version.

Please try: https://www.nuget.org/packages/Bogus/31.0.3

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

No branches or pull requests

2 participants