Obviously we ran into the same problem.
To keep the thread posted on what we tried and what seems to work well for us, here's what we did
We first tried using Apple script to simulate the behavior of "dragging the app to trash". This did work sometimes. macOS did throw the popup saying something with extension is being moved to trash and things. However other times the container app got removed but the tied extension kept arnd running, putting system into weird state, requiring systemextensionsctl reset. After experimenting, we dropped this for our usecase.
We exposed a command line switch in the app. During uninstall/upgrade, we launch the app with this new command line parameter, on seeing this, the app stops the extension using framework and then deactivates it. This cleans things up. Post this we delete the app. This has been holding well so far for us, but we are still experimenting with this.
If u happen to try this out, let me know if that works out for you as well.
If there's any better strategy, do update the thread please.
Topic:
App & System Services
SubTopic:
Drivers
Tags: