Skip to content
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

Freshly compiled DsmViewer does not load model that contains actions. #30

Open
ernstaii opened this issue Jun 11, 2024 · 0 comments · May be fixed by #34
Open

Freshly compiled DsmViewer does not load model that contains actions. #30

ernstaii opened this issue Jun 11, 2024 · 0 comments · May be fixed by #34

Comments

@ernstaii
Copy link

When I compile the viewer and then use the compiled program to load a model that contains actions, an exception occurs. This is due to the ActionStore.LoadFromModel lines

object[] args = { _model, _actionManager.GetContext(), action.Data };
IAction instance = Activator.CreateInstance(type, args) as IAction;

The activator cannot find a constructor that takes 3 arguments, because (e.g.) ElementSortAction has a constructor that takes a single argument, an object array.
Many tests pertaining to actions also fail.
Now, the funny thing is that the compiled program from the website DOES load such a model. I can only assume this due to a change in the way the .net framework library works, possibly a bugfix, since according to the C# specification such a constructor(object[]) should indeed not match.

Assuming you are interested in a fix for this (otherwise I'll just fix it in my own fork), what would you prefer?

  1. Remove the array constructors and replace them by explicit arguments, possibly with optional arguments. Seems to be the cleanest, but may lose compatibility with older library versions.
  2. Have two constructors, array and explicit arguments. Compatibility with different CLRs, but also more code to maintain.
  3. Change the LoadModel code to wrap the object array in another object array so there is again a single object[] argument. More a hack than a fix, IMHO, unless there are constructors that really depend on a variable number of arguments.
@ernstaii ernstaii linked a pull request Jul 22, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant