Upgrade from 3.x
Early Wisej.NET 4 builds required replacing System.Drawing.Bitmap with Wisej.Base.ResourceImage. That requirement was subsequently removed, along with the Wisej.Base.ResourceImage class. Follow the resource-manager changes below when upgrading.
Overview
Transitioning to Wisej.NET 4 and the .NET Core Designer requires replacing these two classes:
System.Resources.ResourceManager⇒
Wisej.Resources.ResourceManagerSystem.ComponentModel.ComponentResourceManager⇒Wisej.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 behavior. 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.
The new Wisej.Resources.ResourceManager is available in Wisej.NET starting with build 3.5.18 to ensure backward compatibility from 4.0.
The replacement is necessary solely for managing embedded images. Generally, you will notice extensive use of the ResourceManager in all .Designer.cs and .Designer.vb files.
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.
If you target only .NET Framework, these changes don't apply to you.
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:
- ComponentResourceManager
Replaces all references toSystem.ComponentModel.ComponentResourceManagerwithWisej.Resources.ComponentResourceManager. These are commonly found nested under the project's .resx files. - ResourceManager
- Replaces all references to
System.Resources.ResourceManagerwithWisej.Resources.ResourceManager. These are commonly found in the designer files related to visual components.
- Replaces all references to
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.
Earlier Wisej.NET builds used this type of serialization 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.
Only open legacy binary resources from a trusted source. Storing serialized data in a designer file does not remove the risks of deserialization. See Microsoft's BinaryFormatter security guidance.
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.