Share via


IVsaEngine.RevokeCache Method

Invalidates the cached assembly for a script engine, as specified by its root moniker.

public: void RevokeCache();
public void RevokeCache();
MustOverride Public Sub RevokeCache()

Remarks

When a script engine is run for the first time, the assembly is added to a global cache of script engines. Thereafter, any script engine having the same root moniker will retrieve the cached assembly rather than re-loading it.

Therefore, use the RevokeCache method to remove an existing version of the assembly in cases where using a more recent version is called for, for example, when the script engine compiles a newer version of an assembly. Under normal circumstances, the script engine doing the compilation will use the newly compiled code; however, in situations where there are multiple script engines, you will need to call the RevokeCache method so engines that are unaware of the newly compiled code do not mistakenly run out-of-date code they have already loaded. In a designer scenario, however, you compile the code on your development machine, and then the host directs the server to unload the out-of-date code so that next time the IVsaEngine.Run method is called the newly compiled code is obtained from the host.

Engine implementers should know that the script engine must not throw an exception if a host calls the RevokeCache method when there is no cached assembly to revoke.

The following table shows the exceptions that the RevokeCache method can throw.

Exception Type

Condition

EngineClosed

The IVsaEngine.Close method has been called and the engine is closed.

EngineBusy

The engine is currently executing code for another thread.

EngineRunning

The engine is already running.

EngineNotInitialized

The engine has not been initialized.

RevokeFailed

The cached copy could not be revoked. Check the System.Exception.InnerException property for more information.

See Also

Reference

IVsaEngine Interface