CU4 of Studio 2019 - creating the project object leads to exception: "The requested service is not available: Sdl.Desktop.Platform.Services.IUserSettingsService."

Hi guys,

I have an issue with this code:

NewProj = New FileBasedProject(NewProjInfo)

When I do this, I get "The requested service is not available: Sdl.Desktop.Platform.Services.IUserSettingsService."

I am using this line of code for 10 years to create an empty project object and it always worked. But since I installed CU4 of STudio 2019 SR1, this code does not work any longer. 

Can you shed a light please?

Thanks, 

Tom

Parents
  • Hi Tom,

              There is a configuration issue in CU 4 that will be handled in CU 5 that will be released in the following months. In the meantime you can bypass this error using reflection like this  :

    1.) Add the following nuget package to your project or download it and extract the dll's : https://www.nuget.org/packages/SimpleInjector/

    2.) Using reflection we need to inject the container to GlobalServices so it can properly register all the services. Be aware that I put in the default location for that dll however if you have the API copied into another location you will have to change the path. Below is a code sample how to do that in C# : 

           var container = new SimpleInjector.Container();

           Assembly a = Assembly.LoadFile(@"C:\Program Files (x86)\SDL\SDL Trados Studio\Studio15\Sdl.Desktop.Platform.dll");

           Type myType = a.GetType("Sdl.Desktop.Platform.Services.GlobalServices");

           MethodInfo myMethod = myType.GetMethod("RegisterStandardServices");

           myMethod.Invoke(null, new object[] { container });

    Best regards,
    Robert

  • Hi,

    I'm getting sometimes a similar error ("The requested service is not available: Sdl.Desktop.Platform.Services.IMessageService.") or the same one ("The requested service is not available: Sdl.Desktop.Platform.Services.IUserSettingsService.") when trying to create a Filebased project.

    But in my case I run Trados Studio 2021 SR2.

    I did try the workaround described above, but  myType.GetMethod("RegisterStandardServices") gives me back a null as they is no RegisterStandardServices method in that DLL.

    Any pointer on how to make this work would be appreciated.

    Thanks,
    -yves

Reply Children