''Exception of type 'System.StackOverflowException' was thrown.' after placing GMapControl

I have been trying to incorporate a map in my Windows Forms App but can't due to the StackOverflowException. I tried by myself for a while but can't seem to figure it out.

The app greets you with a login form and a button where you can go and make an account for yourself. This all goes well until you actually log in and the form which has the GMapControl is opened.

When it is it shows the map briefly shows the form with no map just before hiding and showing the exception.

 public async void GetUserLatLong(string ip)
        {
            var client = new HttpClient();
            var tokenRequest = "";
            var Api = new IpInfoApi(tokenRequest, client);

            var response = await Api.GetCurrentInformationAsync();

            var location = response.Loc.Split(',');
            double longitude = double.Parse(location[0]);
            double latitude = double.Parse(location[1]);

            gMapControl1.MapProvider = GMapProviders.OpenStreetMap;
            gMapControl1.Position = new PointLatLng(longitude, latitude);
        }
        private void Login_Load(object sender, EventArgs e)
        {
            gMapControl1 = new GMapControl();
            GetUserCountryByIp(Program.address);
            
        }

For those wondering the tokenRequest is there I just removed in here and I also have the packages I needed. Also the app is just a school project so don't take the whole ip part seriously



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source