# OLE 80131015 when trying to unload the plugin

**URL:** https://talk.remobjects.com/t/ole-80131015-when-trying-to-unload-the-plugin/32978
**Category:** Hydra
**Created:** [February 16, 2026, 6:22pm UTC](https://talk.remobjects.com/t/ole-80131015-when-trying-to-unload-the-plugin/32978 "2026-02-16T18:22:30Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![allen](https://talk.remobjects.com/letter_avatar_proxy/v4/letter/a/bbce88/32.png) [@allen](https://talk.remobjects.com/u/allen)
#### Post date: [February 16, 2026, 6:22pm UTC](https://talk.remobjects.com/t/ole-80131015-when-trying-to-unload-the-plugin/32978/1 "2026-02-16T18:22:30Z")

</div>

Delphi 11.3 Host, [VB.net](http://VB.net) plugin (visual studio 2022), Current version of Hydra.

When I unload the plugin, I get the OLE error 80131015. I’ve read the other 3 threads on this subject from 2013 and 2016. Is there any update information on how to counter this exception? The “AfterUnloadModule” event doesn’t fire in Delphi. Can I add something to the [VB.Net](http://VB.Net) plugin to trap the error? The assembly the plugin uses does connect to a network server.

Thanks in advance!

Allen

---

<div class="post-metadata">

### Author: ![EvgenyK](https://talk.remobjects.com/user_avatar/talk.remobjects.com/evgenyk/32/16_2.png) [@EvgenyK](https://talk.remobjects.com/u/EvgenyK)
#### Post date: [February 17, 2026, 10:19am UTC](https://talk.remobjects.com/t/ole-80131015-when-trying-to-unload-the-plugin/32978/2 "2026-02-17T10:19:07Z")

</div>

Hi,

from [CannotUnloadAppDomainException Class (System) | Microsoft Learn](https://learn.microsoft.com/en-us/dotnet/api/system.cannotunloadappdomainexception) :

> [CannotUnloadAppDomainException](https://learn.microsoft.com/en-us/dotnet/api/system.cannotunloadappdomainexception) is thrown when there is an attempt to unload the following:
> 
> - The default application domain, which must remain loaded during the lifetime of the application.
> - An application domain with a running thread that cannot immediately stop execution.
> - An application domain that has already been unloaded.

Try to launch your plugin in debug mode in VS: use Delphi host as host application for your plugin or attach to Delphi host from VS.  
When `CannotUnloadAppDomainException` is raised, you can get some info from exception’s properties.

> [@allen](#):
>
> The “AfterUnloadModule” event doesn’t fire in Delphi.

as expected, event is fired **after** plugin is unloaded.

> [@allen](#):
>
> The assembly the plugin uses does connect to a network server.

looks like you have open connection that cannot be terminated at once and it causes this issue.  
try to terminate/close the connection to server and then unload your plugin.
