Upgrade from 3.x

Overview

Transitioning to Wisej.NET 4 and the .NET Core Designer requires replacing these two classes:

  1. System.Resources.ResourceManagerWisej.Resources.ResourceManager

  2. System.ComponentModel.ComponentResourceManagerWisej.Resources.ComponentResourceManager

The rationale behind this change is that the implementation of System.Resources.ResourceManager in .NET loads the specific type specified in the resources file without providing a way to override its behvior. Consequently, when dealing with embedded images, this approach fails on Linux systems without the installation of libgdiplus, and it is inherently incompatible with iOS and Android devices, resulting in failure on those platforms as well.

Our re-implementation maintains full compatibility with all existing resources and is flexible enough to adapt to the target platform seamlessly. On Windows, it utilizes System.Drawing (GDI+), while on all other platforms, it leverages our newly developed System.Drawing.Managed, which is based on ImageSharp.

ResXFileCodeGenerator

Since the .Designer.cs or .Designer.vb file associated with a project's resources is automatically generated by Visual Studio using the ResXFileCodeGenerator tool, we have replaced it to ensure that the generated code utilizes the updated types introduced with Wisej.NET 4.

Upgrade Tool

The Upgrade Tool is designed to automate the migration of .Designer.cs/vb files by replacing the ResourceManager references.

Wisej.NET 4 Upgrade Tool

The tool applies the following modifications:

  1. ComponentResourceManager Replaces all references to System.ComponentModel.ComponentResourceManager to Wisej.Resources.ComponentResourceManager. These are commonly found nested under the project's .resx files.

  2. ResourceManager

    • Replaces all references to System.Resources.ResourceManager to Wisej.Resources.ResourceManager. These are commonly found in the designer files related to visual components.

Binary Serialization in Resx

See also Binary Formatter and NET 9. Beginning with .NET 9, Microsoft removed the binary formatter (serializer) from the core framework and made it available as a separate package through NuGet. As a result, some existing .resx files may be incompatible with .NET 9 and newer versions unless you import the System.Runtime.Serialization.Formatters package from NuGet.

To identify affected .resx files, you can search for the MIME type "application/x-microsoft.net.object.binary.base64" across your *.resx files. This will help you locate the instances that require the binary formatter so you can address compatibility issues.

Wisej.NET utilized this type of serialization, which is entirely safe, to store RulerSnapLines and ResponsiveProfiles within .resx files. If you encounter other instances of binary serialization, you will need to either contact the component vendor responsible for serializing those values or use the System.Runtime.Serialization.Formatters package to maintain compatibility.

Once you open the designer for the affected view and save it back, Wisej.NET will automatically re-serialize those properties using the MIME type "application/x-microsoft.net.object.bytearray.base64". This enhancement not only resolves compatibility issues but also provides an additional advantage: Responsive Profiles are now supported when running a hybrid Wisej.NET application on iOS or Android devices.

Last updated

Was this helpful?