Skip to content

Fix of race condition in compilation of markup controls with property directives#1924

Merged
tomasherceg merged 2 commits intomainfrom
fix/control-compilation-race-condition
Apr 26, 2025
Merged

Fix of race condition in compilation of markup controls with property directives#1924
tomasherceg merged 2 commits intomainfrom
fix/control-compilation-race-condition

Conversation

@tomasherceg
Copy link
Copy Markdown
Member

No description provided.

@tomasherceg tomasherceg requested a review from Copilot April 26, 2025 09:21
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes a race condition in the dynamic compilation of markup controls by adding proper synchronization and error handling.

  • Introduces a locking mechanism around dynamic type creation in ResolvedPropertyDeclarationDirectiveCompiler.cs
  • Enhances error handling with a try-catch block to wrap dynamic type creation exceptions in a more informative InvalidOperationException
  • Updates hash generation in PropertyDeclarationDirectiveCompiler.cs to ensure valid type names

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
src/Framework/Framework/Compilation/Directives/ResolvedPropertyDeclarationDirectiveCompiler.cs Adds a locking mechanism and error handling to prevent race conditions in dynamic type creation
src/Framework/Framework/Compilation/Directives/PropertyDeclarationDirectiveCompiler.cs Modifies hash generation for type names by replacing characters to maintain valid naming
Comments suppressed due to low confidence (1)

src/Framework/Framework/Compilation/Directives/ResolvedPropertyDeclarationDirectiveCompiler.cs:15

  • [nitpick] Consider renaming 'locker' to a more descriptive name like 'dynamicAssemblyLock' to improve clarity in its purpose.
private static readonly object locker = new();

@exyi exyi added this to the Version 4.3 milestone Apr 26, 2025
@tomasherceg tomasherceg merged commit afbcd6b into main Apr 26, 2025
14 of 15 checks passed
@tomasherceg tomasherceg deleted the fix/control-compilation-race-condition branch April 26, 2025 10:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants