View Issue Details

IDProjectCategoryView StatusLast Update
0001035NoesisGUIC# SDKpublic2019-01-28 16:30
Reporterai_enabledAssigned Tosfernandez 
PrioritynormalSeveritycrashReproducibilityalways
Status assignedResolutionopen 
Product Version1.3.0 
Target VersionFixed in Version 
Summary0001035: Crash when using x:Static for accessing value of public static field in C#
DescriptionHi guys,

consider this case:

    public static class LiquidColorsIcons
    {
        public static readonly Color ColorWater = Color.FromArgb(0xFF, 0x0C, 0x8A, 0xD3);
        ...
     }


And then:
<SolidColorBrush Color="{x:Static data:LiquidColorsIcons.ColorWater}" />

It works perfectly fine in WPF.
In 1.3.0 (2.0.0) release build it crashes with MemoryAccessViolation when I try to load that XAML file with GUI.LoadComponent() method.

Regards!
TagsNo tags attached.
PlatformAny

Relationships

related to 0001305 assignedjsantos Static members not properly supported 

Activities

sfernandez

sfernandez

2017-03-16 12:46

manager   ~0004529

We don't have support for static reflection yet, and x:Static only works for enums.

Is this feature very important for you, or could you use a ResourceDictionary with StaticResources instead?
ai_enabled

ai_enabled

2017-03-16 12:52

updater   ~0004530

Thanks for clarification, Sergio!
I thought you already might have implemented proper support for x:Static as it working fine for enums and because NoesisGUI simply crashes without any proper error message in that case...

Oh, it's not that important then. As workaround we are using ResourceDictionary and finding these resources from C#. But finding these resources from C# is done with string identifiers so it's not so reliable as x:Static.

It would be much better if you could quickly add proper error message. We could live without x:Static :-).
sfernandez

sfernandez

2017-03-16 13:22

manager   ~0004535

We will fix the crash and provide a correct error message.
jsantos

jsantos

2017-03-16 19:03

manager   ~0004537

Sergio, as far as I understand this should be "trivial" to implement if we implemented the x:Static markup entirely in C# right?
ai_enabled

ai_enabled

2019-01-24 18:16

updater   ~0005415

BTW would love to have this supported :-) . But as I understand it requires support for C# MarkupExtensions?
jsantos

jsantos

2019-01-28 16:30

manager   ~0005422

No, MarkupExtensions are not needed in C# for this but the solution is not trivial because we need to extend our reflection system to support static properties. This is something we must implement soon or later though. It's been requested many times.
ai_enabled

ai_enabled

2019-01-28 16:30

updater   ~0005423

Thanks!
Is there something I might help you with? If it's only on C# side I can take a look at what's missing to add support for this.

Issue History

Date Modified Username Field Change
2017-03-14 09:56 ai_enabled New Issue
2017-03-16 12:46 sfernandez Assigned To => sfernandez
2017-03-16 12:46 sfernandez Status new => feedback
2017-03-16 12:46 sfernandez Note Added: 0004529
2017-03-16 12:52 ai_enabled Note Added: 0004530
2017-03-16 12:52 ai_enabled Status feedback => assigned
2017-03-16 13:22 sfernandez Note Added: 0004535
2017-03-16 19:03 jsantos Note Added: 0004537
2018-11-01 02:14 jsantos View Status public => private
2018-11-22 18:01 sfernandez Relationship added related to 0001305
2018-11-22 18:01 sfernandez View Status private => public
2018-11-22 18:01 sfernandez Platform => Any
2019-01-24 18:16 ai_enabled Note Added: 0005415
2019-01-28 16:30 jsantos Note Added: 0005422
2019-01-28 16:30 ai_enabled Note Added: 0005423