GridLength Dependency Property causes crash
I have a custom user control class derived from UserControl, I have a few dependency properties on it, but when I put one on it of type GridLength it causes unity to crash. In the class below it's the ContentAreaHeight property. If I comment that property out it works fine, if it's left in unity crashes with the following error, any ideas what I'm doing wrong?
Stacktrace:
Stacktrace:
Code: Select all
at <unknown> <0xffffffff>
at (wrapper managed-to-native) Noesis.NoesisGUI_PINVOKE.PropertyMetadata_SetDefaultValueHelper (System.Runtime.InteropServices.HandleRef,System.Runtime.InteropServices.HandleRef) [0x0001a] in <0e94aecf1c604ccd87efabb6932e5069>:0
at Noesis.PropertyMetadata.SetDefaultValueHelper (object) [0x00000] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\API\Proxies\PropertyMetadata.cs:53
at Noesis.PropertyMetadata.set_DefaultValue (object) [0x00000] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\API\Proxies\PropertyMetadata.cs:36
at Noesis.PropertyMetadata..ctor (object) [0x00006] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\API\Proxies\PropertyMetadataExtend.cs:35
at Noesis.DependencyProperty.ValidateMetadata (string,System.Type,System.Type,Noesis.PropertyMetadata&) [0x0000a] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\API\Proxies\DependencyPropertyExtend.cs:129
at Noesis.DependencyProperty.RegisterCommon (string,System.Type,System.Type,Noesis.PropertyMetadata,Noesis.DependencyProperty) [0x00019] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\API\Proxies\DependencyPropertyExtend.cs:76
at Noesis.DependencyProperty.Register (string,System.Type,System.Type) [0x00000] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\API\Proxies\DependencyPropertyExtend.cs:13
at Stratheon.Client.UI.Common.PopupWindowUserControl..cctor () [0x00046] in D:\Projects\Stratheon\Git\Stratheon\Assets\Assemblies\Stratheon.Client\UI\Common\PopupWindowUserControl.cs:39
at (wrapper runtime-invoke) object.runtime_invoke_void (object,intptr,intptr,intptr) [0x0001f] in <695d1cc93cca45069c528c15c9fdd749>:0
at <unknown> <0xffffffff>
at (wrapper managed-to-native) System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor (intptr) [0x00007] in <695d1cc93cca45069c528c15c9fdd749>:0
at System.Runtime.CompilerServices.RuntimeHelpers.RunClassConstructor (System.RuntimeTypeHandle) [0x0002a] in <695d1cc93cca45069c528c15c9fdd749>:0
at Noesis.Extend.RunClassConstructor (System.Type) [0x0000d] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\API\Core\Extend.cs:1688
at Noesis.Extend.RegisterDependencyProperties (System.Type) [0x00037] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\API\Core\Extend.cs:1653
at Noesis.Extend.RegisterNativeType (System.Type,bool) [0x003e9] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\API\Core\Extend.cs:1345
at Noesis.Extend.RegisterNativeType (System.Type) [0x00000] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\API\Core\Extend.cs:1192
at Noesis.Extend.RegisterType (string) [0x00010] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\API\Core\Extend.cs:1788
at (wrapper native-to-managed) Noesis.Extend.RegisterType (intptr) [0x0002a] in <0e94aecf1c604ccd87efabb6932e5069>:0
at <unknown> <0xffffffff>
at (wrapper managed-to-native) Noesis.NoesisGUI_PINVOKE.ResourceDictionary_Source_set (System.Runtime.InteropServices.HandleRef,string) [0x0001b] in <0e94aecf1c604ccd87efabb6932e5069>:0
at Noesis.ResourceDictionary.set_Source (System.Uri) [0x00000] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\API\Proxies\ResourceDictionary.cs:315
at Noesis.GUI.LoadApplicationResources (string) [0x0000b] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\API\Core\NoesisGUI.cs:166
at NoesisUnity.SetApplicationResources () [0x0004a] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\NoesisUnity.cs:98
at NoesisUnity.Init () [0x0003d] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\NoesisUnity.cs:38
at NoesisXaml.Load () [0x00006] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\NoesisXaml.cs:16
at NoesisView.LoadXaml (bool) [0x00038] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\NoesisView.cs:465
at NoesisView.OnEnable () [0x0001d] in D:\Projects\Stratheon\Storage\ExternalLibraries\NoesisGUI-Unity-3.1.0-Indie\Runtime\NoesisView.cs:553
at (wrapper runtime-invoke) object.runtime_invoke_void__this__ (object,intptr,intptr,intptr) [0x00020] in <695d1cc93cca45069c528c15c9fdd749>:0
=================================================================
Got a SIGSEGV while executing native code. This usually indicates
a fatal error in the mono runtime or one of the native libraries
used by your application.
=================================================================
Code: Select all
public class PopupWindowUserControl : UserControl
{
public static Grid ContainerGrid;
bool _hasLoaded = false;
public static readonly DependencyProperty TitleProperty = DependencyProperty.Register("Title", typeof(string), typeof(PopupWindowUserControl));
public string Title
{
get { return (string)GetValue(TitleProperty); }
set { SetValue(TitleProperty, value); }
}
public static readonly DependencyProperty MinContentWidthProperty = DependencyProperty.Register("MinContentWidth", typeof(double), typeof(PopupWindowUserControl));
public double MinContentWidth
{
get { return (double)GetValue(MinContentWidthProperty); }
set { SetValue(MinContentWidthProperty, value); }
}
public static readonly DependencyProperty ContentAreaHeightProperty = DependencyProperty.Register("ContentAreaHeight", typeof(GridLength), typeof(PopupWindowUserControl));
public GridLength ContentAreaHeight
{
get { return (GridLength)GetValue(ContentAreaHeightProperty); }
set { SetValue(ContentAreaHeightProperty, value); }
}
public PopupWindowUserControl()
{
this.Initialized += PopupWindowUserControl_Initialized;
this.Loaded += PopupWindowUserControl_Loaded;
}
private void PopupWindowUserControl_Initialized(object sender, EventArgs e)
{
NoesisUtilities.LogDebug("PopupWindowUserControl Initialized");
}
private void PopupWindowUserControl_Loaded(object sender, RoutedEventArgs e)
{
NoesisUtilities.LogDebug("PopupWindowUserControl Loaded");
}
}
Re: GridLength Dependency Property causes crash
I should have included I'm using version 3.1.0.
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: GridLength Dependency Property causes crash
Thanks for reporting it, I was able to reproduce the crash and added the issue to our bugtracker: #2084
We will solve it as soon as possible.
In the meantime, would it be possible in your scenario to define the property as a simple float and let the binding system do the conversion?
We will solve it as soon as possible.
In the meantime, would it be possible in your scenario to define the property as a simple float and let the binding system do the conversion?
Re: GridLength Dependency Property causes crash
Thanks for the suggestion, for my purposes I'm trying to get the 1* style functionality out of it so a simple float won't do the trick without a bunch of extra stuff to set it properly.
-
sfernandez
Site Admin
- Posts: 2984
- Joined:
Re: GridLength Dependency Property causes crash
In that case you can use a string property as source. The following xaml allows the definition of a row height using a simple TextBox:
Code: Select all
<Grid
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<StackPanel HorizontalAlignment="Center" VerticalAlignment="Center">
<TextBox x:Name="txt" Text="1*" Width="200"/>
<Grid Height="400" Margin="0,10">
<Grid.RowDefinitions>
<RowDefinition Height="1*"/>
<RowDefinition Height="{Binding Text, ElementName=txt, FallbackValue=1*}"/>
<RowDefinition Height="1*"/>
</Grid.RowDefinitions>
<Rectangle Grid.Row="0" Fill="Red"/>
<Rectangle Grid.Row="1" Fill="Green"/>
<Rectangle Grid.Row="2" Fill="Blue"/>
</Grid>
</StackPanel>
</Grid>
Who is online
Users browsing this forum: Ahrefs [Bot], Bing [Bot] and 5 guests