This project is read-only.

Visual Studio 2008 Error

Jul 14, 2009 at 8:14 PM

I've downloaded the source code for the most recent release "24159" and opened the solution with Visual Studio 2008 on a Vista Computer.  When I try and run it in the debugger, the app never appears and after a few seconds it shuts down.  Below is the contents of the output window:

'IpMon.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_32\mscorlib\2.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'IpMon.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'IpMon.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Windows.Forms\2.0.0.0__b77a5c561934e089\System.Windows.Forms.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'IpMon.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System\2.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'IpMon.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Drawing\2.0.0.0__b03f5f7f11d50a3a\System.Drawing.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'IpMon.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.HostingProcess.Utilities.Sync\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.HostingProcess.Utilities.Sync.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'IpMon.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\Microsoft.VisualStudio.Debugger.Runtime\9.0.0.0__b03f5f7f11d50a3a\Microsoft.VisualStudio.Debugger.Runtime.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'IpMon.vshost.exe' (Managed): Loaded 'C:\Visual Studio Projects\C#\Dynamic_IP_Tracker\Working\IpMon\bin\Debug\IpMon.vshost.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'IpMon.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_32\System.Data\2.0.0.0__b77a5c561934e089\System.Data.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'IpMon.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_32\System.Web\2.0.0.0__b03f5f7f11d50a3a\System.Web.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'IpMon.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Xml\2.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

The thread 0xbfc has exited with code 0 (0x0).

The thread 0x11fc has exited with code 0 (0x0).

'IpMon.vshost.exe' (Managed): Loaded 'C:\Visual Studio Projects\C#\Dynamic_IP_Tracker\Working\IpMon\bin\Debug\IpMon.exe', Symbols loaded.

'IpMon.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Deployment\2.0.0.0__b03f5f7f11d50a3a\System.Deployment.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'IpMon.vshost.exe' (Managed): Loaded 'C:\Windows\assembly\GAC_MSIL\System.Configuration\2.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.

'IpMon.vshost.exe' (Managed): Loaded 'C:\Visual Studio Projects\C#\Dynamic_IP_Tracker\Working\IpMon\bin\Debug\PropGrid.dll', Symbols loaded.

'IpMon.vshost.exe' (Managed): Loaded 'dzpmbaow'

The thread 0x1788 has exited with code 0 (0x0).

The thread '<No Name>' (0x124) has exited with code 0 (0x0).

The program '[2924] IpMon.vshost.exe: Managed' has exited with code 0 (0x0).

 

Does anyone have any suggestions on how to resolve?  I have openend the solution in Visual C# Express 2008 on an XP computer and it runs in the debugger just fine.  I just cant seem to get it working on Vista and VS 2008.

I should also mention that at first I was getting an exception at:

<font size="2" color="#0000ff">

if

</font>

(!System.Diagnostics.EventLog.SourceExists(this.eventName))

I then changed the security permissions in Vista so you do not need to click "allow" each time you open the control panel.. etc. This resolved the above issue but that is when I starte experiencing the program exitiing.  I have since put the securiy permissions back to defaults and the no luck.  The program still exits but I no longer get an error with system.diagnostics.evenlog.sourceExists()

 

Jul 15, 2009 at 5:55 AM

Hi there,

Originaly, it was developed VS 2008 with Vista as you can see at the image that I uploaded in main screen. I believe there should be no problem on the code itself. It seems to me related to the security permission that you have in Vista, when it was installed. Actually, there is no code to shutdown Vista at all.

Anyway, I'll be looking at more closely as I can get in to the code back.

Regards, 

 

Jul 15, 2009 at 2:52 PM

Thanks,  I have gotten it to run in the debugger.  I think you misunderstood, it does not shut vista down, if you run it in the debugger it stops debugging after a few seconds.  I am still looking at the code trying to understand the default behavior.  it appears that before the xml file is created the app continues to run but once you click ok and the xml file gets saved to the program data folder, if you rerun the it in the debugger, it shuts down after a few seconds.

I have also installed the actual released exe version on an XP computer.  Once you start the program, is it supposed to continue to run in the back ground?   After I start the program it appears in the task manager process list, but only for a few seconds then exits.

Jul 17, 2009 at 6:21 AM

Hi ymitis,

I just got back from my work. Do you have specific point that you can see from the entry point of the Main function? I did the samething that you mentioned I don't see any problem like that. If you are getting the error from the following, please check the value of "Application.CommonAppDataPath", if the value is null then you need to check your security policy as well.

        [STAThread]
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            MainForm form = new MainForm();
            form.SetExecMode(Application.CommonAppDataPath, args);
            Application.Run(form);
        }

Please, take a look at the following code block from the code. The Main()

        public void SetExecMode(string appdatapath, string[] args)
        {
            System.Diagnostics.Debug.Assert(ipMon != null);

            if ( (args.Length == 1 && args[0] == "config") || 
                 !System.IO.File.Exists( appdatapath + "\\" + IPMonitor.CONFIGFILE) )
            {
                IPMonitor.AppDataPath = appdatapath;
                OpMode = ExecMode.Config;
            }
        }

Well, just in case, you can also specify the command line argument "config" in the project setting from the Visual Studio IDE to take a look at what the IPMon is doing for configuration. Otherwise IPMon will update current your WAN IP address, then send the email that you already specified, then exit itself. Basically that is what it does. The original idea was based on the fact that I don't want create any NT service which will take some memory space all the way. WAN IP address will take time to be changed (around once in a month in DSL or Cable Internet).

We can actually do that with new NT service (if it is required). So, whenever the Internet re-connected to WAN address, it will automatically send the updated WAN address to a certain type of server (like as what Dynamic DNS does). Currently, it is not my scope of this project. If anyone wants to be implemented that, then I'll re-consider about that at 2.0.

Thanks,
cavecafe
Jul 17, 2009 at 11:20 PM

Hi cavecafe,

Thanks for your response.  I am making some progress.  I am studying your app for 2 reasons.

  1. I think it is a useful app tha has value to me
  2. I am a student trying to learn and get more experience by studying others code.

I do have a few questions:

With regards to the app, if the IP address has not changed, the app just exits.  My question is what is the trigger to start the application again?
If it is not running in the background how does it get started to check if my ip has changed without me manually running it?

Secondly,  why would you only set IPMonitor.AppDataPath = appdatapath;  only if no config file is found or config is specified on the command line?

IPMonitor.AppDataPath is needed for  GetConfig()
Would it be better to do this:

public void SetExecMode(string appdatapath, string[] args)
        {
            System.Diagnostics.Debug.Assert(ipMon != null);

            if ( (args.Length == 1 && args[0] == "config") ||
                 !System.IO.File.Exists( appdatapath + "\\" + IPMonitor.CONFIGFILE) )
            {
                                OpMode = ExecMode.Config;
            }

                  IPMonitor.AppDataPath = appdatapath;

        }