API Call Error in Rhino

Hi All,
I’m writing a plugin in rhino8 with c#.
the problem is that i can’t communicate with my server through APIs.
I have tried restsharp and HttpClient.
it works outside of rhino but when i call it from my rhino plugin it comes with this error:
5827678727390219234
it was working fine with Rhino 8.1, but as soon as i updated it to 8.9 my plugin could not communicate with server, and I know that it has nothing to do with restsharp, because it was working with it before.

Hey @arc.feizbahr,

Is the restsharp library being copied locally alongside your Plugin.rhp?

Hi Callum,
thanks for the reply.
actually no, its not :roll_eyes:
but it was working without it before. :neutral_face:
how should I do that? I have my APIs and my rhino plugin in two separate projects, I have installed restsharp package on rhino plugin project but It still doesn’t work.

I find it a little odd that it worked in 8.1 and doesn’t in 8.9, and even more odd that restsharp isn’t alongside the plugin, how would the plugin find the library to reference it? I’d have expected the error you get above in 8.1 as well.

Regardless, my best guess is that RestSharp needs be alongside your Plugin.Rhp for it to work.
I created a blank plugin with some simple RestSharp calls and the default plugin does not copy RestSharp into the build folder, and I get the same error. I have to change my restsharp reference in my .csproj to

		<PackageReference Include="RestSharp" Version="111.4.0" IncludeAssets="compile;build;runtime" ExcludeAssets="analyzers" />

I also seem to have to add the below to a <PropertyGroup> in the same csproj

		<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

With restsharp.dll copying local everything runs smoothly for me :slight_smile:

Thanks Callum For Putting your time on this. actually It’s odd for me too.
I installed Restsharp on my Rhinoplugin proj to see if it works? but unfortunately I could not test it due to some server issues, I will test your solution ASAP, and let you know about the result.
thanks a lot.