Friday, May 18, 2018

Setting SAS Options in c#


For setting SAS Options in code, make sure you have the following dlls:

Interop.SAS
SASObjectManager
SASWorkspaceManager

For Interop.SAS, change the property to not Embed Interop Type.. If you don’t do this, you will get the following error:

Unhandled Exception: System.Runtime.InteropServices.COMException: Retrieving the COM class factory for component with CLSID {1589F028-0488-11D3-B95F-00C04F81B63A} failed due to the following error: 80040154 Class not registered (Exception from HRESULT: 0x80040154 (REGDB_E_CLASSNOTREG)).

You may also see this error when setting options. It indicates the same issue:

Could not load type 'SAS.OptionServiceSetError' from assembly 'SasServices, Version=1.0.0.10, Culture=neutral, PublicKeyToken=null'

SAS throwing RPC error

If you are doing code in C#  and get this error when creating a LanguageService: The RPC server is unavailable. (Exception from HRESULT:...