Skip to content

[Bug]: Revit 2026.4 + pyRevit master: CoreCLR ALC conflict — System.Collections.Immutable 8.0.0 preloaded conflicts with 9.0.0 required by Microsoft.CodeAnalysis 5.3.0 #3317

@Pierre-du-Lioncourt

Description

@Pierre-du-Lioncourt

✈ Pre-Flight checks

  • I don't have SentinelOne antivirus installed (see above for the solution)
  • I have searched in the issues (open and closed) but couldn't find a similar issue
  • I have searched in the pyRevit Forum for similar issues
  • I already followed the installation troubleshooting guide thoroughly
  • I am using the latest pyRevit Version

🐞 Describe the bug

When launching Revit 2026.4 with pyRevit plugin 6.3.0 attached via master clone,
the pyRevit ribbon tab fails to load. All extensions (pyRevitCore, pyRevitTools)
throw System.IO.FileNotFoundException for System.Collections.Immutable, Version=9.0.0.0, even though the DLL exists on disk with that exact assembly
version.

Root cause identified

This is NOT a missing DLL, probing path, or binding redirect issue. It is a
side-by-side assembly conflict in the default AssemblyLoadContext of CoreCLR
(Revit 2026 runs on .NET 8 CoreCLR, not .NET Framework).

  1. Revit 2026.4 preloads on startup:
    • System.Collections.Immutable 8.0.0.0 (from Microsoft.NETCore.App 8.0)
    • Microsoft.Extensions.DependencyInjection 8.0.0.0
  2. pyRevit master clone ships with Microsoft.CodeAnalysis 5.3.0.0 which
    hard-requires System.Collections.Immutable 9.0.0.0.
  3. CoreCLR's default ALC refuses to load 9.0.0 when 8.0.0 is already loaded —
    this would produce distinct type identities for the same type, violating
    ALC invariants.
  4. Roslyn fails to initialize → pyRevit shows the WPF error dialog.

Key journal evidence (Revit journal, line 1189):

Addin's module System.Collections.Immutable of version 9.0.0.0 conflicts with same preloaded module of version 8.0.0.0

Secondary finding (line 1274): the master clone was compiled against RevitAPI
25.4.20.0, but the installed Revit is 26.4.0.0 — SDK mismatch indicating the
master branch is in a transitional state.

Additional broken dependency in CLI: Could not load DocoptNet 0.8.3.0.

Attempted workarounds (none worked)

  1. Copying System.Collections.Immutable.dll from .NET 9.0.15 runtime to
    pyRevit-Master/bin/ and pyRevit-Master/site-packages/.
  2. pyrevit caches clear --all.
  3. Installing multiple .NET Desktop runtimes (8.0.23, 9.0.10, 9.0.15, 10.0.2).
  4. Reattaching clone with pyrevit attach default.

Binding redirect (classic .NET Framework fix) is not applicable because
CoreCLR does not use Fusion-style binding redirects.

Suggested direction for upstream fix

Not prescriptive — the team decides. Possible paths:

  1. Downgrade Microsoft.CodeAnalysis in master to a version compatible with
    System.Collections.Immutable 8.0.0 (to align with Revit 2026's preload).
  2. Load Roslyn dependencies in an isolated AssemblyLoadContext, avoiding
    collision with Revit's default ALC.
  3. Bundle the full .NET 9 runtime alongside pyRevit if option 2 is infeasible.

⌨ Error/Debug Message

ERROR [pyrevit.loader.sessionmgr] Error building/loading extension 'pyRevitCore': 
System.IO.FileNotFoundException: Could not load file or assembly 
'System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a'. The system cannot find the file specified.
File name: 'System.Collections.Immutable, Version=9.0.0.0, Culture=neutral, 
PublicKeyToken=b03f5f7f11d50a3a'
   at pyRevitAssemblyBuilder.AssemblyMaker.AssemblyBuilderService.BuildWithRoslyn(...)
   at pyRevitAssemblyBuilder.AssemblyMaker.AssemblyBuilderService.BuildExtensionAssembly(...)
   at pyRevitAssemblyBuilder.SessionManager.SessionManagerService.LoadSession()

ERROR [pyrevit.loader.sessionmgr] Error building/loading extension 'pyRevitTools': 
[identical error]

WARNING [pyrevit.loader.sessionmgr] No pyRevit assemblies found

♻️ To Reproduce

  1. Install Revit 2026.4 (current shipping release, build 26.0.4.409).
  2. Install pyRevit plugin 6.3.0 and CLI 6.4.0 from the official installers.
  3. pyrevit attach default <master-clone> 2026 (or the equivalent
    manifest pointing the addin to the master clone's pyRevitLoader.dll).
  4. Launch Revit 2026.4 and load any project (an empty document is
    sufficient — the failure occurs at addin initialization, not at
    project-content level).
  5. Observe the WPF "pyRevit" error dialog at startup.

⏲️ Expected behavior

The pyRevit ribbon tab loads cleanly when opening any project in
Revit 2026.4, exposing the standard pyRevitTools / pyRevitCore commands.

🖥️ Hardware and Software Setup (please complete the following information)

`pyrevit env` FAILS with a similar dependency loading error 
(relevant to this issue — demonstrates the master clone's broken 
dependency chain is not limited to the Revit runtime):

$ pyrevit env
Unhandled exception. System.IO.FileNotFoundException: Could not 
load file or assembly 'DocoptNet, Version=0.8.3.0, Culture=neutral, 
PublicKeyToken=7a38c71da49a547e'. El sistema no puede encontrar el 
archivo especificado.
File name: 'DocoptNet, Version=0.8.3.0, Culture=neutral, 
PublicKeyToken=7a38c71da49a547e'
   at pyRevitCLI.PyRevitCLI.Main(String[] args)

Manual environment summary:

- Revit: 2026.4 (First Customer Ship, Build 26.0.4.409, 20250227_1515 x64)
- pyRevit plugin: 6.3.0
- pyRevit CLI: 6.4.0 (non-functional, see above)
- Clone: master (default attach)
- Engine: DEFAULT (2712)

- OS: Windows 11 24H2 (Build 10.0.26200.0)

- .NET runtimes installed:
    Microsoft.AspNetCore.App     8.0.21
    Microsoft.NETCore.App        8.0.23
    Microsoft.NETCore.App        9.0.10
    Microsoft.NETCore.App        9.0.15
    Microsoft.NETCore.App        10.0.2
    Microsoft.WindowsDesktop.App 8.0.23
    Microsoft.WindowsDesktop.App 9.0.15
    Microsoft.WindowsDesktop.App 10.0.2

Additional context

Project: NEXTIA (Ciudad Juárez, México) — building an MCP server that
bridges Claude (LLM client) with Revit 2026 via pyRevit Routes for
structural modeling automation. The bridge has its client side fully
built and unit-tested (60 mocked tests green); only the Routes
integration is blocked by this bug.

Happy to test candidate builds, patches, or instrumented WIP versions
against my Revit 2026.4 installation, and to share additional
diagnostic data (full journal, dependency walks, etc.) if useful.

Thanks to the pyRevit team for the considerable work already invested
in supporting Revit 2026 — the fact that the addin almost loads
cleanly indicates most of the heavy lifting is done.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugBug that stops user from using the tool or a major portion of pyRevit functionality [class]

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions