Could not unbind MonacoWorkspace

I’m trying the following to override some behavior of MonacoWorkspace:

unbind(MonacoWorkspace);  ----> exception here !
bind(CustomMonacoWorkspace).toSelf().inSingletonScope();
rebind(Workspace).toService(CustomMonacoWorkspace);
rebind(MonacoWorkspace).toService(CustomMonacoWorkspace);

but, when i run the app, the browser console shows an exception that MonacoWorkspace ‘cannot unbind’.
Can anyone guide me regrding this ? thanks in advance.

It should work. MonacoWorkspace is bound to self:

Maybe it is just a DI container loading issue and there is a problem with the order. Make sure, your module explicitly depends on @theia/monaco.

Your binding can be simplified, by the way:

bind(MyMonacoWorkspace).toSelf().inSingletonScope();
rebind(MonacoWorkspace).toService(MyMonacoWorkspace);

Thank you very much, @kittaakos