Plugin registered but not getting fired RRS feed

  • Question

  • It seemed working a month ago, but don't know what happened now.

    I am registering plugins using the RegisterSolutionRequest class and I am able to see the plugins registered, but they are not getting fired. There is no error, while I run the code or while debugging, but they do not get fired. Here is the code I used:

    Irrespective of whether a plugin is already registered, I first unregister and then register the plugins.

    public void Register(string organization, string userSpecifiedAssembly, string userSpecifiedServer, string registerFilePath)
                    Console.Write("\n\nStarting to register assembly.");
                    Organization = organization;

                    // Get the plug-in assembly.
                    Console.Write("\nLoading assembly file..");
                    Assembly dll = Assembly.LoadFile(string.IsNullOrEmpty(userSpecifiedAssembly) ? PluginFile : userSpecifiedAssembly);

                    Console.Write("\nRetrieving assembly properties..");
                    // Create the plug-in assembly. 
                    pluginassembly assem = new pluginassembly();
                    assem.name = dll.GetName().Name;
                    assem.sourcetype = new Picklist();

                    // Note: SourceType 0 is "Database".
                    assem.sourcetype.Value = 0;
                    //assem.culture = dll.GetName().CultureInfo.ToString() == "" ? "neutral" : dll.GetName().CultureInfo.ToString();
                    assem.culture = dll.GetName().CultureInfo.ToString();
                    if (String.IsNullOrEmpty(assem.culture))
                        assem.culture = "neutral";
                    assem.version = dll.GetName().Version.ToString();

                    Byte[] tokenBytes = dll.GetName().GetPublicKeyToken();
                    StringBuilder strBuilder = new StringBuilder(32);
                    foreach (byte b in tokenBytes)
                        strBuilder.Append(b.ToString("x").PadLeft(2, '0'));
                    assem.publickeytoken = strBuilder.ToString();

                    //Load the file into pluginassembly.content
                    FileInfo fInfo = new FileInfo(dll.Location);
                    using (FileStream fs = File.OpenRead(dll.Location))
                        byte[] buffer = new byte[fInfo.Length];
                        fs.Read(buffer, 0, (int)fInfo.Length);
                        int outputSize = (int)Math.Ceiling(fInfo.Length / 3d) * 4;
                        char[] output = new char[outputSize];
                        System.Convert.ToBase64CharArray(buffer, 0, buffer.Length, output, 0);
                        assem.content = new string(output);

                    Console.Write("\nRetrieving Plugin Steps..");
                    SdkMessageProcessingStepRegistration[] steps = GetStepsInformation(dll, registerFilePath);
                    //Create a register request.
                    RegisterSolutionRequest request = new RegisterSolutionRequest();
                    request.PluginAssembly = assem;
                    request.Steps = steps;

                    Console.Write("\nRegistering assembly..");
                    //Execute the register request.
                    RegisterSolutionResponse response = (RegisterSolutionResponse)GetCRMService(userSpecifiedServer).Execute(request);
                    Console.Write("\nSuccessfully regsitered assembly.");
                catch (System.Exception ex)
                    throw new Exception("Error while registering. Error message:" + ex.Message);


    Any help please. Thanks



    Thursday, August 19, 2010 4:45 PM

All replies