19
Views
4
Comments
DLL Issues with System.Collections.Immutable
Question

I am creating an extension that requires System.Collections.Immutable version 9.0.0 since I am creating a simple MimeType detection extension using MimeDetective, since the one provided on forge only has the old functionality. This requires System.Collections.Immutable 9.0.0. The issue that occurs is with System.Collections.Immutable. Now whenever I create just a random 4.6.1 (I have tried 4.8 aswell) .NET console application my application works fine, the moment i move to outsystems I start to face this issues, this issue:

System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3aCould not load type 'System.Runtime.InteropServices.ImmutableCoallectionsMarshal' from assembly 'System.Collections.Immutable, Version=1.2.3.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. at MimeDetective.Definitions.DefaultDefinitions.All()


I can confirmed that Bin buddled is System.Collections.Immutable 9.0.0 as a part my extension (see below). I considered if there is something else from our application that is causing this conflict, So created a new application in outsystems to make sure no other packages where installed except some base Outsystems packages and I still face this issue.

I have been trying different things from .NET versions, to even creating an empty extension that only installs the System.Collections.Immutable as a Binary and tries to use it and still faces the issues of methods not found. Below what fails is the builder.ImmutableList().

So I cannot seem to understand what could be going wrong. Seems like code is working fine when running it anywhere else except when doing anything in Outsystems. So I must be misunderstanding something in Outsystems.

Thanks for your time and please let me know what you think.


EDIT I would like to add that I have also tried adding the System.Runtime.InteropServices.dll raw and it does not seem to work either.



TestintImmutableList.xif
2025-09-28 15-31-59
Claudio Barra

Hello @Taqui Syed Shah I tested the extension and it work on my enviroment


So must be something with your configuration maybe, I will attach the file, but I just remove the unused imports only, try always to Update Code Source, before making any change on the code and check for the needed DLLS to Deploy Target to Copy to the Binaries Directory

Greetings

TestintImmutableList.xif
UserImage.jpg
Fatin Amirah

hi @Taqui Syed Shah , have you found the solution to this issue? because i also encounter the same. but in my case is System.Text.Json. and i've done the same thing as you did. but still have the same issue. 

2025-12-03 17-22-41
Lavanya Kamalaguru

Hi @Taqui Syed Shah ,

The DLL Deploy action  is already set to Copy to Binary directory, the most likely reason for the failure is a framework or dependency mismatch. The System.Collections.Immutable.dll used in the extension must be compatible with the .NET Framework version supported by Outsystems.

Use a .NET Core  or incompatible version of System.Collections.Immutable. Ensure all  dependent assemblies are included if required. Check the exact runtime error in Service Center and pls share the error log screenshot here.

2026-03-20 01-28-51
Saugat Biswas

Hi @Taqui Syed Shah ,

You’re facing a fundamental and well‑known limitation of OutSystems Extensions, not a bug in your code or in MimeDetective.

This is because, the OutSystems runtime forcibly loads its own older framework assemblies first and Extensions cannot safely use modern System.* NuGet packages (like System.Collections.Immutable 9.0.0) even if you bundle the DLL.

Simply put, even if your extension does ship System.Collections.Immutable 9.0.0, the runtime instead loads: 

System.Collections.Immutable, Version=1.2.3.0 

And that version does not contain: ImmutableCollectionsMarshal.

For the same reason, many modern .NET libraries cannot run inside extensions.

Your realistic option: Downgrade MimeDetective.  Use an older MimeDetective version that: 

  • Does not reference ImmutableCollectionsMarshal 
  • Works with System.Collections.Immutable 1.x


I know this does not help much but thought of sharing.

Cheers,

Saugat

Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.