-
Notifications
You must be signed in to change notification settings - Fork 16
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 in UWP app #59
Comments
Stacktrace of the error (only happens in release mode) System.NullReferenceException: Arg_NullReferenceException |
The error seems to disappear if I uncheck Project properties -> Build -> Optimize code |
What version of Visual Studio are you using? Are you using the correct UWP XAML Behaviors (the one from this NuGet)? |
Visual Studio 2017. In my project.lock.json there is "Cimbalino.Toolkit/2.4.1": { Only Cimbalino.Toolkit is referenced directly in the project References |
Please try to manually add the |
Manually adding Microsoft.Xaml.Behaviors.Uwp.Managed package does not make any difference. If "Compile with .NET Native tool chain" and "Optimize code" are checked, I get this error. Unchecking those is a workaround. |
Please ensure you add Cimbalino.Toolkit to all your projects that actually require it, it should then pick the correct assembly according to the platform! |
How come it is not available? I've been using it for quite some time. What should I use instead? For example, this article says it's available: http://www.damirscorner.com/blog/posts/20160221-MultibindingInUniversalWindowsApps.html |
Sorry, though I wrote I now start to remember this better, and you are correct when you say that this issue goes away when disabling .NET Native: the problem is that this behavior relies heavily on reflection and as such, can have .NET Native problems. I need to research this further, but I'd advise in using compiled bindings (x:bind) function support as an alternative! |
@dmitry-lt can you share the XAML bit you have with this |
<Image VerticalAlignment="Top" HorizontalAlignment="Center" Margin="0 5 0 5" Width="50" Height="50">
<interactivity:Interaction.Behaviors>
<behaviors:MultiBindingBehavior Converter="{StaticResource IconConverter}" PropertyName="Source">
<behaviors:MultiBindingItem Value="{Binding Item}" />
<behaviors:MultiBindingItem Value="{Binding Item.Enabled}" />
<behaviors:MultiBindingItem Value="{Binding Item.Status}" />
<behaviors:MultiBindingItem Value="{Binding Item.Type}" />
</behaviors:MultiBindingBehavior>
</interactivity:Interaction.Behaviors>
</Image> |
Ok, the solution will be to add a runtime exception so that we can use reflection over On the solution explorer, there's a Properties node in the UWP project for your app - expand it! Inside you should find a Default.rd.xml file. Find where it says "" and add the following line below it: <Type Name="Windows.UI.Xaml.Controls.Image" Dynamic="Required All" Serialize="Require All" /> Rebuild the app with the "Compile with .NET Native tool chain" and "Optimize code" checked, and check again! |
Hmm. There is no Default.rd.xml in my project. Anyway, I have already changed my code to not use MultiBindingBehavior (and handle it in view model instead). |
Installing 'Microsoft.Xaml.Behaviors.Uwp.Managed' v2.0.0 manually (instead of v1.1.0) did not help. Using the v2.5.0 version of the toolkit, on a UWP project |
Windows 10 UWP app, submitted to the store, produces an error:
Cannot add instance of type 'Cimbalino.Toolkit.Behaviors.MultiBindingBehavior' to a collection of type 'Microsoft.Xaml.Interactivity.BehaviorCollection'.
On dev machine (in debug mode) everything works fine.
Lib version 2.4.1
The text was updated successfully, but these errors were encountered: