Repository navigation
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0f76250858
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| } | ||
|
|
||
| var module = assembly.ToModuleInfo(); | ||
| var module = CreateModule(assembly, name, publicKeyToken); |
There was a problem hiding this comment.
Preserve metadata caching while creating event-local modules
With the default IncludeModules = true, every exception conversion now calls CreateModule for every included assembly, repeating custom-attribute reflection and filesystem timestamp reads that previously occurred only on a cache miss. ExceptionlessClient.SubmitEvent runs ErrorPlugin synchronously before queueing, so applications with many loaded assemblies or frequent exceptions pay this additional work on the submitting thread for every event, including events subsequently discarded by duplicate checking. Keep module records and their dictionaries event-local, but cache immutable assembly metadata using weak assembly-instance keys so collectible assemblies can still unload.
Useful? React with 👍 / 👎.
Loading the same DLL twice could give both modules one ID and leave an inner frame unresolved. Each error now owns its module IDs and resolves frames by assembly instance. Unreadable metadata skips only the affected assembly.
All six CI checks passed on
0445370. Locally, 160 error-plugin and serializer tests passed with 12 existing skips. Windows runtime resultsWarm conversion took 31% less time than main at 256 modules and 34% less at 768. At 1,536, above the cache cap, it took 2.722 ms versus 1.323 ms on main. Concurrent reports of the same exception can still produce duplicate events.
Verification and implementation details
Module identity and cache lifetime
A module’s ID is its 1-based position in the current error. A name hash cannot distinguish two loads of the same DLL. When module capture is enabled, each top-level error enumerates the currently loaded assemblies once. Inner exceptions and Framework target methods share that error’s assembly list. Its assembly references go out of scope after conversion. The frame assignment calls
GetModuleId(moduleAssemblies, methodBase). The helper returns-1before touching reflection when module collection is disabled and returns the same sentinel for an unmatched frame.The shared cache holds at most 1,024 paths with their manifest module version IDs and metadata snapshots. A cache hit requires both the current path and the loaded DLL’s MVID to match, so a rebuild at the same path refreshes its metadata. A hit skips both version-attribute reads. Every event gets its own mutable module and data dictionary. Cache insertion, replacement and FIFO eviction take the same lock. Readers work from a fully initialized snapshot. File access, reflection and event serialization stay outside the lock. System, generated, locationless and dynamic assembly filters still apply.
Reflection and file metadata
AmbiguousMatchExceptionon a DLL with a repeated version attribute. The two readers now share one private helper. It callsGetCustomAttributesonce for the requested type and uses the value only for exactly one match. Both attributes are single-use. The SDK tries the informational version first, then the file version, then the assembly identity version, skipping a source if its attribute is absent or repeated. Microsoft’s singular lookup contractGeneratedCodeAttribute.IsDefinedanswers that directly and avoids building the old list of attribute instances. The two version readers still read the values.FileInfo. A cold capture with 768 modules took 4.245 ms, against 5.794 ms in an otherwise identical build using separate timestamp reads. Both original timestamp fallbacks remain available. The comparison used eleven fresh processes per build.Regression coverage
The new tests use
Operation_Scenario_Outcomenames and Arrange, Act, Assert phases. They emit DLLs during the run and capture through the SDK error plugin and serializer. Cases include one DLL loaded twice, different files with the same assembly identity, rebuilding a DLL at the same path, Framework AppDomain unload, collectible load contexts, mutations in four simultaneous captures, generated and locationless assemblies, malformed attributes, and all three version outcomes. Windows passed 306 SDK tests on .NET 10 and 294 on .NET Framework 4.7.2, with 17 existing skips on each target.The local stress probe generated 1,280 modules across 40 collectible contexts. Workers retained 320 mutated and JSON-checked events while another worker captured 3,423 errors during load and unload. All 40 contexts were collected with the events alive. The cache peaked at 1,024 and its FIFO keys matched its entries. In eight concurrent errors with a malformed attribute on the inner assembly, the healthy outer frame resolved every time. Eight simultaneous calls with a shared exception object produced eight events on both main and the PR. Every event from that probe had unique module IDs. All local event payloads stayed in memory.
Performance and retention
Measurements used Release on macOS arm64 with .NET 10.0.14. Each process emitted fresh DLLs. Warm timings are medians of five processes per revision and size with rotated run order, 150 warm-up errors and seven timed batches of 200. The earlier CPU profile identified repeated assembly-name reflection on cache hits. Its share of sampled conversion time fell from 41.2% on main to 5.8% after reusing cached metadata.
After the synthetic load context unloaded, the cache exclusively retained a median of 572,072 managed bytes at 768 entries and 783,576 bytes at 1,024 entries. With 1,536 modules emitted it still held 1,024 entries and retained 783,224 bytes. Each median covers five fresh processes. A diagnostic build released both cache roots and measured which managed objects were collected. Path lengths, metadata strings, and dictionary storage affect the totals.
An earlier end-to-end comparison on
3dd1949measured 9.459 ms for 768-module conversion and JSON serialization, against 10.133 ms on main. Individual process times overlapped substantially.