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

Allow for disabling automatic kit loading in Core #642

Closed
barisbs opened this issue Jul 26, 2021 · 7 comments
Closed

Allow for disabling automatic kit loading in Core #642

barisbs opened this issue Jul 26, 2021 · 7 comments
Assignees
Labels
core issues related to the .net sdk. enhancement New feature or request

Comments

@barisbs
Copy link

barisbs commented Jul 26, 2021

Hello everyone,

I have docker container of the speckle server running locally. For the test purposes, I had to install Revit connector also which installs converters and "Objects.dll" in the following path

%AppData%\Roaming\Speckle\Kits\Objects

There is another folder in same directory which contains also "Objects.dll"

AppData\Roaming\Speckle\Kits\Speckle.Objects

If I use .NET SDK in our .net core server, I get an System.IO.FileLoadException here

KitManager.cs line 169.

If I delete %AppData%\Roaming\Speckle\Kits\Objects, which is needed for Revit connector, it works.

Actually the assembly should be loaded from %AppData%\Roaming\Speckle\Kits\Speckle.Objects, but in the method, all assemblies in %AppData%\Roaming\Speckle\Kits folder and in its subfolders are loaded.

The assembly versions are different.

Is there a way to use both Revit connector and .NET SDK at the same time?

Cheers
Baris

@didimitrie
Copy link
Member

Actually the assembly should be loaded from %AppData%\Roaming\Speckle\Kits\Speckle.Objects

The place for kits is actually in the other folder, namely %AppData%\Roaming\Speckle\Kits\Objects! I think the error you're getting might be coming from you trying to load the same assembly, from two different origins, in the same app domain.

Do you have a direct reference to the Objects kit inside your .NET Core server project?

@barisbs
Copy link
Author

barisbs commented Jul 27, 2021

Hey Dimitrie,

Yes. As you said, we had a direct reference the Objects assembly, since we are using "Mesh" object. However, I have replaced the reference with nuget packages and the problem has been solved.

But I get NullReferenceException now, if I send objects from Speckle Revit connector and try to get commit in the subscription handler in our .net Core server.

Commit Info:
commit

Referenced object id of commit
image

Exception
nullReference

Client.Account is server:admin

The assembly versions of Objects in the nuget package and in Revit connector are different. The version %AppData%\Roaming\Speckle\Kits\Objects\Objects.dll is not same with the nuget package as well. Maybe that could be the reason?

EDIT: The problem occurs if we reference Speckle.Objects and Speckle.Core in same project. We would probably extract the display meshes by using dynamic objects to solve issue.

@didimitrie
Copy link
Member

It's quite difficult to debug locally two applications at the same time :/ Could you dig in the exception and show us a bit more where it happens? (e.g. callstack)

EDIT: The problem occurs if we reference Speckle.Objects and Speckle.Core in same project. We would probably extract the display meshes by using dynamic objects to solve issue.

This smells of dll hell, but not entirely sure. You could force the kit manager to initialise from a specific location during debugging, but unsure wether this would help.

We could schedule a quick 15 min call if you want so we can click in that exception and figure out if there's any way around this - let us know by email!

@didimitrie
Copy link
Member

closing as there's no new updates :)

@didimitrie
Copy link
Member

didimitrie commented Feb 4, 2022

Notes: this resurfaced again in the forum, and a solution/workaround is explained there: https://speckle.community/t/net-api-object-losing-its-viewmodel/2345/8

@didimitrie didimitrie changed the title Assembly load exception for "Objects.dll" if both Revit connector and docker image of the speckle server exists Allow for disabling automatic kit loading in Core Feb 7, 2022
@didimitrie didimitrie added enhancement New feature or request core issues related to the .net sdk. and removed question labels Feb 7, 2022
@didimitrie
Copy link
Member

As per the discussion in the forum, it would be great if we had a way to disable automatic kit loading in Core. This is useful in contexts where Objects.dll and/or other kits are referenced programatically (e.g., via nuget) and Core doesn't need to swoop in any potentially local kits.

@AlanRynne
Copy link
Member

Hey @barisbs! I'm closing this as stale but let us know if you still have this issue and we'll be happy to re-open it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core issues related to the .net sdk. enhancement New feature or request
Projects
Development

No branches or pull requests

5 participants