License check failed, with exception: Sdl.Core.PluginFramework.PluginFrameworkException: No Application specific plug-in directory found.

Hi, I am trying to create a new localization project using the project automation API. It is a standalone application. Here is my code:

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Reflection;
using System.Globalization;
using Sdl.Core.Settings;
using Sdl.Core.Globalization;
using Sdl.ProjectAutomation.Core;
using Sdl.ProjectAutomation.FileBased;
using Sdl.ProjectAutomation.Settings;
using Sdl.Core.PluginFramework;
using Studio.AssemblyResolver;

namespace WindowsFormsApplication1
{
    public partial class Form1 : Form
    {
        
        public Form1()
        {           
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e) {

            ProjectInfo info = new ProjectInfo();
            info.Name = "Demo Project";
            info.Description = "This is a programmatically created project.";
            info.DueDate = DateTime.Now.AddDays(7);
            FileBasedProject newProject = new FileBasedProject(info);         
        }    
    }
}

I got an error at FileBasedProject newProject = new FileBasedProject(info);    Here is the error:

License check failed, with exception: Sdl.Core.PluginFramework.PluginFrameworkException: No Application specific plug-in directory found.
   at Sdl.Core.PluginFramework.DefaultPluginLocator..ctor()
   at Sdl.Core.PluginFramework.PluginManager.get_DefaultPluginRegistry()
   at Sdl.Common.Licensing.Provider.Core.LicensingProviderManager.get_LicensingProviderFactories()
   at Sdl.Common.Licensing.Provider.Core.LicensingProviderManager.CreateProvider(ILicensingProviderConfiguration config)
   at Sdl.Common.Licensing.Manager.ApplicationLicenseManager.GetCurrentLicensingProvider()
   at Sdl.Common.Licensing.Manager.ApplicationLicenseManager.GetProduct()
   at Sdl.Common.Licensing.Manager.ApplicationLicenseManager.GetLicenseWithoutConsumingSeatsOrUsages()
   at Sdl.ProjectApi.Licensing.StudioLicense.GetLicenseWithoutConsumingSeatsOrUsages()
   at Sdl.ProjectApi.Licensing.LicenseCheckWithoutUsingNetworkSeat.get_ProductLicense()
   at Sdl.ProjectApi.Licensing.LicenseCheckWithoutUsingNetworkSeat.get_IsProfessional()
   at Sdl.ProjectAutomation.FileBased.FileBasedProject.CheckLicense()


I have put the assembly resolver in the main entrance point but I still get the same error. Here is my Program.cs:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Forms;
using Studio.AssemblyResolver;


namespace WindowsFormsApplication1
{
    static class Program
    {
        /// <summary>
        /// The main entry point for the application.
        /// </summary>
        [STAThread]
        static void Main()
        {
            AssemblyResolver.Resolve();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }
    }
}

What did I do wrong? Do I need to register a plugin directory using the plugin manager in the Core API?

Thanks!!

  • Using 2015? It appears the Assembly Resolver has not been updated for 2015.
    See https://github.com/cromica/Studio-AssemblyResolver/tree/master/Studio.AssemblyResolver/PathResolver/Implementation
  • Hi. Thank you for your reply. I am still using the 2014 API. I think it is probably because my Studio 3 folder is in a read only folder. I copied the Studio 3 folder to another place and set my output path to be the Studio 3 folder in the new place, and it worked! Although I am not sure whether this is a good solution.

  • I don't recommend copy Studio files to a different location because you might run into other problems later.  If the AssemblyResolver is not working for you, although there are many that are using it with success, I would recommend to deploy your app in the Studio install folder.

     

    PS: For the AssemblyResolver you can implement your own logic by implementing IPathResolver and then use method WithPathResolver instead of Resolve. Also you can add support for Studio 2015 since the project is open source.

  • Hi Romulus, thank you for your reply. What other problems will I run into if I copy the Studio files to a different location? Could you give me an example?
    The function to set a different location using IPathResolver and WithPathResolver is pretty neat, but will that solve the other problems you mentioned?
    Do you think the originally error occurred because my Studio install folder is read only?
  • Hi Ting,

    It should not fail because it is read only. I've used the AssemblyResolver with no problems here, so it is a different issue.
  • Hi, I have tested three different scenarios.

    First Scenario

    I set the output directory to C:\Program Files (x86)\SDL\SDL Trados Studio\Studio3 and didn't use assembly resolver. I got an error message when building the solution:

    Error 1 Unable to copy file "\\liserver2012\Development\StudioSDKDemo\SudioSDKDemo\packages\Studio.AssemblyResolver.0.1.1.0\lib\Studio.AssemblyResolver.dll" to "C:\Program Files (x86)\SDL\SDL Trados Studio\Studio3\Studio.AssemblyResolver.dll". Access to the path 'C:\Program Files (x86)\SDL\SDL Trados Studio\Studio3\Studio.AssemblyResolver.dll' is denied. SudioSDKDemo

    I think this is because my C:\Program Files (x86)\SDL\SDL Trados Studio\Studio3 is read only. To make it work. I probably need to ask our system admin to change the security setting on my computer.

    Second Scenario

    I set the output directory to an empty folder - \\LIserver2012\Users\tchi\Documents\Visual Studio 2010\Projects\Test\, and I used assembly resolver. I got an error message at this line:

    FileBasedProject newProject = new FileBasedProject(GetProjectInfo());

    The error details is attached below:

    System.IO.FileNotFoundException was unhandled
      HResult=-2147024894
      Message=Could not load file or assembly 'SDLTradosStudio' or one of its dependencies. The system cannot find the file specified.
      Source=mscorlib
      FileName=SDLTradosStudio
      FusionLog==== Pre-bind state information ===
    LOG: DisplayName = SDLTradosStudio
     (Partial)
    WRN: Partial binding information was supplied for an assembly:
    WRN: Assembly Name: SDLTradosStudio | Domain ID: 1
    WRN: A partial bind occurs when only part of the assembly display name is provided.
    WRN: This might result in the binder loading an incorrect assembly.
    WRN: It is recommended to provide a fully specified textual identity for the assembly,
    WRN: that consists of the simple name, version, culture, and public key token.
    WRN: See whitepaper http://go.microsoft.com/fwlink/?LinkId=109270 for more information and common solutions to this issue.
    LOG: Appbase = file://LIserver2012/Users/tchi/Documents/Visual Studio 2010/Projects/Test/
    LOG: Initial PrivatePath = NULL
    Calling assembly : Sdl.Core.Globalization, Version=1.8.0.0, Culture=neutral, PublicKeyToken=c28cdb26c445c888.
    ===
    LOG: This bind starts in default load context.
    LOG: Using application configuration file: \\LIserver2012\Users\tchi\Documents\Visual Studio 2010\Projects\Test\SudioSDKDemo.exe.Config
    LOG: Using host configuration file:
    LOG: Using machine configuration file from C:\Windows\Microsoft.NET\Framework\v4.0.30319\config\machine.config.
    LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
    LOG: The same bind was seen before, and was failed with hr = 0x80070002.

      StackTrace:
           at System.Reflection.RuntimeAssembly._nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
           at System.Reflection.RuntimeAssembly.nLoad(AssemblyName fileName, String codeBase, Evidence assemblySecurity, RuntimeAssembly locationHint, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
           at System.Reflection.RuntimeAssembly.InternalLoadAssemblyName(AssemblyName assemblyRef, Evidence assemblySecurity, RuntimeAssembly reqAssembly, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean throwOnFileNotFound, Boolean forIntrospection, Boolean suppressSecurityChecks)
           at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, IntPtr pPrivHostBinder, Boolean forIntrospection)
           at System.Reflection.RuntimeAssembly.InternalLoad(String assemblyString, Evidence assemblySecurity, StackCrawlMark& stackMark, Boolean forIntrospection)
           at System.Reflection.Assembly.Load(String assemblyString)
           at Sdl.Core.Globalization.LocalizableString.LoadResourceString(String embeddedResourceName)
           at Sdl.Core.Globalization.LocalizableString.get_Content()
           at Sdl.Desktop.Platform.Implementation.Services.UserProfile.ReadHeader()
           at Sdl.Desktop.Platform.Implementation.Services.UserProfile..ctor(String filePath, ISettingsBundle parentSettings, Boolean isCustom)
           at Sdl.Desktop.Platform.Implementation.Services.UserSettingsService.EnsureLoaded()
           at Sdl.Desktop.Platform.Implementation.Services.UserSettingsService.get_UserSettings()
           at Sdl.ProjectAutomation.FileBased.FileBasedProject.GetDefaultProjectTemplateReference()
           at Sdl.ProjectAutomation.FileBased.FileBasedProject..ctor(ProjectInfo projectInfo)
           at WindowsFormsApplication1.Form1.button1_Click(Object sender, EventArgs e) in \\liserver2012\Development\StudioSDKDemo\SudioSDKDemo\SudioSDKDemo\Form1.cs:line 31
           at System.Windows.Forms.Control.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnClick(EventArgs e)
           at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
           at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
           at System.Windows.Forms.Control.WndProc(Message& m)
           at System.Windows.Forms.ButtonBase.WndProc(Message& m)
           at System.Windows.Forms.Button.WndProc(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
           at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
           at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
           at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
           at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
           at System.Windows.Forms.Application.Run(Form mainForm)
           at WindowsFormsApplication1.Program.Main() in \\liserver2012\Development\StudioSDKDemo\SudioSDKDemo\SudioSDKDemo\Program.cs:line 21
      InnerException:

    There is another error in the output window:

    log4net:ERROR XmlConfigurator: Failed to find configuration section 'log4net' in the application's .config file. Check your .config file for the <log4net> and <configSections> elements. The configuration section should look like: <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />

    I can see many files have been copied to \\LIserver2012\Users\tchi\Documents\Visual Studio 2010\Projects\Test\, so I think the assembly resolver is working. However, some files were not copied to the output folder for some reason. Do I need to add any reference even though I don't use them directly in my code?

    Third Scenario

    I copied everything in C:\Program Files (x86)\SDL\SDL Trados Studio\Studio3 to \\LIserver2012\Users\tchi\Documents\Visual Studio 2010\Projects\Test\, set the output path to \\LIserver2012\Users\tchi\Documents\Visual Studio 2010\Projects\Test\ and I didn't use the assembly resolver. This scenario works! Although I still get an error message at the output window:

    log4net:ERROR XmlConfigurator: Failed to find configuration section 'log4net' in the application's .config file. Check your .config file for the <log4net> and <configSections> elements. The configuration section should look like: <section name="log4net" type="log4net.Config.Log4NetConfigurationSectionHandler,log4net" />

    I am still exploring~~

  • Hi! Have you found a solution to your issue? I have the same license error and I search a solution too.
  • Hello, could we get more feedback on the resolution progress of this ticket item please (1136 I think)? Im hitting the same wall. I would rather not have to put my app in the same folder... In any case, could you elaborate on this comment please? "If the AssemblyResolver is not working for you, although there are many that are using it with success"... Could you discuss in what type of scenario this would work with the Assembly resolver? Are you saying that if I use the IPathResolver interface, that I should be able to get this work without putting it in the Studio folder? If that is the case, when/where would the implemented functions be called from? Everytime a call to an SDK/Api function is made? or just instatiate a global variable? Currently, Im devving with Studio 2017.