AdobeDocs / adobe-dev-console

Apache License 2.0
21 stars 125 forks source link

.NET sample code needs updated to support the new version of the RestSharp open source library #50

Closed Trazzmonger closed 6 months ago

Trazzmonger commented 1 year ago

Expected Behaviour

Code should compile and run

Actual Behaviour

The current sample code generates three errors:

  1. “Argument 1:cannot convert from ‘RestSharp.Method’ to ‘string?’” <- syntax error reported for line 52 of Program.cs (where it says "var request = new RestRequest(Method.POST);").

  2. "The type or namespace ‘IRestResponse’ could not be found (are you missing a using directive or an assembly reference?)” <-- syntax error reported for line 62 of Program.cs (where it says "“IRestResponse response = client.Execute(request);”").

  3. "An error has occured: The format of value 'multipart/form-data; boundary=----boundary' is invalid" <-- runtime error generated seemingly for the parameter added via line 55 (via a request.AddParameter() method call).

Reproduce Scenario (including but not limited to)

Simply try to compile and run.

Steps to Reproduce

For the first two errors, simply try to compile. For the third error, you'd need to tweak the code (as a workaround to get it to compile) ... but then run the program.

Platform and Version

Windows 10 running Microsoft Visual Studio 2019.

Sample Code that illustrates the problem

Current code leveraging the latest version of the RestSharp library (i.e., v108.0.2).

NOTE: All three of these issues can be resolved by instead leveraging the old 106.13.0 version of the RestSharp library; however, for vulnerability reduction reasons, we need to be using the latest version of all such open source libraries. Additional information can be found at the RestSharp documentation page (https://restsharp.dev/intro.html#introduction) which says, "WARNING - RestSharp v107 changes the library API surface and its behaviour significantly. We advise looking at v107 docs to understand how to migrate to the latest version of RestSharp.".

Logs taken while reproducing problem

n/a

theManikJindal commented 6 months ago

Hello, seems like this issue relates to sample code provided for the deprecated Service Account (JWT) credentials. We are no longer enhancing the documentation surrounding the deprecated credentials.