New to Telerik Document Processing? Download free 30-day trial

Could not load type from assembly 'WindowsBase' error in .NET Core project

Environment

Product Version N/A
Product Telerik Document Processing
Used with UI for Blazor, UI for Xamarin, UI for WinUI, UI for ASP.NET Core, UI for .NET MAUI

Description

This exception is thrown when the binaries for .NET Framework are used in a project targeting .NET Core.

Error Message

  • System.TypeLoadException: Could not load type 'System.Windows.Size' from assembly 'WindowsBase'
  • System.TypeLoadException: Could not load type of field 'Telerik.Windows.Documents.Spreadsheet.Expressions.DataStructures.CellReferenceRangeExpressionCache:cellReferenceRangeExpressionCache' (1) due to: Could not resolve type with token 010000da from typeref (expected class 'System.Windows.IWeakEventListener' in assembly 'WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35') assembly:WindowsBase, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35 type:System.Windows.IWeakEventListener member:(null)
  • Could not load file or assembly 'WindowsBase, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'. The located assembly's manifest definition does not match the assembly reference.

Solution

Remove all the binaries or NuGet packages related to Telerik Document Processing and make sure you add them again in their .NET Standard-Compatible version that does not include the word 'Windows'.

Example:

.NET Framework .NET Standard-compatible
Telerik.Windows.Documents.Core.dll Telerik.Documents.Core.dll
Telerik.Windows.Documents.Fixed.dll Telerik.Documents.Fixed.dll
Telerik.Windows.Zip.dll Telerik.Zip.dll

Although the word 'Windows' is removed from the assembly names for .NET Core, the namespaces still contain it.

See Also

In this article