dotnet / dotnet/winforms

MyApplication_Startup is not on UI Thread

Open
#4,179 16 comments 0 reactions 1 assignee Claimed by @KlausLoeffelmann View on GitHub
:books: documentation area-VisualBasic
Dominant language
C#
Stars
4.9k
Forks
1.1k
Avg merge
20h 23m
Merged PRs (30d)
103

Description

* .NET Core Version:

* Have you experienced this same bug with .NET Framework?:
No

**Problem description:**
Runtime error
System.InvalidOperationException: 'Cross-thread operation not valid: Control 'UserName' accessed from a thread other than the thread it was created on.'

**Expected behavior:**
MyApplication_Startup is on UI Thread as it is on Framework

**Minimal repro:**
```VB
Private Sub MyApplication_Startup(sender As Object, e As StartupEventArgs) Handles Me.Startup
' Get the splash screen.
CType(Me.SplashScreen, SplashScreen1).UserName.Text = "Current user: " & User.Name
End Sub
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.