A Scottish moose Posted September 5, 2017 Report Share Posted September 5, 2017 (edited) Hey everyone, I'm working on a midsize (Actor framework) project that has a main command message that gets used by all of my nested actors. This command messages payload is a typedef enum that defines what job gets done. As I've been developing the project I've been adding values to the enum and handling the resulting job in the 'send command.vi' message.... This works well because all of my nested actor messages that don't have a payload just send a constant enum to the controller to request a job... so I'm adding a new function to the said enum and after editing the typedef LabVIEW resets ALL constant instances of this typedef to default across my entire project. Every instance in memory of this enum gets set back to the zero value. I have everything backed up in SVN so this isn't a big deal from a time standpoint for me but I don't think this is intended behavior. Has anyone else seen this? TL/DR - I have a typedef enumeration and after adding a value to the end of the enum it resets ALL constant instances of this enum to value 0... ideas? Thanks, Tim Edited September 5, 2017 by A Scottish moose Quote Link to comment
PiDi Posted September 6, 2017 Report Share Posted September 6, 2017 That's just the way it is, move along (and remember to always check at least some of your enum instances after editing). In LV2014 they added this to help: http://zone.ni.com/reference/en-XX/help/371361L-01/lvhowto/manual_update_typedef/ My collegue claims that editing enum elements in Enum Properties window is better than editing in-place using ctrl+click on the control (i.e. value resetting doesn't happen so often) - but I'm not sure about that. Quote Link to comment
crossrulz Posted September 6, 2017 Report Share Posted September 6, 2017 If you are just adding to the end of the enum, I don't think the enum constants are supposed to reset. I have ran into issues when changing names and/or adding in the middle, but the Update Typedef tool is used to fix those. Now I have to go play around with this... Quote Link to comment
drjdpowell Posted September 6, 2017 Report Share Posted September 6, 2017 I don't seem to have this problem, but I always use "Edit Items..." and I'm careful to only make one change at once (rename one thing; or move one thing; don't ever rename and move). Quote Link to comment
A Scottish moose Posted September 6, 2017 Author Report Share Posted September 6, 2017 2 hours ago, crossrulz said: If you are just adding to the end of the enum, I don't think the enum constants are supposed to reset. I have ran into issues when changing names and/or adding in the middle, but the Update Typedef tool is used to fix those. Now I have to go play around with this... Exactly! This was my thought too, and the exact reason I add at the end of an enum if at all possible. Going to work on it some more today and see if I can figure out why. Quote Link to comment
hooovahh Posted September 6, 2017 Report Share Posted September 6, 2017 I've always added new items to the end. It does make organization look a little out of order but functionally I've never had a problem. The 2014 approval dialog does come up once in a while when I'm removing items, and seems to work well. Maybe you are removing, moving, and adding too many items at once and the attempt at preserving values fails. If you do one edit at a time I wonder if you'll see the problem. Quote Link to comment
infinitenothing Posted September 6, 2017 Report Share Posted September 6, 2017 I hate the silent mutation. I wrote this idea a while back: https://forums.ni.com/t5/LabVIEW-Idea-Exchange/Deleting-an-enum-element-from-a-type-def-should-cause-a-broken/idi-p/1763158 I'm curious what actions specifically default the value. What version are you using? 2014 helped but I know there's still some mutation going on with the case structures now. Quote Link to comment
LogMAN Posted September 6, 2017 Report Share Posted September 6, 2017 Do you use strict typedefs by any chance? I've had a similar issue a couple of years ago (using LV2011). It turned out that the reset was caused by using strict typedefs instead of regular ones. Changing from strict to regular typedefs solved the issue (after fixing the project one last time of course). Quote Link to comment
A Scottish moose Posted September 6, 2017 Author Report Share Posted September 6, 2017 (edited) Using 2016. Checked the strict Type Def idea, nope, using regular type def. Good idea though! I've tried to reproduce it a bit today but haven't had much luck. Yay for non-repeatable failures! Edited September 6, 2017 by A Scottish moose Quote Link to comment
LogMAN Posted September 8, 2017 Report Share Posted September 8, 2017 Have you tried clearing the compiled object cache? Here is a post that sounds exactly like the problem you've got: Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.