DynamoDS / DynamoRevit

Dynamo Libraries for Revit
https://dynamobim.org
334 stars 187 forks source link

output List<string> in Sandbox becomes List<List<string>> in Revit #1143

Open jhubers opened 8 years ago

jhubers commented 8 years ago

Dynamo version

1.0.0.1180

Revit version

Revit 2016 Build: 16.0.490.0 20150714_1515(x64)

Operating system

Windows 8.1

What did you do?

Custum UI node is programmed to give a List<string> output. It does in Sandbox, but with same dlls and same dyn file in Revit it outputs List<List<string>>

What did you expect to see?

Just a list of strings.

What did you see instead?

List of list of strings

ksobon commented 8 years ago

Speaking of weird behavior between the Sandbox and when Dynamo is running on top of Revit: I cannot for the love of god get it to execute a WebBrowser code from string while it works just fine in Sandbox.

kronz commented 8 years ago

@mjkkirschner @ke-yu any idea why a UI node would have different list nesting behavior in different environments?

@ksobon you mean Webrequest node isn't working in Revit?
2016-08-30_1903

mjkkirschner commented 8 years ago

@jhubers can you provide some sample code that replicates the issue?

mjkkirschner commented 8 years ago

@kronz a first guess is recent changes to lacing and different version of installed DynamoRevit vs built sandbox?

ksobon commented 8 years ago

Nah, @kronz I am talking about a WebBrowser control which I have been using to render HTML strings. It works just fine in Sandbox:

image

But exact same code will error out when launched from Dynamo inside of Revit:

image

...and yes, I am aware that the error message states that "file:///C:/Users/ksobon/AppData/Roaming/Dynamo/Dynamo%20Revit/1.1/packages/Archi-lab_Mandrill/extra/d3/d3.v3.min.js" which would be correct as "%20" is not allowed in a src string and instead should be a space. That's the most puzzling part since right clicking on the browser itself and inspecting the source code clearly shows that "%20" is actually a proper "space" and didn't have any issues with that string in Sandbox:

image

To make things even more interesting if I was to move the desired file to a location that would not have any spaces in its path (desktop), it will still result in an error. Any ideas?

ke-yu commented 8 years ago

@ksobon does it work if you move d3.v3.min.js to a folder without space? Just to make sure if space is the real problem.

ksobon commented 8 years ago

@ke-yu yes, I have tested moving the d3.v3.js to a location on my drive that didn't require spaces in its path - no luck. I have also tried referencing a d3 library directly from the github page but still no luck.

Again, this EXACT same code works just fine from Sandbox.

Ps. Just to make sure that I am not screwing up my encoding I am actually treating the string with string absolutCssFilePath = Uri.UnescapeDataString(uri.AbsoluteUri); // must remove %20 space encoding which should remove any %20 encoding strings.

ksobon commented 7 years ago

I figured out what was wrong here.

It seems that WebBrowser control by default has WebSecurity enabled which prevents websites from using local files (my d3.js library). I can instead use a Chrome based one like EO.WebBrowser and they offer an option to disable that.