I'm trying to develop my application extension and part of it has a variable that I want to tell if the user has an internet connection or not. I've set it up to where it's read only, but I'm trying something new and it threw a StackOverflowException. Hopefully someone can explain why and how to fix it?
[DllImport("wininet.dll")]
private extern static bool InternetGetConnectedState(out int desc, int reserved);
public bool InternetConnection
{
get
{
return InternetConnection;
}
private set
{
InternetConnection = false;
int desc = 0;
if (InternetGetConnectedState(out desc, 0))
{
InternetConnection = true;
}
}
}
I have no knowledge of Stack Overflow Exceptions, I don't know what causes them, how to fix them, or anything else of that nature.