Skip to content

Embedding Microsoft.Xaml.Behaviors in iNKCORE.UI.WPF causes CS0433 and WPF issues #444

Description

@frogcrush

Describe the bug

I have a solution with two projects:

App.Client
App.ResponsiveBehavior

Both projects import Microsoft.Xaml.Behaviors.Wpf v1.1.142. The Client project imports iNKORE.UI.WPF.Modern 0.10.2.1.

When trying to use a custom behavior from App.ResponsiveBehavior, the following exception is thrown:

System.ArgumentException: 'Cannot add instance of type 'ResponsiveContentBehavior' to a collection of type 'BehaviorCollection'. Only items of type 'T' are allowed.'

When diagnosing, I tried to determine the mismatch based on this code:

        System.Diagnostics.Debug.WriteLine("Behavior<> from: " + typeof(Microsoft.Xaml.Behaviors.Behavior<>).Assembly.Location);
        System.Diagnostics.Debug.WriteLine("ResponsiveContentBehavior base from: " + typeof(ResponsiveContentBehavior).BaseType!.Assembly.Location);

But I get an error:

Image

Reproduction

Add Microsoft.Xaml.Behaviors.Wpf to a project and the CS0433 error will appear.

Suggested Solution

Could be fixed by referencing the official NuGet package instead of supplying it in source.

Library Version

0.10.2.1

Operating System

Windows 11

Framework

.NET Core and .NET

Framework Version

10

Source of Package

NuGet.org (Package)

Additional Notes

No response

Validations

  • Check that there isn't already an issue that reports the same or similar problem.
  • Check that this is a bug in the library that should be fixed, not a feature, also this is not about the documentation. (Or please choose the right repo and template.)
  • This is one single problem, or a few problems with the same cause. (If you want to report multiple problems, please create one issue for every single problem.)
  • You've checked that this problem still exists in the latest version. (Keep in mind that we don't provide any support for old versions.)
  • Your issue, including the title and description, is written in English (United States), and there's no use of any other language in the issue. Using other languages, including Chinese, is NOT welcome and will get your issue closed or deleted. (您的问题 (包括标题和描述) 均使用英文 (美国) 撰写,不使用任何其他语言。使用其他语言 (包括中文) 是不允许的,您的问题将被关闭或删除。)
  • You know that we can't guarantee that we will satisfy your request. This is not really our duty to do everything anyone asks for. Also, you will treat our staff, contributors, and other users with respect and kindness.
  • You're sure there's something wrong with the library itself, not how you're using it. (If you are having issues using it and need help, please go to discussion.)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions