dotnet / dotnet/wpf

Remote Deskop Disconnect/Reconnect Issues

Open
#6,739 21 comments 6 reactions 1 assignee Claimed by @dipeshmsft View on GitHub
Investigate
Dominant language
C#
Stars
7.7k
Forks
1.3k
Avg merge
1d 11h
Merged PRs (30d)
61

Description

* Windows version: Windows10
* Does the bug reproduce also in WPF for .NET Framework 4.8?: Yes
* Is this bug related specifically to tooling in Visual Studio (e.g. XAML Designer, Code editing, etc...)? No

**Problem description:**

Not sure if question/defect.

I've done alot of googling found some responses, but nothing that ultimately helps.

When reconnecting to a remote desktop session we are seeing the following.

* Controls being unloaded then reloaded
* Controls within DataTemplates being completed re-created

Is there anyway to prevent this from happening ?

We have ported a very large Silverlight application to WPF and this is biting us pretty hard.

In some cases we been able to refactor some logic to reduce the number of usages of loaded/unloaded events.

But we also have alot of Behaviors, Converters, etc breaking within a DataTemplate.

We making very slow progress here, and hoping to find a more of a global solution to prevent this from occurring.

If you can please assist.

Many thanks

**Minimal repro:**

With the below reconnect to disconnected remote desktop session.

Notice the Unloaded then Loaded callback hits.
Notice the hashcode for the TextBlock has changed.

```xml







Test

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.