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

Silent crash in CS console app #22274

Open
landogarner7 opened this issue Apr 24, 2024 · 10 comments
Open

Silent crash in CS console app #22274

landogarner7 opened this issue Apr 24, 2024 · 10 comments
Assignees

Comments

@landogarner7
Copy link

landogarner7 commented Apr 24, 2024

Operating System

Windows

Programming Languages

No response

CCXT Version

4.3.6

Description

I had created a C# WinForms testapp that has put Binance fetchMarkets and fetchOHLCV Information into a DB - nothing special. As I did not really require any UI I have moved the logic to a Windows Console App and found the very strange behaviour that both calls - fetchMarkets and fetchOHLCV - crash the app without any Exception, Error Message or anything.

The exchange was setup like this :

ccxtEx = new ccxt.Binance(); ccxtEx.apiKey = BINANCE_API_KEY; ccxtEx.secret = BINANCE_API_SECRET; ccxtEx.enableRateLimit = true; ccxtEx.options["paginate"] = true; ccxtEx.options["adjustForTimeDifference"] = true; ccxtEx.options["recvWindow"] = 60000; ccxtEx.verbose = true;

The function calls are simply

List<MarketInterface> markets = await exchange.FetchMarkets(); (inside a public virtual async Task<bool> function)
and
List<OHLCV> ohlcv = await exchange.FetchOHLCV(symbol, period, maxDButc); (inside a public virtual async Task<bool> function)

I can follow the debug in FetchMarkets() until below code in binance.cs :

It iterated until value3 = inverse, then exits the while AND binance.cs, closes the task and then the application.

Any idea what went wrong ?

Code

while (Exchange.isLessThan(a2, Exchange.getArrayLength(fetchMarkets)))
{
	object value3 = getValue(fetchMarkets, a2);
	if (Exchange.isTrue(Exchange.isEqual(value3, "spot")))
	{
		((IList<object>)obj).Add(publicGetExchangeInfo(parameters));
	}
	else if (Exchange.isTrue(Exchange.isEqual(value3, "linear")))
	{
		((IList<object>)obj).Add(fapiPublicGetExchangeInfo(parameters));
	}
	else if (Exchange.isTrue(Exchange.isEqual(value3, "inverse")))
	{
		((IList<object>)obj).Add(dapiPublicGetExchangeInfo(parameters));
	}
	else
	{
		if (!Exchange.isTrue(Exchange.isEqual(value3, "option")))
		{
			throw new ExchangeError(Exchange.add(Exchange.add(Exchange.add(base.id, " fetchMarkets() this.options fetchMarkets \""), value3), "\" is not a supported market type"));
		}
		((IList<object>)obj).Add(eapiPublicGetExchangeInfo(parameters));
	}
	Exchange.postFixIncrement(ref a2);
}
@carlosmiei
Copy link
Collaborator

Hello @landogarner7, yes that is very weird and I can't reproduce it locally but I'm not running windows/netframework.

Is it possible to post a small self-contained project that we can compile and run locally to see if we can emulate that behavior ?

@landogarner7
Copy link
Author

Hi Carlos, that was fast - thank you.
I might send you (rather than post) the full Visual Studio project if that is useful for you - but it is under Windows 10.

@ttodua
Copy link
Member

ttodua commented Apr 24, 2024

yes please send the project .zip if you can. thanks

@landogarner7
Copy link
Author

ccxt2DB.zip

@ttodua
Copy link
Member

ttodua commented Apr 25, 2024

i am not able to reproduce it.
I get Exception thrown: 'System.Data.SqlClient.SqlException' in System.Data.dll. have you tried to remove the logic of sql/database from demo project and just summarize only the code that would expose the bug (without need of sql/db manipulations)? it would help us to see the issue(if there is) right away

@landogarner7
Copy link
Author

I have eliminated all DB logic, please try again

ccxtSample.zip

@ttodua
Copy link
Member

ttodua commented Apr 25, 2024

I was able to reproduce the issue, thanks for the response.
I'll post an update soon

@landogarner7
Copy link
Author

It looks as if 4.3.8 does not solve the issue, will there be another update?

@carlosmiei
Copy link
Collaborator

@landogarner7 We weren't able to trace down the issue yet but as soon as we do we will link the PR to this issue so you can follow it

@landogarner7
Copy link
Author

No intention to push, take your time. Your assistance is highly appreciated, thank you !!

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

3 participants