EntraCP icon indicating copy to clipboard operation
EntraCP copied to clipboard

V30 breaks SharePoint

Open Vice93 opened this issue 6 months ago • 4 comments

Describe the problem After installing EntraCP v30 and updating machine.config, we get this issue when doing any Sharepoint related activity: 05.18.2026 15:59:52.00 OWSTIMER.EXE (0x34C4) 0x2EF4 SharePoint Foundation Timer d2ck Unexpected An error occurred while logging the history for timer job (job-application-server): Could not load file or assembly 'System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51' or one of its dependencies. The system cannot find the file specified. fad814a2-8e7c-20ac-014f-89b6a1f17e4f

This happens when opening CA, when running the products configuration wizard and when deploying our own custom wsp packages. If I remove the custom binding redirects for System.Memory from the machine.config, everything works fine again (even EntraCP).

To Reproduce Steps to reproduce the behavior:

  1. Deploy latest EntraCP and update machine.config

Version of EntraCP: v30

Relevant logs: Log line included above, happens on most SharePoint stuff trying to connect to the database.

Vice93 avatar May 18 '26 14:05 Vice93

Thank you for reporting this. This is bad news. EntraCP v30 has a dependency on System.Memory v4.0.5.0, but .NET 4.8 tries to load v4.0.2.0, hence the binding, but somehow it causes a side effect in your farm.

Can you run the script below to list all the versions installed in the server:

$gacRoot = Join-Path $env:WINDIR 'Microsoft.NET\assembly\GAC_MSIL'
Get-ChildItem -Path $gacRoot -Filter 'System.Memory.dll' -Recurse -File -ErrorAction SilentlyContinue |
ForEach-Object {
    $assemblyInfo = [System.Reflection.AssemblyName]::GetAssemblyName($_.FullName)
    Write-Host "Assembly Name: $($assemblyInfo.Name); Version: $($assemblyInfo.Version)"
}

Can you also run this: Get-ComputerInfo -Property @('OsName','OsOperatingSystemSKU','OSArchitecture','WindowsVersion','WindowsBuildLabEx','OsLanguage','OsMuiLanguages')

and this: $PSVersionTable

Yvand avatar May 19 '26 09:05 Yvand

I did a bit of debugging and realized this is actually because we use the System.Memory dll in our own custom .wsp package with the same version (4.0.5). When I re-deploy my solution, the retraction uninstalls the System.Memory v4.0.5 dll (because its referenced in our wsp Package.package file).

It worked in the previous EntraCP version we used (Preview 1) because it uses an older System.Memory and they never collide. Im not entirely sure what the best solution would be here.

GAC pre-retract:

Assembly Name: System.Memory; Version: 4.0.1.1
Assembly Name: System.Memory; Version: 4.0.1.2
Assembly Name: System.Memory; Version: 4.0.5.0

Post-retract:

Assembly Name: System.Memory; Version: 4.0.1.1
Assembly Name: System.Memory; Version: 4.0.1.2

It should be possible to reproduce if you retract EntraCP without removing/updating the machine config

Vice93 avatar May 20 '26 06:05 Vice93

I think I will just revert to preview.1. version, which references 4.0.1.2. You can close this issue.

One note: While debugging this, I noticed there is also a binding redirect for System.Diagnostics.DiagnosticSource. This conflicts with the popular library SeriLog. We previously had an unidentified weird bug that caused SeriLog to fail because of a mysterious redirect from 8.0.0.0 to 8.0.0.1. I realise now that this is because of the machine.config.

The solution to use machine.config is very aggressive, and can cause a lot of unidentified issues if you forget that the redirects exist. I would maybe check if there are alternate ways of dealing with this.

Vice93 avatar May 22 '26 06:05 Vice93

I agree the machine.config file is not ideal, I explained the reason in the install page:
"Since SharePoint runs in many processes (w3wp.exe, owstimer.exe, powershell.exe, etc…), the only config file that can propagate the bindings to all is the machine.config." So, as an alternative, you may set the bindings to the child .config files for all SharePoint processes.

I understand you have a custom solution that also uses System.Memory 4.0.5.0, but I don't understand why the EntraCP v30 assembly bindings breaks it:

  • With your custom solution and without EntraCP v30 assembly bindings, this should work: Add-Type -AssemblyName ('System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51')

  • With your custom solution and with EntraCP v30 assembly bindings, these 2 should work: Add-Type -AssemblyName ('System.Memory, Version=4.0.5.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51') Add-Type -AssemblyName ('System.Memory, Version=4.0.1.1, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51')

Can you confirm this?

Yvand avatar May 22 '26 10:05 Yvand

The issue is that retracting a wsp package (Uninstall-SPSolution) also removes all referenced dlls in that package from the GAC. If this happens, while the machine.config redirects is still present, SharePoint no longer works after it removes it.

The correct flow to solve this is:

  1. When installing
  • Deploy package
  • Add machine.config binding-redirect
  1. When uninstalling
  • Remove machine.config binding-redirect
  • Retract package

However, instead of creating a new deployment flow, Id rather just downgrade to a version that doesnt use the same System.Memory dll.

Since EntraCP normally updates using Update-SPSolution, the issue doesnt show up for most people (Update does NOT remove GAC assemblies). Its only because we do uninstall/install flow when deploying our updates.

Vice93 avatar May 27 '26 05:05 Vice93

Makes sense. Just be mindful that EntraCP < v30.0 use deprecated versions of Azure.Identity. EntraCP v30.0 uses Azure.Identity v1.18.0.

Closing this issue, feel free to reopen if needed.

Yvand avatar May 27 '26 08:05 Yvand