Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error on saving a filterscheme containing an enum #169

Closed
half-evil opened this issue Nov 8, 2019 · 5 comments
Closed

Error on saving a filterscheme containing an enum #169

half-evil opened this issue Nov 8, 2019 · 5 comments

Comments

@half-evil
Copy link

Hi WildGums-Team,

thank you for this useful component. I'm getting an exception The '`' character, hexadecimal value 0x60, cannot be included in a name. when I try to save/serialize a filterscheme that contains a rule based on an enum value.
My example rule ToString is Movement is equal to 'B1' with the enum definition

public enum Movement : byte
{
    B1 = 0,
    B2 = 1
}

The exception gets thrown by calling Catel.Runtime.Serialization.Xml.XmlSerializer.Serialize(path, memoryStream) or FilterSerializationService.SaveFiltersAsync(path).

I've found this issue Catel/Catel#1073 of Catel.Core v4. Maybe they are related.

Also an existing xml-file gets overwritten/deleted, if the serialization fails. Please can you change this behaviour, that the file gets only overwritten, when the serialization succeeds?

Platform: Win 10
.NET version: 4.6.1 and Core 3
FilterBuilder 3.1.1, Catel.Core 5.10.0 and 5.11.2

@GeertvanHorrik
Copy link
Member

Can you please try the latest prerelease (alpha) to see if that fixes the issue?

@half-evil
Copy link
Author

The bug still exists in FilterBuilder v3.2alpha-0277.
With Catel.Core v5.12.0-beta0006 I was able to write the filterschemes to a xml-file. But now fSchemes.LoadFiltersAsync(xmlpath) doesn't return anything and no exception is thrown. The task doesn't complete anymore.

Here is the xml of the filterscheme:

<FilterScheme ctl:graphid="12" xmlns:d0p0="http://schemas.datacontract.org/2004/07/Orc.FilterBuilder.Models" i:type="d0p0:FilterScheme">
      <TargetType ctl:type="System.String">OSPH.Isomed.Lib.DataPoint</TargetType>
      <Title>Nur Isokinetische Phase</Title>
      <FilterGroup ctl:IsNull="true" />
      <HasInvalidConditionItems>False</HasInvalidConditionItems>
      <ConditionItems ctl:graphid="13">
        <ConditionGroup ctl:graphid="14" xmlns:d0p0="http://schemas.datacontract.org/2004/07/Orc.FilterBuilder" i:type="d0p0:ConditionGroup">
          <Type>And</Type>
          <Items ctl:graphid="15">
            <PropertyExpression ctl:graphid="16" i:type="d0p0:PropertyExpression">
              <Property ctl:type="System.String">OSPH.Isomed.Lib.DataPoint||Phase</Property>
              <DataTypeExpression ctl:graphid="17" ctl:type="Orc.FilterBuilder.EnumExpression`1[[OSPH.Isomed.Lib.Phase]]">
                <Value>Isokinetic</Value>
                <IsNullable>False</IsNullable>
                <SelectedCondition>EqualTo</SelectedCondition>
                <IsValueRequired>True</IsValueRequired>
                <ValueControlType>Enum</ValueControlType>
              </DataTypeExpression>
              <Items ctl:graphid="18" />
            </PropertyExpression>
            <PropertyExpression ctl:graphid="19" i:type="d0p0:PropertyExpression">
              <Property ctl:type="System.String">OSPH.Isomed.Lib.DataPoint||Movement</Property>
              <DataTypeExpression ctl:graphid="20" ctl:type="Orc.FilterBuilder.EnumExpression`1[[OSPH.Isomed.Lib.Movement]]">
                <Value>B1</Value>
                <IsNullable>False</IsNullable>
                <SelectedCondition>EqualTo</SelectedCondition>
                <IsValueRequired>True</IsValueRequired>
                <ValueControlType>Enum</ValueControlType>
              </DataTypeExpression>
              <Items ctl:graphid="21" />
            </PropertyExpression>
          </Items>
        </ConditionGroup>
      </ConditionItems>
    </FilterScheme>

@GeertvanHorrik
Copy link
Member

Could you please create a repro / share your code so we can implement this as a unit test? We made some improvements to the serialization engine in Catel (beta 7) today, but want to test it.

@half-evil
Copy link
Author

Sorry for being so late. Here is my repo https://github.com/half-evil/FilterSchemeTests with a unit test of my save function.
With your new version 3.2.0 of FilterBuilder I get this error:
System.Runtime.Serialization.SerializationException : Type 'Orc.FilterBuilder.ConditionGroup' with data contract name 'ConditionGroup:http://schemas.datacontract.org/2004/07/Orc.FilterBuilder' is not expected. Add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.

Libs

Catel.Core 5.12.1-beta0262
Orc.FilterBuilder 3.2
Orc.Metadata 3.2
System.ComponentModel.Annotations 4.6 or 4.7

@lock
Copy link

lock bot commented Jan 11, 2020

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Jan 11, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants