This documentation is archived and is not being maintained.

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.

[Visual Basic]
Sub LoadSourceState( _
   ByVal site As IVsaPersistSite _
void LoadSourceState(
   IVsaPersistSite site
void LoadSourceState(
   IVsaPersistSite* site
function LoadSourceState(
   site : IVsaPersistSite


The site from which the specified source items is loaded.


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 a null reference (Nothing in Visual Basic) 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.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

See Also

IVsaEngine Interface | IVsaEngine Members | Microsoft.Vsa Namespace | IVsaPersistSite.LoadElement