Its a brand new winforms project - I have one set up and .net 6 and another with .net framework 4.8 just to see if it made a difference. I have been trying to mirror the process you went through in one of your youtube videos - a button and a datagridview. I found out I needed to be on V1 which brought me to this thread to see how to toggle it. I believe everything is updated to their newest versions - I installed RestSharp, Newtonsoft.Json, EpicorRestAPI (for4.8 and epicorRestAPICore for 6), just check on System.text.json. I did notice it doesnt matter what Im putting in for the server and the instance I get the same hangup - could it just be that I have those wrong?
If you have a GUI deadlock then it doesnāt matter if the request is successful or failure. It canāt get back to the GUI thread. Please try using the new Async
methods I created to solve this problem. Before the new async methods existed you would have needed to write your own threading wrappers around this project to avoid deadlock.
Working to figure out how to use them right now haha. I havent done anything with async or Tasks before.
So it did not hangup but I received a null DataTable
COuld be can you run something simpler⦠like a BaqGet instead? This one makes a āfancyā table but has a lot of other requirements so try the BaqGet method first and see if that one returns anything?
response = EpicorRest.BaqGet("zCustomer01");
It locked when running regular method. When I ran async I got the following inner exception when drilling into response: The remote certificate is invalid because of errors in the certificate chain: UntrustedRoot
Ah you need to set IgnoreCertificateErrors = true;
I got the same thing after adding that in.
Hmm that doesnāt make senseā¦ā¦ can you post your code?
This hangs up:
private void button1_Click(object sender, EventArgs e)
{
EpicorRest.APIVersion = EpicorRestVersion.V1;
EpicorRest.AppPoolHost = "serv";
EpicorRest.AppPoolInstance = "instance";
EpicorRest.UserName = "user";
EpicorRest.Password = "pass";
EpicorRest.IgnoreCertErrors = true;
string baqID = "DBBTO";
var response = EpicorRest.BaqGet(baqID);
}
This I can see error when step over response:
private async void button1_Click(object sender, EventArgs e)
{
EpicorRest.APIVersion = EpicorRestVersion.V1;
EpicorRest.AppPoolHost = "serv";
EpicorRest.AppPoolInstance = "instance";
EpicorRest.UserName = "user";
EpicorRest.Password = "pass";
EpicorRest.IgnoreCertErrors = true;
string baqID = "DBBTO";
await SetBaqDataTableModelAsync(baqID);
}
internal async Task SetBaqDataTableModelAsync(string baqId)
{
var response = await EpicorRest.BaqGetAsync(baqId);
}
Using the URL it generates when stepping over does take me to results.
Iām guessing they changed the way certa are handled in 4.8 or new restsharp Iāll take a look
Found several references to this problem doing a Google search. Not sure if that rabbit hole has been explored�
They did. Looks like everything needs to be handled in a RestClientOptions
object as seen here: RemoteCertificateValidationCallback does not seem to work on v107 Ā· Issue #1884 Ā· restsharp/RestSharp Ā· GitHub
There are many breaking changes in the latest version detailed here: RestSharp Next (v107+) | RestSharp
We might need to pass down some breaking changes of our own in this library to update everything to work correctly with the latest tools.
Got ya , looks like a breaking change in our last updated.
If you get Nuget Version <= 2.0.4 that one should have the old version of RestSharp and should work.
I went ahead and patched and published a new version 2.1.0.3 that addresses the certificate issues and also added a timeout parameter as an option on the configuration.
Weāll have to make more changes on the next RestSharp release but this should get back the functionality we lost with the updates.
Let me know if this one works @rpeters
I have added the timeout property now @Massimo_Garavaglia
Thanks for all the help! The async methods seem to work perfectly, was able to run BaqGetDataTableAsync() and get a filled datatable. The regular methods froze up still. Now I can get going on replacing using epicor dlls to call BAQs Next up replacing calling powershell + DMT to write
Hey Jose, I just installed the library for the first time, looks neat! Unfortunately unusable at the moment as methods hang, but cool nonetheless!
Any chance you might eventually include support for classic (non-OData) custom method calls? Not every endpoint has working OData methods (for example, Erp.PROC.ProjectAnalSvc only has classic methods available)ā¦
It might already be supported, I havenāt been able to test it due to the restsharp issueā¦
It supports all the non standard methods, and it only hangs if you call it without async. Use the aysnc methods. You can also use this version which is before the async methods were added
It already supports all the end points.
Hmmm, this hangs as well here (this is in a winforms app on .NET 6.0):
...
EpicorRest.APIVersion = EpicorRestVersion.V2;
EpicorRest.License = EpicorLicenseType.Default;
EpicorRest.IgnoreCertErrors = true;
EpicorRest.Timeout = 5000;
if (EpicorRest.CreateBearerToken())
{
var response = EpicorRest.BoPostAsync("Erp.PROC.ProjectAnalSvc", "GetNewParameters").GetAwaiter().GetResult();
var data = response.Response;
}
Use like
var res = async call();
If (res)
Xyz
Otherwise use the version I sent above that doesnāt have async.