Click here to Skip to main content
15,881,588 members
Home / Discussions / C#
   

C#

 
QuestionWhat Is NullReferenceException? Object reference not set to an instance of an object i have error how to change code unable to excute below code could help me Pin
swethamaddi26-Jul-22 23:15
swethamaddi26-Jul-22 23:15 
AnswerRe: What Is NullReferenceException? Object reference not set to an instance of an object i have error how to change code unable to excute below code could help me Pin
Richard MacCutchan26-Jul-22 23:51
mveRichard MacCutchan26-Jul-22 23:51 
AnswerRe: What Is NullReferenceException? Object reference not set to an instance of an object i have error how to change code unable to excute below code could help me Pin
OriginalGriff27-Jul-22 0:04
mveOriginalGriff27-Jul-22 0:04 
AnswerRe: What Is NullReferenceException? Object reference not set to an instance of an object i have error how to change code unable to excute below code could help me Pin
Calin Negru28-Jul-22 0:11
Calin Negru28-Jul-22 0:11 
QuestionHow to convert pdf file into FileStream? Pin
Code4Ever26-Jul-22 6:35
Code4Ever26-Jul-22 6:35 
GeneralRe: How to convert pdf file into FileStream? Pin
Richard MacCutchan26-Jul-22 6:49
mveRichard MacCutchan26-Jul-22 6:49 
GeneralRe: How to convert pdf file into FileStream? Pin
Code4Ever26-Jul-22 6:59
Code4Ever26-Jul-22 6:59 
GeneralRe: How to convert pdf file into FileStream? Pin
Richard Deeming26-Jul-22 22:03
mveRichard Deeming26-Jul-22 22:03 
You need to Dispose of disposable objects like streams in order to free up the resources they're using.

When you set the PdfSource property to null, you throw the stream away without disposing of it. You have to wait for a GC cycle to detect that it's no longer referenced and "finalize" it.

Change your code to dispose of the existing stream (if any). For example:
C#
public Stream PdfSource
{
    get { return _pdfSource; }
    set
    {
        if (ReferenceEquals(value, _pdfSource)) return;
        if (_pdfSource != null) _pdfSource.Dispose();
        SetProperty(ref _pdfSource, value);
    }
}




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer

GeneralRe: How to convert pdf file into FileStream? Pin
Code4Ever28-Jul-22 19:52
Code4Ever28-Jul-22 19:52 
AnswerRe: How to convert pdf file into FileStream? Pin
Dave Kreskowiak26-Jul-22 7:24
mveDave Kreskowiak26-Jul-22 7:24 
GeneralRe: How to convert pdf file into FileStream? Pin
Code4Ever26-Jul-22 7:39
Code4Ever26-Jul-22 7:39 
GeneralRe: How to convert pdf file into FileStream? Pin
Dave Kreskowiak26-Jul-22 7:45
mveDave Kreskowiak26-Jul-22 7:45 
QuestionTechnic or best way to know if an application is "ready" when it is started from another application ? Pin
Maximilien25-Jul-22 1:14
Maximilien25-Jul-22 1:14 
AnswerRe: Technic or best way to know if an application is "ready" when it is started from another application ? Pin
Richard MacCutchan25-Jul-22 3:08
mveRichard MacCutchan25-Jul-22 3:08 
AnswerRe: Technic or best way to know if an application is "ready" when it is started from another application ? Pin
Gerry Schmitz27-Jul-22 6:43
mveGerry Schmitz27-Jul-22 6:43 
QuestionAsync web request Pin
moxol23-Jul-22 11:06
moxol23-Jul-22 11:06 
AnswerRe: Async web request Pin
Gerry Schmitz23-Jul-22 14:48
mveGerry Schmitz23-Jul-22 14:48 
QuestionPlease give me some explaination about the following Microsoft.ToolKit.MVVM Pin
Code4Ever23-Jul-22 7:17
Code4Ever23-Jul-22 7:17 
AnswerRe: Please give me some explaination about the following Microsoft.ToolKit.MVVM Pin
OriginalGriff23-Jul-22 9:18
mveOriginalGriff23-Jul-22 9:18 
QuestionClient and Server side validations for Calendar control Pin
Member 995054522-Jul-22 4:20
Member 995054522-Jul-22 4:20 
AnswerRe: Client and Server side validations for Calendar control Pin
Gerry Schmitz22-Jul-22 5:18
mveGerry Schmitz22-Jul-22 5:18 
QuestionI still didnt figure out how to upate a DGV without pressing enter Pin
grennday21-Jul-22 19:22
grennday21-Jul-22 19:22 
AnswerRe: I still didnt figure out how to upate a DGV without pressing enter Pin
Richard MacCutchan22-Jul-22 1:05
mveRichard MacCutchan22-Jul-22 1:05 
GeneralRe: I still didnt figure out how to upate a DGV without pressing enter Pin
grennday26-Jul-22 2:15
grennday26-Jul-22 2:15 
GeneralRe: I still didnt figure out how to upate a DGV without pressing enter Pin
Richard MacCutchan26-Jul-22 2:25
mveRichard MacCutchan26-Jul-22 2:25 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.