Skip to content

The ServiceColor serialization does not work with the net5 publish feature. #277

@schattenmann80

Description

@schattenmann80

I have a small net5 project where I use the FCTB.
And when I start the programm localy in Visual Studio or over they exe there are not problems.

But if I use the publish feature from net5 und try to start the exe I get the following Error:

Exception Info: System.Runtime.Serialization.SerializationException: Invalid BinaryFormatter stream.
---> System.TypeInitializationException: The type initializer for 'System.Runtime.Serialization.Formatters.Binary.Converter' threw an exception.
---> System.IO.FileNotFoundException:
....

After some searching I did found that the problem is the ServiceColor serialization, in the desinger generated code.
But if I remove the following line, in the desinger generated code:
this.InputFCTextBox.ServiceColors = ((FastColoredTextBoxNS.ServiceColors)(resources.GetObject("InputFCTextBox.ServiceColors")));
It does work again.
But I can't save the ServiceColors.

My solution was to remove the [Serializable] attribute from the ServiceColors class.
Than the ServiceColor does not get serializated and stored in the resx file.
Instead the ServiceColors will be stored in the desinger generated code.

I do not unterstand why the ServiceColors must be serializated.
It does take up more space then the generated code.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions