Debug.print don't work

hi,
I don’t know if i’m doing something wrong or if i’ve not installed the sdk right. I’ve VS2010

I start a new proyect, choose micro framework from Visual C# and then Console.Application.

The default code is very simple :

 
using System;
using Microsoft.SPOT;

namespace MFConsoleApplication1
{
    public class Program
    {
        public static void Main()
        {
            Debug.Print(
                Resources.GetString(Resources.StringResources.String1));
        }

    }
}


the string1 is just the clasic Hello word!. the transport is emulator and device Microsoft Emulator. When i run it (F5), the emulator shows but it exit immediately, on the debug console no “hello wold”, it just shows this text :

Found debugger!

The debugging target runtime is loading the application assemblies and starting execution.
Loading Deployment Assemblies.

Resolving.

The debugging target runtime is loading the application assemblies and starting execution.
Ready.

Done.

Your program finished before the debugger could be attached. Add a delay.
And, you should make sure your program never exits.

Try this…

using System;
using Microsoft.SPOT;

using System.Threading;
 
namespace MFConsoleApplication1
{
    public class Program
    {
        public static void Main()
        {
            Debug.Print(
                Resources.GetString(Resources.StringResources.String1));
            Thread.Sleep(-1);
        }
    
    }
}

ooopssss…that’s logical…14 programming experience and i got so exited that forgot that…obvious :-[ :stuck_out_tongue:

thanks

anyway that modification should be included on that default code

i added the line



   Thread.Sleep(-1);


after the debug.print but no change…nothing on the debug console

What is the value of String1?

hello world :slight_smile:

i put it more simply :



using System;
using Microsoft.SPOT;

using System.Threading;

namespace MFConsoleApplication1
{
    public class Program
    {
        public static void Main()
        {
            Debug.Print("Hello Wolrd");
            Thread.Sleep(-1);
        }

    }
}


but all i get is :

Found debugger!

The debugging target runtime is loading the application assemblies and starting execution.
Loading Deployment Assemblies.

Resolving.

The debugging target runtime is loading the application assemblies and starting execution.
Ready.

use MFDeploy and erase you application and try again.

mfdeploy?

MFDeploy is a tool provided with the Microsoft NETMF SDK. Follow the MS Micro Framework menu off start.

Hi,
it doesn’t work on emulator. but it works panda ii using this code :
Thread.Sleep(Timeout.Infinite); or
Thread.Sleep(-1); or other Thread.Sleep(…); variation.

OR try this for emulator;

string Deger = Resources.GetString(Resources.StringResources.String1);
Debug.Print(Deger);
Thread.Sleep(5000); 

this works on emulator…
PS. You can change 5000 to whatever you want… OR you don’t need to use Thread.Sleep … just look “Output window” in VS. you will see "Hello World!"
OR you have problem with your VS installation and other MF installation… :frowning: i only add Thread.Sleep(-1); to your code and it worked…
best regards,

Judasis
PS… MFDeploy location is: “C:\Program Files (x86)\Microsoft .NET Micro Framework\v4.1\Tools\MFDeploy.exe”