This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

MFiles.VAF.Extensions.ConfigurableVaultApplicationBase not restoring bool = false in confguration

When using public class VaultApplication:MFiles.VAF.Extensions.ConfigurableVaultApplicationBase<Configuration> it seems to not be restoring false bool values from the json configuraiton file but for some reason the "Yes" value is saved and restored. Also, it works perfectly with public class VaultApplication:ConfigurableVaultApplicationBase<Configuration>.

, am I missing something when using MFiles.VAF.Extensions.ConfigurableVaultApplicationBase?

Saved this using :MFiles.VAF.Extensions.ConfigurableVaultApplicationBase :

Restarted vault and refreshed everything and now get this:

Source code:

VaultApplication.cs

using MFiles.VAF;
using MFiles.VAF.AppTasks;
using MFiles.VAF.Common;
using MFiles.VAF.Configuration;
using MFiles.VAF.Core;
using MFilesAPI;
using System;
using System.Diagnostics;

namespace BoolNotSavingInConfig
{
/// <summary>
/// The entry point for this Vault Application Framework application.
/// </summary>
/// <remarks>Examples and further information available on the developer portal: http://developer.m-files.com/. </remarks>
public class VaultApplication
//: ConfigurableVaultApplicationBase<Configuration>
: MFiles.VAF.Extensions.ConfigurableVaultApplicationBase<Configuration>
{
}
}

Configuration.cs

using MFiles.VAF.Configuration;
using MFiles.VAF.Configuration.JsonAdaptor;
using System;
using System.Collections.Generic;
using System.Runtime.Serialization;

namespace BoolNotSavingInConfig
{
[DataContract]
public class Configuration
{
[DataMember]
public bool bool1 { get; set; }

[DataMember]
public bool bool2 { get; set; }
}
}

Using MFiles.VAF.Extensions 23.1.49

Any ideas as to what is going on?

Parents
  • I am really torn on the configuration upgrading functionality and using it by default. I still think that's the right thing to do, but it has caused some oddities that I continue to have to try to explain. 

    Are you coming to Cancun for the global partner conference, Scott? I'm hoping to spend some time with partners face-to-face to discuss various things, including this. 

Reply
  • I am really torn on the configuration upgrading functionality and using it by default. I still think that's the right thing to do, but it has caused some oddities that I continue to have to try to explain. 

    Are you coming to Cancun for the global partner conference, Scott? I'm hoping to spend some time with partners face-to-face to discuss various things, including this. 

Children
  • Unfortunately, I am not attending the global partner conference. 

    I am using the bool to show/hide (ShowWhen) configuration items, so this behavior really messes with a clean configuration layout. Defaulting to false/no does not fill in the configuration item to trigger the show/hide behavior. Any way to force an actual value into the configuration item?

    Show the "New Workflow State" config item when bool1=No

    Restart and New Workflow State" is hidden.

    Any workarounds?

  • Yes, in this scenario you can use the [AllowDefaultValueSerialization] attribute. Add it above the boolean, alongside the data member one.