Skip to content

23.2.19

  • 23.2.19
  • 2be6785
  • Partially verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
  • Choose a tag to compare

  • 23.2.19
  • 2be6785
  • Choose a tag to compare

  • Partially verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature.
    We cannot verify signatures from co-authors, and some of the co-authors attributed to this commit require their commits to be signed.
@xackus xackus tagged this 26 Apr 19:25
<!-- Please be sure to read the
[Contribute](https://github.com/reactiveui/reactiveui#contribute)
section of the README -->

**What kind of change does this PR introduce?**
<!-- Bug fix, feature, docs update, ... -->

This PR fixes winforms designer serialization of `ViewModelControlHost`
and `RoutedControlHost` in `ReactiveUI.WinForms`.

**What is the current behavior?**
<!-- You can also link to an open issue here. -->

`DesignerSerializationVisibility.Content` causes multiple issues:
* `The object 'viewModelControlHost1' returned null for the property
'ViewModel' but this is not allowed` when trying to save (observed on
`net481`).
* Setting `DefaultContent` in the designer produces code that does not
compile (observed on `net10.0-windows10.0.19041.0`).

There are similar issues with other properties.

The attribute also makes no sense on `DefaultCacheViewsEnabled`, because
it's a static property.

**What is the new behavior?**
<!-- If this is a feature change -->

Just turn off serialization for non-primitive properties.
This also makes things consistent with `ReactiveUserControl.ViewModel`.

Drop the attribute on `DefaultCacheViewsEnabled`.

**What might this PR break?**

This shouldn't break anything, the serialization did not work.

**Please check if the PR fulfills these requirements**
- [ ] Tests for the changes have been added (for bug fixes / features)
- [ ] Docs have been added / updated (for bug fixes / features)

**Other information**:

Manual testing was performed on `net481` and
`net10.0-windows10.0.19041.0`.

`DesignerSerializationVisibility.Content` was introduced in #3933,
probably because of a new analyzer error (`WFO1000`).
Before that change the properties defaulted to
`DesignerSerializationVisibility.Visible`, but that did not make sense
either.
The only property that could actually be set in the designer was
`DefaultContent`, but doing that resulted in a fatal
`ObjectDisposedException` when trying to reopen the designer.

Co-authored-by: Chris Pulman <chris.pulman@yahoo.com>
Assets 2
Loading