> For the complete documentation index, see [llms.txt](https://docs.wisej.com/docs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.wisej.com/docs/welcome/releases/whats-new-in-4.0/upgrade-from-3.x.md).

# Upgrade from 3.x

{% hint style="success" %}
Previously, upgrading to Wisej.NET 4 involved a complex process that required replacing instances of `System.Drawing.Bitmap` with `Wisej.Base.ResourceImage`. However, with the latest build, the requirement to use Wisej.Base.ResourceImage has been eliminated and the class has been removed. This update simplifies the upgrade process and enhances ease of development, making it more straightforward for developers to transition to the latest version.
{% endhint %}

## Overview

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

1. `System.Resources.ResourceManager` ⇒\
   `Wisej.Resources.ResourceManager`
2. `System.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 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.

{% hint style="success" %}
The new `Wisej.Resources.ResourceManager` is available in Wisej.NET starting with build 3.5.18 to ensure backward compatibility from 4.0.
{% endhint %}

{% hint style="warning" %}
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.
{% endhint %}

## 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.

{% hint style="success" %}
If you target only `.NET Framework`, these changes don't apply to you.
{% endhint %}

## Upgrade Tool

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

<figure><img src="/files/2u42YzNjAVORpzrP6L1Q" alt=""><figcaption><p>Wisej.NET 4 Upgrade Tool</p></figcaption></figure>

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.

{% file src="/files/rvJ2syddNmKBxGc4C1Fs" %}

## Binary Serialization in Resx

See also [Binary Formatter and NET 9](https://docs.wisej.com/docs/welcome/releases/whats-new-in-4.0/pages/IzsyfeqAvD316v5dM3MY#binaryformatter-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.

{% hint style="success" %}
Rest assured, there are no security concerns when using this binary serialization within design files.
{% endhint %}

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.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.wisej.com/docs/welcome/releases/whats-new-in-4.0/upgrade-from-3.x.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
