2016-08-23 82 views
1

在UWP項目下面的代碼拋出的ObjectDisposedException(針對Windows 10週年紀念版 - 14393):HttpMultipartFormDataContent.Dispose拋出的ObjectDisposedException

using (var content = new HttpMultipartFormDataContent()) 
{ 
    //Why disposing of the content raises an exception? 
} 

異常消息是:Additional information: The object has been closed. (Exception from HRESULT: 0x80000013)

堆棧跟蹤:at System.Runtime.InteropServices.WindowsRuntime.IClosable.Close() at System.Runtime.InteropServices.WindowsRuntime.IClosableToIDisposableAdapter.Dispose() at App3.MainPage.ButtonBase_OnClick(Object sender, RoutedEventArgs e)

這是否意味着雖然HttpMultipartFormDataContent執行IDisposable它不應該被處置?

如果我不處理HttpMultiparFormDataContent類型對象,我的應用程序還可以嗎?

回答

1

感謝您報告錯誤/問題。在上面的案例/場景中不調用Dispose,不一定會導致內存泄漏問題,應該回收內存。您可能會注意到內存的增加,但不一定是內存泄漏。您可以通過在Visual Studio中啓動診斷會話來進行檢查(調試 - >性能分析器 - >內存)

相關問題