question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

System.InvalidOperationException When Using Override

See original GitHub issue

I’m experiencing the following exception when using AutoFaker.Configure for global configuration (AutoFaker<T> does not allow configurations for some reason). I am calling AutoFaker.Configure for each test because it’s in the Setup method, and it seems that this will randomly cause issues. There doesn’t seem to be a consistent way to reproduce this, but it happens every other run.

build	31-Jul-2020 14:48:05	  X Tests.Generate_WithOkResponse_ReturnsTrueAndResults [1ms]
build	31-Jul-2020 14:48:05	  Error Message:
build	31-Jul-2020 14:48:05	   System.InvalidOperationException : Collection was modified; enumeration operation may not execute.
build	31-Jul-2020 14:48:05	  Stack Trace:
build	31-Jul-2020 14:48:05	     at System.Collections.Generic.List`1.Enumerator.MoveNextRare()
build	31-Jul-2020 14:48:05	   at System.Linq.Enumerable.Any[TSource](IEnumerable`1 source, Func`2 predicate)
build	31-Jul-2020 14:48:05	   at AutoBogus.AutoConfigBuilder.WithOverride[TBuilder](AutoGeneratorOverride generatorOverride, TBuilder builder)
build	31-Jul-2020 14:48:05	   at AutoBogus.AutoConfigBuilder.AutoBogus.IAutoConfigBuilder<AutoBogus.IAutoFakerDefaultConfigBuilder>.WithOverride(AutoGeneratorOverride generatorOverride)
build	31-Jul-2020 14:48:05	   at Tests.Utils.Generators.<>c.<.ctor>b__21_32(IAutoFakerDefaultConfigBuilder builder) in /buildeng/bamboo-agent-home/xml-data/build-dir/JOB1/Tests/Utils/Generators.cs:line 69
build	31-Jul-2020 14:48:05	   at AutoBogus.AutoFaker.Configure(Action`1 configure)

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
nickdodd79commented, Sep 5, 2020

Hey @tristangreeno

Just an update that I have been busy these last few weeks. Hoping to add the configuration builder to the Generate method this week.

Nick.

0reactions
tristangreenocommented, Sep 16, 2020

Thanks Nick. I really appreciate the fast response.

Read more comments on GitHub >

github_iconTop Results From Across the Web

InvalidOperationException Class (System)
When overridden in a derived class, returns the Exception that is the root cause of one or more subsequent exceptions. (Inherited from Exception)....
Read more >
Cannot override system-specified headers ...
I use sample asset to try and I get an error which is in below: InvalidOperationException: Cannot override system-specified headers ...
Read more >
An attempt to override an existing mapping was detected ...
An attempt to override an existing mapping was detected for type System.Web.IHttpHandler with name "", currently mapped to type Microsoft.
Read more >
Reinstalling XProtect VMS fails with error ...
Reinstalling the Milestone XProtect® VMS fails with error: "InvalidOperationException: You cannot override Local Management server, since there is no local ...
Read more >
How to fix "No database provider has been configured for this ...
A provider can be configured by overriding the DbContext.OnConfiguring method or by using AddDbContext on the application service provider.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found