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

ConfigurationItemFactory - Handle concurrent registration of extensions #5122

Merged
merged 1 commit into from Dec 5, 2022

Conversation

snakefoot
Copy link
Contributor

@snakefoot snakefoot commented Dec 5, 2022

See also: Lombiq/UI-Testing-Toolbox#239

2022-11-24 20:18:24.4539 Error Failed to add type 'NLog.Web.LayoutRenderers.AspNetRequestConnectionIdLayoutRenderer'. Exception: System.InvalidOperationException: Operations that change non-concurrent collections must have exclusive access. A concurrent update was performed on this collection and corrupted its state. The collection's state is no longer correct.
   at System.Collections.Generic.Dictionary`2.TryInsert(TKey key, TValue value, InsertionBehavior behavior)
   at System.Collections.Generic.Dictionary`2.set_Item(TKey key, TValue value)
   at NLog.Config.Factory`2.RegisterDefinition(String itemName, Type itemDefinition, String assemblyName, String itemNamePrefix)
   at NLog.Config.Factory`2.RegisterType(Type type, String assemblyName, String itemNamePrefix)
   at NLog.Config.Factory`2.ScanTypes(Type[] types, String assemblyName, String itemNamePrefix)

Guessing this comes from concurrently creating multiple HostBuilders and calling AddNLogWeb() / UseNLog() that will register the same NLog.Web.AspNetCore-Assembly-extensions in parallel.

@snakefoot snakefoot enabled auto-merge (squash) December 5, 2022 17:26
@snakefoot snakefoot changed the title ConfigurationItemFactory - Handle concurrent registration of configuration items ConfigurationItemFactory - Handle concurrent registration of extensions Dec 5, 2022
@snakefoot snakefoot enabled auto-merge (squash) December 5, 2022 18:16
@sonarcloud
Copy link

sonarcloud bot commented Dec 5, 2022

SonarCloud Quality Gate failed.    Quality Gate failed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

70.3% 70.3% Coverage
0.0% 0.0% Duplication

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

Successfully merging this pull request may close these issues.

None yet

1 participant