mcneel / rhino.inside

Sample Projects for Rhino.Inside
MIT License
379 stars 169 forks source link

New implementation for TopSolid #253

Open Tamu opened 4 years ago

Tamu commented 4 years ago

We want to create an implementation for TopSolid

How can we get help or submit questions !?

What we have already tried

  1. Plugin creation for TopSolid : RhinoInsideTopSolid.AddIn
  2. Add Nuget Package Rhino.Inside version 0.2.0
  3. To try to correct the loading problem : Copy RhinoCommon.dll in TopSolid application
  4. As soon as TopSolid start, the DLLs cannot be initialized with the command RhinoInside.Resolver.Initialize();

However I cannot load Rhino DLLs.

error-load-topsolid
sbaer commented 4 years ago

You definitely don't want to have a copy of RhinoCommon copied locally into the TopSolid application directory. My guess is that the RhinoInside.dll is failing to find the Rhino WIP directory on your computer. I would recommend adding the RhinoInside Resolver code directly to your project and debug to figure out why RhinoCommon can't be found

https://github.com/mcneel/rhino.inside/blob/master/DotNet/RhinoInside/Resolver.cs

It would be great to know what you discover so we can update the Rhino.Inside project itself to just work.

Tamu commented 4 years ago

Thanks for your feebdack. Unfortunately, Rhino Inside.dll cannot find the directory ! I will test with Resolver.cs and I will give you more information.

regeew commented 4 years ago

Hi Steve, I work with Thomas at EPFL on this implementation test. The reason we tried with RhinoCommon Copy Local = True is because of the way TopSolid starts a session. In its StartSession method, TopSolid looks for the project references (in his directory) and tries to load them all. So without RhinoCommon in Topsolid directory (or with the NuGet) we are facing that crash on start :

Failed to load the following add-in: D:\Sources\SupAds\ServicePack8\bin\Debug x64\EPFL.RhinoInsideTopSolid.AddIn.dll

System.IO.FileLoadException: Could not load file or assembly 'RhinoCommon, Version=7.0.19302.12520, Culture=neutral, PublicKeyToken=552281e97c755530' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)

File name: 'RhinoCommon, Version=7.0.19302.12520, Culture=neutral, PublicKeyToken=552281e97c755530'

   at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)

   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)

   at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)

   at System.Reflection.Assembly.ReflectionOnlyLoad(String assemblyString)

   at TopSolid.Kernel.SX.Reflection.Assembly.SearchOrLoadTopSolidAssembly(AssemblyName inAssemblyName) in D:\Sources\TopSolid v7.13\ServicePack8\Kernel\SX\Reflection\Assembly.cs:line 292

   at TopSolid.Kernel.SX.Reflection.Assembly.Scan(Assembly inAssembly) in D:\Sources\TopSolid v7.13\ServicePack8\Kernel\SX\Reflection\Assembly.cs:line 199

   at TopSolid.Kernel.SX.SessionManager.Start(Type inSessionType) in D:\Sources\TopSolid v7.13\ServicePack8\Kernel\SX\SessionManager.cs:line 366

   at EPFL.RhinoInsideTopSolid.AddIn.AddIn.StartSession() in D:\Sources\SupAds\EPFL\rhinoinsidetopsolid.addin\EPFL.Rhino.Inside.Addin\AddIn.cs:line 74

   at TopSolid.Kernel.TX.AddIns.AddInStore.Load(Byte[] inDll, String inDllName, AddInBeforeCallback inBeforeCallback, AddInAfterCallback inAfterCallback) in D:\Sources\TopSolid v7.13\ServicePack8\Kernel\TX\AddIns\AddInStore.cs:line 689

Since it looks like a "similar" issue as on Unity, I just tried following this sample :

https://github.com/mcneel/rhino.inside/blob/master/Unity/Sample2/Assets/RhinoInside.cs

Result is:

First a message about Rhino's license manager failing to initialize (error -200):

licencing

Then this error about Microsoft.WindowsAPICodePack.Shell

System.IO.FileLoadException
  HResult=0x80131040
  Message=Impossible de charger le fichier ou l'assembly 'Microsoft.WindowsAPICodePack.Shell, Version=1.1.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' ou une de ses dépendances. La définition trouvée du manifeste de l'assembly ne correspond pas à la référence de l'assembly. (Exception de HRESULT : 0x80131040)
  Source=RhinoCommon
  Arborescence des appels de procédure :
   at Rhino.Runtime.InProcess.RhinoCore.InternalStartup(Int32 argc, String[] argv, StartupInfo& info, IntPtr hostWnd)
   at Rhino.Runtime.InProcess.RhinoCore..ctor(String[] args, WindowStyle windowStyle, IntPtr hostWnd)
   at RhinoInside.Launch() in C:\Sources\EPFL.Rhino.Inside.Addin\EPFL.Rhino.Inside.UI\RhinoInside.cs:line 25
   at EPFL.RhinoInsideTopSolid.UI.Test.TestCommand.Invoke() in C:\Sources\EPFL.Rhino.Inside.Addin\EPFL.Rhino.Inside.UI\Test\TestCommand.cs:line 58
   at TopSolid.Kernel.WX.Commands.MenuCommand.DoInvoke() in D:\Sources\TopSolid v7.13\ServicePack8\Kernel\WX\Commands\MenuCommand.cs:line 1068
   at TopSolid.Kernel.WX.ToolStrips.ToolStripButton.OnClick(EventArgs e) in D:\Sources\TopSolid v7.13\ServicePack8\Kernel\WX\ToolStrips\ToolStripButton.cs:line 210
   at System.Windows.Forms.ToolStripItem.HandleClick(EventArgs e)
   at System.Windows.Forms.ToolStripItem.HandleMouseUp(MouseEventArgs e)
   at System.Windows.Forms.ToolStrip.OnMouseUp(MouseEventArgs mea)
   at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
   at System.Windows.Forms.Control.WndProc(Message& m)
   at System.Windows.Forms.ToolStrip.WndProc(Message& m)
   at TopSolid.Kernel.WX.ToolStrips.ToolStrip.WndProc(Message& m) in D:\Sources\TopSolid v7.13\ServicePack8\Kernel\WX\ToolStrips\ToolStrip.cs:line 900
   at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Do you have any idea how we can move forward ?

Thank you, Régis