2

I am using RestSharp for the first time, having installed it via NuGet.

Everything works wonderfully in my development environment. I have now created an installer for my software by means of an MVS installer project. When I use the installed version, RestSharp seems to throw an error. Specifically, I have narrowed it down to a client.execute command that is processing a RestRequest and returning a RestResponse. I determined this by printing to a textfile error log. The client.execute command stops execution of the function it's called from, which just returns.

A few more details:

  • RestSharp seems to be included by the installer - I see a dll in the right directory.
  • I have tried running the software with admin rights, in case this was the issue.
  • The installed software is, for the moment, running on the same computer where I did the development.
  • One thing I am wondering, is whether MVS installer projects properly handle nuget packages.

Any ideas?

4
  • 1
    Is an Exception occurring at that point, perhaps one that gets swallowed and ignored? If so, please provide error details. Commented Aug 24 at 9:50
  • When code is working are you using the Debug or Release version of code? Go into the bin folder of you project and check the dates to the executable in the Debug and Release folder. Try running both the Debug and Release versions of code by double clicking on the executable. Usually issues like this you were running the debug version of code in VS and it works but you never rebuilt the Release version. The installer is probably deploying the release version. Commented Aug 24 at 10:30
  • Hello jdweng, yes, the debug and release versions were both working. Thanks for the pointer, Peter B, it set me on the right path and I have figured it out. I'll post an answer. Commented Aug 24 at 11:02
  • Is async involved at some point? Please show the code that is calling the failing RestSharp method. Have you considered ditching RestSharp? IMO the framework's HttpClient from .net core has a more intuitive interface than RestSharp. Commented Aug 26 at 9:17

1 Answer 1

1

Thanks for your help, Peter B. I did not appreciate that, in this context, there would be a silent exception being raised. I wrapped the offensive line in a try-catch and printed the exception to a file.

Turns out, the error I was getting was:

Could not load file assembly 'System.Runtime.CompilserServices.Unsafe (...)' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference.

but this was only being raised in the installed code.

In turn, that can be resolved by updating all my NuGet packages. All good now.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.