Link to home
Start Free TrialLog in
Avatar of Max Destiny
Max Destiny

asked on

Install Problem

using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Configuration.Install;


namespace ConsoleApp5
{
      class Program
      {
            
            
            static void Main(string[] args)
            {
                  object b = new object();

                  string key = "MP3 PLayer";

                  string value = @"Video_Player.exe";

                  

                  Int32 capacity = 10;

                  IDictionary dict = new System.Collections.Generic.Dictionary<string, string>(capacity,null);

                  if (dict.Values.Count < capacity)

                  {
                        dict.Add(key, value);

                        Installer ins = new Installer();

                        ins.Uninstall(dict);

                        InstallContext con = new InstallContext(null, null);

                        con.LogMessage(ins.HelpText);

                        

                  }

                  if (dict.Values.Count >= capacity)

                  {
                        dict.Clear();
                  }



                  
                  


            

                  



                  
                  

      

                  

                  

                  
            }
      }
}





























It says System.ArgumentException wtf?

why is that?
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Your question is, "Install Problem", what does that mean? Does it mean that you developed a program and works on the development machine but does not work on the machine you are installing it on? Please post more details.
Avatar of Max Destiny
Max Destiny

ASKER

it doesn't work on the machine I'm installing it on
Is there an exception message being displayed?
yep System.Argument.Exception
You state in the original question, "It says System.ArgumentException wtf? why is that?", there is no way to know why? Have you looked at your system error log?
???
ive looked at InstallException but couldn't find a thing
Then there is no way anyone can tell you why it is not installing.
I may have found smth

savedState dictionary contains data which may have already been destroyed

can u help me

because I found that odd too
The run time exception is occurring when this line of code gets executed, " ins.Uninstall ( dict );", the documentation for Installer.Uninstall states the following,
An IDictionary that contains the state of the computer after the installation was complete
it looks like you are trying to uninstall something that has yet to be installed.
now I downloaded WhatsUp to do it and here it comes(the problem)


using System;
using System.Collections;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.IO;
using System.Configuration.Install;
using System.Web.Caching;
using System.Media;

namespace ConsoleApp7
{
      class Program
      {
            
            static void Main(string[] args)
            {
                  bool IsInstalled = true;

                        bool IsUninstalled = false;

                  Installer ins = new Installer();
                  string key = "firstkey";

                  string value = @"WhatsUp.exe";

                  string capacity = "10";
                  
                  IDictionary dict = new System.Collections.Generic.Dictionary<string, string>(Convert.ToInt32(capacity),null);
                  if (dict.Values.Count < Convert.ToInt32(capacity)&&IsInstalled)
                  {
                        dict.Add(key, value);

                        ins.Uninstall(dict);

                        IsUninstalled = true;
                  }
                  else
                  {
                        dict.Clear();
                  }
                  if (!IsUninstalled)

                  {
                        try

                        {

                        }
                        catch (InstallException exc)

                        {
                              string[] errors = { exc.Message, exc.Source };
                              System.Collections.Generic.List<string> errorlist = new System.Collections.Generic.List<string>();
                              foreach (var item in errors)
                              {
                                    errorlist.Add(item);
                                    foreach (var item2 in errorlist)

                                    {
                                          if (item2 == null)

                                          {
                                                Console.WriteLine("Error");
                                          }
                                          else
                                          {
                                                Console.WriteLine(item2);
                                          }
                                    }
                              }
                        }
                  }

                  

                  
                  

                  
                  




                  



                  


                  
            }
      }
}
same as old.System.ArgumentException
and inside try loop an ins.Install(dict) but same problem appearing
ASKER CERTIFIED SOLUTION
Avatar of Fernando Soto
Fernando Soto
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial