Skip to content

Make assembly scanning optional and fix AutoRegisterInputType reallocation (#749) - #750

Merged
YogeshPraj merged 2 commits into
microsoft:mainfrom
YogeshPraj:fix/issues-747-749
Sep 11, 2026
Merged

Make assembly scanning optional and fix AutoRegisterInputType reallocation (#749)#750
YogeshPraj merged 2 commits into
microsoft:mainfrom
YogeshPraj:fix/issues-747-749

Conversation

@YogeshPraj

Copy link
Copy Markdown
Contributor

Summary

Fixes #749.

1. Assembly scanning is now optional

Adds ReSettings.EnableAssemblyScanning (default true, preserving current behavior). When false, CustomTypeProvider skips the AppDomain-wide scan for [DynamicLinqType]-marked types done by DefaultDynamicLinqCustomTypeProvider. Only explicitly supplied CustomTypes (plus auto-registered input types) are registered, avoiding the scan cost.

2. AutoRegisterInputType no longer reallocates CustomTypes every registration

RegisterRule previously ran _reSettings.CustomTypes = collector.ToArray() unconditionally on each workflow registration, replacing the array reference every time. That broke the ReferenceEquals cache in RuleExpressionParser.GetParsingConfig() and forced a new CustomTypeProvider (and a fresh assembly scan) each time. The array is now only swapped when new types are actually discovered.

Changes

  • ReSettings: new EnableAssemblyScanning property (+ copy constructor).
  • CustomTypeProvider: new enableAssemblyScanning overload; skips base.GetCustomTypes() when disabled.
  • RuleExpressionParser: threads the flag into the parsing config and settings fingerprint.
  • RulesEngine.RegisterRule: only reassign CustomTypes when the collected set changed.
  • Tests: Issue749Test.cs (6 tests).
  • CHANGELOG.md updated under Unreleased.

Testing

Full unit suite passes: 184/184 (net9.0).

Note on #747 (digital signatures)

#747 is a signing/governance question, not a code change. RulesEngine assemblies are strong-name signed but not Authenticode-signed; adding Microsoft ESRP Authenticode signing to the release pipeline is a maintainer/infra decision and is out of scope for this PR.

…ation (microsoft#749)

Add ReSettings.EnableAssemblyScanning (default true) to opt out of the AppDomain-wide [DynamicLinqType] scan in CustomTypeProvider. Stop reassigning ReSettings.CustomTypes on every workflow registration when no new types are discovered, which previously broke the ReferenceEquals cache in RuleExpressionParser and forced a fresh scan each time.
@YogeshPraj
YogeshPraj enabled auto-merge (squash) September 11, 2026 17:16
@YogeshPraj
YogeshPraj merged commit 5650f93 into microsoft:main Sep 11, 2026
3 checks passed
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.

Make Assembly Scans Optional

2 participants