add dispose method for generated enum wrapper class DYN-5506#13975
Merged
mjkkirschner merged 3 commits intoDynamoDS:masterfrom May 12, 2023
Merged
add dispose method for generated enum wrapper class DYN-5506#13975mjkkirschner merged 3 commits intoDynamoDS:masterfrom
mjkkirschner merged 3 commits intoDynamoDS:masterfrom
Conversation
Member
Author
|
the test failures appear to be more flukes that we have seen before with parallel tests. |
Comment on lines
157
to
162
| [Test] | ||
| public void DisposeMultipleDispoableObject() | ||
| { | ||
| string code = | ||
| @"import(""FFITarget.dll"");tracer1 = HiddenDisposeTracer();tracer2 = HiddenDisposeTracer();count1 = tracer1.DisposeCount;count2 = tracer2.DisposeCount;[Associative]{ disposer1a = tracer1.GetHiddenDisposer(); disposer1a = null; disposer1b = tracer1.GetHiddenDisposer(); disposer1b = null; disposer2a = tracer2.GetHiddenDisposer(); disposer2a = null; disposer2b = tracer2.GetHiddenDisposer(); disposer2b = null; disposer2c = tracer2.GetHiddenDisposer(); disposer2c = null;}__GC();d1 = tracer1.DisposeCount;d2 = tracer2.DisposeCount; | ||
| "; | ||
| thisTest.RunScriptSource(code); | ||
| thisTest.Verify("count1", 0); | ||
| thisTest.Verify("count2", 0); | ||
|
|
||
| thisTest.Verify("d1", 2); | ||
| thisTest.Verify("d2", 3); } //Migrate this code into the test framework private Subtree CreateSubTreeFromCode(Guid guid, string code) { var cbn = ProtoCore.Utils.ParserUtils.Parse(code); var subtree = null == cbn ? new Subtree(null, guid) : new Subtree(cbn.Body, guid); return subtree; } private void AssertValue(string varname, object value) { var mirror = astLiveRunner.InspectNodeValue(varname); MirrorData data = mirror.GetData(); object svValue = data.Data; if (value is double) { Assert.AreEqual((double)svValue, Convert.ToDouble(value)); } else if (value is int) { Assert.AreEqual(Convert.ToInt64(svValue), Convert.ToInt64(value)); } else if (value is bool) { Assert.AreEqual((bool)svValue, Convert.ToBoolean(value)); } } }} No newline at end of file | ||
| [Test] public void DisposeMultipleDispoableObject() { string code =@"import(""FFITarget.dll"");tracer1 = HiddenDisposeTracer();tracer2 = HiddenDisposeTracer();count1 = tracer1.DisposeCount;count2 = tracer2.DisposeCount;[Associative]{ disposer1a = tracer1.GetHiddenDisposer(); disposer1a = null; disposer1b = tracer1.GetHiddenDisposer(); disposer1b = null; disposer2a = tracer2.GetHiddenDisposer(); disposer2a = null; disposer2b = tracer2.GetHiddenDisposer(); disposer2b = null; disposer2c = tracer2.GetHiddenDisposer(); disposer2c = null;}__GC();d1 = tracer1.DisposeCount;d2 = tracer2.DisposeCount; | ||
| "; thisTest.RunScriptSource(code); thisTest.Verify("count1", 0); thisTest.Verify("count2", 0); thisTest.Verify("d1", 2); thisTest.Verify("d2", 3); } [Test] public void DisposeEnumWrapper() { string code = @"import(""FFITarget.dll"");x = Days.Monday; | ||
| __GC();x = Days.Monday; | ||
| __GC(); | ||
| x = Days.Monday; |
Contributor
There was a problem hiding this comment.
This diff is quite hard to read, I wonder if it's got to do with line endings or something?
Member
Author
There was a problem hiding this comment.
wow - I didn't realize it was that bad, let me take a look to see if I can improve it.
aparajit-pratap
approved these changes
May 10, 2023
Member
Author
|
I've made the diff worse ;) , but I think it will be better going forward as the line endings are now consistent for the entire file. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
https://jira.autodesk.com/browse/DYN-5506
@aparajit-pratap noticed an issue when creating and undoing creation of an enum backed ds object in dynamo in a codeblock.
I noticed that the generated wrapper class for each enum did not include a default dispose function which all generated type backed classes have - adding this removes the pointer to the enum wrapper from the
dsobjectmapandclrobjectmap- which avoids exceptions from being thrown when a clr object is first bound to a dswrapper.TODO
Declarations
Check these if you believe they are true
*.resxfilesRelease Notes
Fixes a bug where enum backed dsobjects are not disposed fully.
Reviewers