Disposing View Models - FULL STACK WPF (.NET CORE) MVVM #31

  Рет қаралды 4,444

SingletonSean

SingletonSean

Күн бұрын

Пікірлер: 17
@janhendrikschreier
@janhendrikschreier 4 жыл бұрын
Hi Sean, as to your question of never hitting the destructor I do not have a definite answer, but I think it has to do with the GC not being too aggressive in Debug-Mode. So in Release-Mode it should be collected. I haven't had the time/pressure to validate this, but if need be, I would put some logging in the destructor to see if it gets hit in release-Mode. maybe this helps
@SingletonSean
@SingletonSean 4 жыл бұрын
That is a great point Jan! Throughout my career I've run into tons of differences between debug and release mode, so this could definitely be one of them. I'm excited to try this out. Thanks!
@ivandrofly
@ivandrofly Жыл бұрын
@@SingletonSean Hello Sean have you tested this theory of switching to release to hit the IDisposable.Dispose?
@ivandrofly
@ivandrofly Жыл бұрын
15:05 - IDisposable Issue
@rosscarlson3701
@rosscarlson3701 3 жыл бұрын
As opposed to the technique you describe at 8:30 for setting CanDispose, why not set CanDispose in each derived class constructor? Or, better yet, make CanDispose an abstract property and thus require each derived class to explicitly state whether or not it can be disposed with e.g. "public override bool CanDispose => true;".
@ibrahim8905
@ibrahim8905 3 жыл бұрын
Thanks, really helped, excellent video!
@joachimally1534
@joachimally1534 4 жыл бұрын
I really liked the video, thanks man!
@DrSteve123456
@DrSteve123456 2 жыл бұрын
Hi Sean, I understand both Transient and Singleton ViewModels makes our life difficult but why not just keep the all Singleton ViewModels?
@vincentotieno9197
@vincentotieno9197 4 жыл бұрын
Hi, from Nairobi. Would you kindly demonstrate some kind of error logging, especially for diagnostic purposes in production? Thanks in advance!
@SingletonSean
@SingletonSean 4 жыл бұрын
Definitely Vincent! Logging has saved my life in production apps. Of course for WPF apps, that involves logging to a file. Thanks for the suggestion.
@omerkorkut
@omerkorkut 4 жыл бұрын
perfect source thanks from turkey
@k1ntoho
@k1ntoho 4 жыл бұрын
Video quality: default (awesome)
@SingletonSean
@SingletonSean 4 жыл бұрын
Yes sir, thanks kiinetic!
@ludovicwagner2656
@ludovicwagner2656 4 жыл бұрын
Hi Sean! I think that you're definitely an IDisposable-noob. I believe that all IDisposable-classes should be prefixed by "using" when instantiating them, right? I had to IDisposable my ExcelConnector class in one of my projects in order to make sure that I properly clean the memory or more precisely close the file (COM-marshal stuffs). By the way, really good tutorials, except that I got a bug somewhere which I haven''t managed to fix yet (I slightly change naming conventions and added a bunch of comments).
@SingletonSean
@SingletonSean 4 жыл бұрын
Hey Ludovic, I am familiar with using blocks and IDisposable. However, IDisposables most certainly do not need to be wrapped in a using block. A using statement is simply syntactic sugar to automatically call IDisposable.Dispose whenever the IDisposable goes out of scope (even from an exception).
@ludovicwagner2656
@ludovicwagner2656 4 жыл бұрын
@@SingletonSean Hey Sean! I'm just wondering. I think I have some issues with my own program. So, I have an ExcelConnector class which implements IDisposable. I instantiate it via dependency injection (same kind of architecture as yours). It seems that I never reach the Dispose() method no matter is I use singleton, transient or scope... So, the Excel file never closes. Do you have some advice about how to get it working with using statement?
@vesnx
@vesnx 3 жыл бұрын
correctly implement IDosposable and you should be ok
Toggling Form Submission - FULL STACK WPF (.NET CORE) MVVM #32
12:51
SingletonSean
Рет қаралды 2,7 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН
Une nouvelle voiture pour Noël 🥹
00:28
Nicocapone
Рет қаралды 9 МЛН
The Best Band 😅 #toshleh #viralshort
00:11
Toshleh
Рет қаралды 22 МЛН
黑天使被操控了#short #angel #clown
00:40
Super Beauty team
Рет қаралды 61 МЛН
Simplifying View Models (Best Practices) - EASY WPF (.NET 5)
16:54
SingletonSean
Рет қаралды 10 М.
Clean Architecture with ASP.NET Core 8 | .NET Conf 2023
29:17
Is LEARNING WPF still WORTH it in 2023?
10:59
tutorialsEU
Рет қаралды 62 М.
How to Close Windows from a ViewModel in C#
10:39
Brian Lagunas
Рет қаралды 25 М.
The Dispose Pattern
16:28
Coding Tutorials
Рет қаралды 11 М.
Creating a Card Control - FULL STACK WPF (.NET CORE) MVVM #6
26:13
SingletonSean
Рет қаралды 16 М.
Navigating Between Views - FULL STACK WPF (.NET CORE) MVVM #16
19:18
Disposing View Models - WPF MVVM NAVIGATION TUTORIAL #6
12:04
SingletonSean
Рет қаралды 11 М.
How IDisposable and Using Statements Work Together in C#
10:01
IAmTimCorey
Рет қаралды 34 М.
REAL or FAKE? #beatbox #tiktok
01:03
BeatboxJCOP
Рет қаралды 18 МЛН