AnsweredAssumed Answered

Exception when loading a style file on the Symbology control

Question asked by ccposton on Aug 1, 2012
Latest reply on Aug 1, 2012 by rlwatson

I'm getting a non-documented exception when calling ISymbologyControl.LoadStyleFile... Here's the code:

 layerSymbol.BeginInit();  layerSymbol.LoadStyleFile(System.IO.Path.Combine(styleInstallPath, "Styles\\ESRI.ServerStyle"));

where layerSymbol is of type ESRI.ArcGIS.Controls.AxSymbologyControl and the value of styleInstallPath comes from ESRI.ArcGIS.RuntimeManager.ActiveRuntime.Path and is "C:\\Program Files\\ArcGIS\\Engine10.1\\". I have confirmed that the file exists. Also, this error does not always happen, sometimes it works.

The exception is as follows:

Unspecified error (Exception from HRESULT: 0x80004005 (E_FAIL))    at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)    at ESRI.ArcGIS.Controls.ISymbologyControlDefault.LoadStyleFile(String fileName)    at ESRI.ArcGIS.Controls.AxSymbologyControl.LoadStyleFile(String fileName)

Does anyone have any idea why this is happening?

George Faraj