System.InvalidOperationException When Using Override
See original GitHub issueI’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:
- Created 3 years ago
- Comments:6 (4 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

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.
Thanks Nick. I really appreciate the fast response.