-
Notifications
You must be signed in to change notification settings - Fork 31
Thread safety #282
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
Merged
Merged
Thread safety #282
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- Added a permissions structure to `settings.local.json` for specific Bash commands. - Updated `CLAUDE.md` with project overview and removed outdated commands. - Refactored `XrmMockup365` to utilize a static metadata cache for better performance. - Introduced `StaticMetadataCache` in `Core.cs` for improved data handling. - Modified `Core` constructor to accept the new cache, enabling metadata reuse. - Implemented thread safety tests in `TestThreadSafety.cs` to ensure instance independence.
- Updated `settings.local.json` to add new commands for .NET project creation and timing tests. - Marked a test in `TestTableReset.cs` to be skipped due to parallel execution issues. - Refactored `UnitTestBase.cs`, `UnitTestBaseNoProxyTypes.cs`, and `UnitTestBaseNoReset.cs` to implement `IClassFixture`, improving test isolation and removing unnecessary environment reset logic. - Deprecated `XrmMockupCollection` and `XrmMockupCollectionNoProxyTypes` as tests now run in parallel with individual instances. - Introduced shared settings in `XrmMockupFixture.cs` and `XrmMockupFixtureNoProxyTypes.cs` to optimize metadata cache hits. - Updated `XrmMockup365Test.csproj` to include `xunit.runner.json`, which is now copied to the output directory. - Added a new `xunit.runner.json` file to configure parallel test execution settings for improved performance.
mkholt
reviewed
Sep 12, 2025
Member
mkholt
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great idea, I have a few worries regarding the test-completeness around the instances, and also if this will break existing installations?
See comments
- Added `StaticMetadataCache` class to `DG.Tools.XrmMockup`. - Removed old `StaticMetadataCache` definition from `Core.cs`. - Updated condition in `BuildEntityTypeMap` method. - Adjusted logical grouping for `preImage` check in `PluginTrigger.cs`. - Removed deprecated test collections from `SharedTests.projitems`. - Deleted `XrmmockupCollection` and `XrmmockupCollectionNoProxyTypes` classes. - Modified test logic in `TestThreadSafety.cs` for static contact names.
mkholt
approved these changes
Sep 12, 2025
Changed the condition to proceed only if usable assemblies are available, improving the logic flow in the method.
- Updated assembly version and file version to "1.15.4". - Changed `MainDict` in `DbTable` to `ConcurrentDictionary` for improved thread safety. - Modified `Remove` method to use `TryRemove` for safe concurrent removal. - Updated `GetEnumerator` to return a snapshot of values to avoid modification exceptions. - Adjusted `Clone` method to maintain thread safety during cloning. - Changed `RestoreSerializableDTO` to use `ConcurrentDictionary` for `MainDict`. - Modified retrieval logic in `XrmDb` to create snapshots before concurrent modifications. - Added new tests in `TestThreadSafety.cs` to validate concurrent operations and ensure thread safety.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added caching of the static parts of XrmMockup, such that each test can get its own instance with their own db.
This enables parallel execution