I recently experienced a wierd behavior of a old VB.NET WinForm code. The code is working well and produce a correct design of my forms. I added a function to call an API. I added a new reference with my proxies to the code.
If ApiHelper.Login(Username, Password) Then
Application.Run(myForm)
End If
Here is my API helper class:
Public Class ApiHelper
Public Shared Function Login(username As String, password As String) As Boolean
DataProxies.SetToken()
Dim _authService As IAuthenticationService = New AuthenticationService()
Dim auth As Tuple(Of Boolean, User) = _authService.Login(username, password).Result
If (auth.Item1) Then
Dim user As User = auth.Item2
Name = $"{user.FirstName} {user.LastName}"
ApiInformations.ApiToken = user.SessionToken
End If
Return True
End Function
End Class
When I run myForm all my fonts are modified. some become bigger, some seems smaller. But this is maybe an effect of resolution change of my main form.
This is wierd because before using the API to login or id I simply bypass the login like this
'If ApiHelper.Login(Username, Password) Then
Application.Run(myForm)
'End If
I get a perfect result with all correct size on my form.
How a code that use nothing related to design and form (but async await) can affect the designer of my form?
Also my settings are