Archived

This forum has been archived. Please start a new discussion on GitHub.

Ice.Application class in C#

I recently moved computers and on my previous machine I had Ice 2.1.1, and now I have 2.1.2. I have a console app and when I run it, control returns immediately to the console and the app is running in the background. Is this new behavior because I don't remember it working this way on the other computer.

Anyway, is there a way to control when the process is sent into the background?

Platform is Ice 2.1.2, using C# on VS2003, on Win2k

Thanks,
Beardo

Comments

  • I haven't changed any of the code around Ice.Application, so I'm a bit puzzled by this. Do you have a code example that demonstrates the problem? This would help a lot to track down what's going on.

    Cheers,

    Michi.
  • Just a simple Ice.Application will do. For some reason it stays in the foreground on my laptop with Ice 2.1.1, but goes into the background on my desktop with Ice 2.1.2. I retried this morning and that is the behavior I'm seeing.
    using System;
    using Ice;
    
    
    namespace PiratesCastle
    {
    	public class Sloop : Ice.Application
    	{
    		public override int run(string[] args)
    		{
    			// Terminate cleanly on receipt of a signal
    			//
    			shutdownOnInterrupt();
    
    			// Create an object adapter (stored in the _adapter
    			// static members)
    			//
    			Console.WriteLine("Creating adapter...");
    			
    			Ice.ObjectAdapter adapter = communicator().createObjectAdapterWithEndpoints(
    				"SloopRTI", "tcp -p 10000");
    			
    		        Console.WriteLine("Created adapter.");
                            
                            // Add to adapter here, removed for example
    
    			// All objects are created, allow client requests now
    			//
    			adapter.activate();
    
    			Console.WriteLine("Activated adapter");
    			// Wait until we are done
    			//
    			communicator().waitForShutdown();
    
    			if (interrupted())
    				Console.Error.WriteLine(appName() + ": terminating");
    
    			return 0;
    		}
    
    		public Sloop()
    		{
    		}
    		
    		[STAThread]
    		static void Main(string[] args)
    		{
    			sloop = new Sloop();
    			Environment.Exit(sloopRTI.main(args));
    		}
    	}
    }
    
    
  • Oh yeah

    The laptop is Windows XP and the desktop is Windows 2000. I don't think that should make a difference, but it's worth noting.
  • I just tried this. Unfortunately, I don't have Win2000 available here. With WinXP, it works as expected.

    Could you check what version of Visual C# and the .NET run time you are using on your Win2000 machine? You should have version 7.1.3088 of Visual C# and version 1.1.4322 of the .NET run time.

    Cheers,

    Michi.
  • I'll check when I get home tonight.

    When you say it works as expected on WinXP, does that mean it goes into the background or not?
  • It works as expected: the server starts up and then just sits there until I hit Ctrl-C. It doesn't run in the background.

    Cheers,

    Michi.
  • Not that it's any problem with Ice, but FYI it happens when I build it with Nant instead of the Visual Studio builder. I dunno why, maybe nant is linking in different versions of some other library. Who knows. Thanks for your responses though.
  • Check whether you have an old version of icecs.dll in the global assembly cache. You may be picking up an old version of the run time.

    Cheers,

    Michi.
  • Nope, that isn't it. Over the weekend my fiance bought me a new computer and so it has a fresh install of Win XP, Visual Studio, and Ice 2.1.2, same behavior, the nant built version goes into the background while the visual studio does not.

    Actually, I just figured it out. For the csc task, the target attribute controls what kind of exe gets generated. I had it set to "winexe", which makes a windows executable, whereas just "exe" makes a console app.

    Thanks,
    Beardo