Share via


IVsaEngine.LoadSourceState Method

Directs the script engine to load source items from their point of persistence, as specified by the host-provided object that implements the IVsaPersistSite interface.

public: void LoadSourceState( 
   IVsaPersistSite*  Site
);
public void LoadSourceState( 
   IVsaPersistSite  Site
);
MustOverride Public Sub LoadSourceState( _ 
   ByVal Site As IVsaPersistSite _
)

Parameters

  • site
    The site from which the specified source items is loaded.

Remarks

In cases where the host needs to load source code, the first thing it does after setting the IVsaEngine.RootMoniker and the IVsaEngine.Site properties is to call the LoadSourceState method. If the IVsaEngine.InitNew method is called on the script engine prior to calling the LoadSourceState method, the script engine will throw an EngineAlreadyInitialized exception.

Upon calling the LoadSourceState method, the script engine calls back using the IVsaPersistSite.LoadElement method to load all of the elements of the script engine. The first element to be loaded from the persistence site, returning null name parameter, is the project, which describes the other elements available at the site.

The following table shows the exceptions that the LoadSourceState 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.

RootMonikerNotSet

The IVsaEngine.RootMoniker property has not been set.

SiteNotSet

The IVsaEngine.Site property has not been set.

EngineInitialized

The engine has already been initialized, and cannot load source state.

See Also

Reference

IVsaEngine Interface

IVsaPersistSite.LoadElement Method