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

Why is the project depending on a version of RestSharp.dll without a publicKeyToken? #28

Open
bounav opened this issue Sep 28, 2022 · 6 comments

Comments

@bounav
Copy link

bounav commented Sep 28, 2022

When docraptor is the only dependency in a project that uses RestSharp every works fine.

However if you happen have another dependency that also depends on RestSharp or if you wan to depend on a different version of Resharp a file load exception is thrown:

Inner Exception: FileLoadException

Inner Exception Message: Could not load file or assembly 'RestSharp, Version=105.2.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)


StackTrace:

   at DocRaptor.Client.Configuration.set_BasePath(String value)
   at DocRaptor.Client.Configuration..ctor()
   at DocRaptor.Client.Configuration..cctor()

From looking at DocRaptor.dll in dot peek I can see that the .DLL has a reference to RestSharp, Version=105.2.3, Culture=neutral, PublicKeyToken=null.

The problem is the PublicKeyToken=null part.

It should be PublicKeyToken=598062e77f915f75.

@jason-o-matic
Copy link
Contributor

Is there any chance you could provide a small example command line project that exhibits the issue? This would be a huge help debugging.

@bounav
Copy link
Author

bounav commented Oct 10, 2022

Is there any chance you could provide a small example command line project that exhibits the issue? This would be a huge help debugging.

Hi Jason, here is a repro CLI project as requested. You just need to clone it and hit F5 to trigger the issue.

@bounav
Copy link
Author

bounav commented May 22, 2023

Hey, is this project still actively maintained? Should it be archived if not?

@jason-o-matic
Copy link
Contributor

Sorry for the delay, and thanks for the example!

When I view that lib, under lib/net45/RestSharp.dll I see PublicKeyToken=null which matches what you're seeing.

I'm not super familiar with csharp, but is there a way for us to add the PublicKeyToken to the DLL after we've downloaded it, since the one we're downloading doesn't have it already?

I think another approach would be for us to switch from the openapi-generator for csharp to csharp-netcore. It seems csharp-netcore removes v4.5 from the targetFramework options, which gives me pause. Again, not being super familiar with csharp, how problematic might it be to drop support for v4.5?

@bounav
Copy link
Author

bounav commented Jul 17, 2023

No worries.

To fix the issue I raised, it should only be be a matter of updating the dependency to a more recent version of restsharp (and you'll automatically get a version of that DLL that has it's publicKeyToken set).
Then compile, then build and release and updated docarptor-csharp nuget package.

Re your suggestion to use openapi, yes, it would be much better in my opinion.

Is there a URL where a oas3.json document exists for doc raptor api?

If such a file exists, it should just be a matter of adding a service reference to the file as documented here.

@bounav
Copy link
Author

bounav commented Feb 19, 2024

Intesresting, I just spotted this paragraph in the repo's README.md

Don't let swagger downgrade RestSharp to 105.1.0; it will try.

Sounds like this issue was know by someone in the team... can you please update your Restsharp dependency!? Then is issue could be closed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants