Exception when loading a style file on the Symbology control

438
2
Jump to solution
08-01-2012 07:02 AM
GeorgeFaraj
Occasional Contributor III
Hello,

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?

Thanks,
George Faraj
0 Kudos
1 Solution

Accepted Solutions
GeorgeFaraj
Occasional Contributor III
I think I've identified the problem. This seems to only happen when I run my app, and leave the designer open for the form where the symbology control is placed.

View solution in original post

0 Kudos
2 Replies
GeorgeFaraj
Occasional Contributor III
I think I've identified the problem. This seems to only happen when I run my app, and leave the designer open for the form where the symbology control is placed.
0 Kudos
RichardWatson
Frequent Contributor
You might try making the style file R/O.

I've had similar problems in ArcGIS Server with server style files.  Making the files R/O worked for me.
0 Kudos