question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

COleControlSite re-enter destructor

See original GitHub issue

.NET version

.NET8 preview6, and daily build, and build with latest code

Did it work in .NET Framework?

Yes

Did it work in any of the earlier releases of .NET Core or .NET 5+?

It works fine before .NET8

Issue description

See following call stack, COleControlSite::~COleControlSite is called again, it makes app crash.

image

Steps to reproduce

I don’t know OLE, it’s not easy for me to make a test app, but I compare .NET8 and .NET7 source code. It may be helpful for you to understand the problem.

In .NET8, the second destructor is called from this line: https://github.com/dotnet/winforms/blob/e9a35997645b440b605f0d975305e313a6808883/src/System.Windows.Forms/src/System/Windows/Forms/Control.ActiveXImpl.cs#L1705

Before .NET8, this line doesn’t call destructor again: https://github.com/dotnet/winforms/blob/32a4f45583a44acc811da8c452d4a5f673342893/src/System.Windows.Forms/src/System/Windows/Forms/Control.ActiveXImpl.cs#L1918

So I guess it’s probably related to @JeremyKuhne 's https://github.com/dotnet/winforms/pull/8420

Issue Analytics

  • State:closed
  • Created 2 months ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
JeremyKuhnecommented, Jul 28, 2023

@panxn I messed up with the ref counting when I reworked this.

We did major refactoring here to get us closer to being able to enable Ahead-Of-Time (AOT) compilation and trimming for WinForms. We didn’t get all the way there for .NET 8, but we’re hoping to finish in .NET 9.

Please tag me directly on any other issues you might encounter, and I’ll look at them right away.

0reactions
panxncommented, Jul 31, 2023

Thank you! It works for me now.

Read more comments on GitHub >

github_iconTop Results From Across the Web

COleControlSite Class
Binds a property of the hosted control to a data source. COleControlSite::CreateControl, Creates a hosted ActiveX control. COleControlSite:: ...
Read more >
InternetSecurityManager cause chtmlview destructor ...
InternetSecurityManager cause chtmlview destructor exception ... COleControlSite** ppSite, UINT nID , REFCLSID clsid ) { ASSERT(ppSite !=
Read more >
Is a C++ destructor guaranteed not to be called until the ...
In the C++ code below, am I guaranteed that the ~obj() destructor will be called after the // More code executes? Or is...
Read more >
MFC Desktop Applications
COleControlSite class. COleConvertDialog class ... lets the user reenter the data. ... In its destructor, this class restores the pointer stored in its....
Read more >
MFC Tutorial PDF
and map them to dialog controls. lets the user reenter the data. ... In its destructor, this class restores the pointer stored in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found