View mode: basic / threaded / horizontal-split · Log in · Help
May 10, 2008
Error Message useless
tango.core.Exception.IllegalArgumentException: Argument not valid

This message from the compiler is just bloody useless 
Where do you go in a 200 line program?

All I can see is go to each line that might be a cause and comment it out ,try to compile it again and if no good do the next one .

Some lines just can't be done anyway .

How hard could it be for you experts to add some detail to the error huh ??
May 10, 2008
Re: Error Message useless
"Tower Ty" <tytower@hotmail.com.au> wrote in message 
news:g02qih$16tn$1@digitalmars.com...
> tango.core.Exception.IllegalArgumentException: Argument not valid
>
> This message from the compiler is just bloody useless
> Where do you go in a 200 line program?
>
> All I can see is go to each line that might be a cause and comment it out 
> ,try to compile it again and if no good do the next one .
>
> Some lines just can't be done anyway .
>
> How hard could it be for you experts to add some detail to the error huh 
> ??

Is this a *compiler* error?  Are you *sure*?

Do you get the error when you compile the program or when you run it?
May 10, 2008
Re: Error Message useless
Jarrett Billingsley Wrote:

> "Tower Ty" <tytower@hotmail.com.au> wrote in message 
> news:g02qih$16tn$1@digitalmars.com...
> > tango.core.Exception.IllegalArgumentException: Argument not valid
> >
> > This message from the compiler is just bloody useless
> > Where do you go in a 200 line program?
> >
> > All I can see is go to each line that might be a cause and comment it out 
> > ,try to compile it again and if no good do the next one .
> >
> > Some lines just can't be done anyway .
> >
> > How hard could it be for you experts to add some detail to the error huh 
> > ??
> 
> Is this a *compiler* error?  Are you *sure*?
> 
> Do you get the error when you compile the program or when you run it? 
> 
> 
No of course it is a run time error and I'm still looking for it , Jarrett sorry
May 10, 2008
Re: Error Message useless
"Tower Ty" <towerty@msn.com.au> wrote in message 
news:g038l7$230k$1@digitalmars.com...
> Jarrett Billingsley Wrote:
>
>> "Tower Ty" <tytower@hotmail.com.au> wrote in message
>> news:g02qih$16tn$1@digitalmars.com...
>> > tango.core.Exception.IllegalArgumentException: Argument not valid
>> >
>> > This message from the compiler is just bloody useless
>> > Where do you go in a 200 line program?
>> >
>> > All I can see is go to each line that might be a cause and comment it 
>> > out
>> > ,try to compile it again and if no good do the next one .
>> >
>> > Some lines just can't be done anyway .
>> >
>> > How hard could it be for you experts to add some detail to the error 
>> > huh
>> > ??
>>
>> Is this a *compiler* error?  Are you *sure*?
>>
>> Do you get the error when you compile the program or when you run it?
>>
>>
> No of course it is a run time error and I'm still looking for it , Jarrett 
> sorry

Yea, that's kind of a problem with getting uncaught exceptions in the 
abscence of the stack traces that reflection allows. Be glad it's such a 
small program.

What I recommend doing is either step through it in a debugger (if you have 
one set up), or use debugging output statements.

If you're not familiar with the trick of debugging output statements, it's 
like this: Start with main() and sprinkle normal output statements through 
it. For instance, if your main() is like this:

void main()
{
  someFunc();
  if(something)
      doSomething();
  anotherFunc();
  yetAnotherFunc();
}

Then do this:

void main()
{
Stdout("1").newline;
  someFunc();
Stdout("2").newline;
  if(something)
  {
Stdout("3").newline;
      doSomething();
Stdout("4").newline;
  }
Stdout("5").newline;
  anotherFunc();
Stdout("6").newline;
  yetAnotherFunc();
Stdout("7").newline;
}

Obviously, copy/paste helps there ;) Run that and you'll get something like:

1
2
5
tango.core.Exception.IllegalArgumentException: Argument not valid

In this case, we know the if() ended up false and "doSomething()" was 
skipped, and we also know the exception was thrown somewhere in 
"anotherFunc()". So rip those "Stdout's" out of there, and do the same thing 
in "anotherFunc()". Keep drilling down like that until you find the problem.

I do that all the time in my own code (because so far I've been too lazy to 
actually get a debugger set up with D :) ).
May 10, 2008
Re: Error Message useless
Nick Sabalausky Wrote:

> "Tower Ty" <towerty@msn.com.au> wrote in message 
> news:g038l7$230k$1@digitalmars.com...
> > Jarrett Billingsley Wrote:
> >
> >> "Tower Ty" <tytower@hotmail.com.au> wrote in message
> >> news:g02qih$16tn$1@digitalmars.com...
> >> > tango.core.Exception.IllegalArgumentException: Argument not valid
> >> >
> >> > This message from the compiler is just bloody useless
> >> > Where do you go in a 200 line program?
> >> >
> >> > All I can see is go to each line that might be a cause and comment it 
> >> > out
> >> > ,try to compile it again and if no good do the next one .
> >> >
> >> > Some lines just can't be done anyway .
> >> >
> >> > How hard could it be for you experts to add some detail to the error 
> >> > huh
> >> > ??
> >>
> >> Is this a *compiler* error?  Are you *sure*?
> >>
> >> Do you get the error when you compile the program or when you run it?
> >>
> >>
> > No of course it is a run time error and I'm still looking for it , Jarrett 
> > sorry
> 
> Yea, that's kind of a problem with getting uncaught exceptions in the 
> abscence of the stack traces that reflection allows. Be glad it's such a 
> small program.
> 
> What I recommend doing is either step through it in a debugger (if you have 
> one set up), or use debugging output statements.
> 
> If you're not familiar with the trick of debugging output statements, it's 
> like this: Start with main() and sprinkle normal output statements through 
> it. For instance, if your main() is like this:
> 
> void main()
> {
>    someFunc();
>    if(something)
>        doSomething();
>    anotherFunc();
>    yetAnotherFunc();
> }
> 
> Then do this:
> 
> void main()
> {
> Stdout("1").newline;
>    someFunc();
> Stdout("2").newline;
>    if(something)
>    {
> Stdout("3").newline;
>        doSomething();
> Stdout("4").newline;
>    }
> Stdout("5").newline;
>    anotherFunc();
> Stdout("6").newline;
>    yetAnotherFunc();
> Stdout("7").newline;
> }
> 
> Obviously, copy/paste helps there ;) Run that and you'll get something like:
> 
> 1
> 2
> 5
> tango.core.Exception.IllegalArgumentException: Argument not valid
> 
> In this case, we know the if() ended up false and "doSomething()" was 
> skipped, and we also know the exception was thrown somewhere in 
> "anotherFunc()". So rip those "Stdout's" out of there, and do the same thing 
> in "anotherFunc()". Keep drilling down like that until you find the problem.
> 
> I do that all the time in my own code (because so far I've been too lazy to 
> actually get a debugger set up with D :) ).
> 
> 
Thanks
May 10, 2008
Re: Error Message useless
On Sat, 10 May 2008 08:12:25 +0200, Nick Sabalausky <a@a.a> wrote:

> Then do this:
>
> void main()
> {
> Stdout("1").newline;
>    someFunc();
> Stdout("2").newline;
>    if(something)
>    {
> Stdout("3").newline;
>        doSomething();
> Stdout("4").newline;
>    }
> Stdout("5").newline;
>    anotherFunc();
> Stdout("6").newline;
>    yetAnotherFunc();
> Stdout("7").newline;
> }

Oh ... how many time have I wished there was an IDE command to do that :)
I do this all the time and I've always wondered if other people do that  
too ... I call it "laying traps" and I found usually it's best to first  
put not too many Stdouts in there, e.g. one every 4-5 statements if you're  
not really sure where the error happens. Then you can go in and put some  
"3a" "3b" and so on to find the exact statement that causes the problem.

That's, btw, a good reason to put single-line-if/elses into {}s instead of  
writing them on the same line. Easier to put Stdouts in if you need them.

-Mike

-- 
Using Opera's revolutionary e-mail client: http://www.opera.com/mail/
May 10, 2008
Re: Error Message useless
"Mike" <vertex@gmx.at> wrote in message news:op.uaxjm1sjkgfkbn@lucia...
> On Sat, 10 May 2008 08:12:25 +0200, Nick Sabalausky <a@a.a> wrote:
>
>> Then do this:
>>
>> void main()
>> {
>> Stdout("1").newline;
>>    someFunc();
>> Stdout("2").newline;
>>    if(something)
>>    {
>> Stdout("3").newline;
>>        doSomething();
>> Stdout("4").newline;
>>    }
>> Stdout("5").newline;
>>    anotherFunc();
>> Stdout("6").newline;
>>    yetAnotherFunc();
>> Stdout("7").newline;
>> }
>
> Oh ... how many time have I wished there was an IDE command to do that :)

You've just made me feel incredibly stupid. That particular "Why in the 
world did that never occur to me?" kind of stupid. My forehead still hurts 
from the smack. ;)

I'll have to attempt that next time I use an IDE that has programmable 
macros (Visual Studio). Hmm, I wonder if C::B has macros...

> I do this all the time and I've always wondered if other people do that 
> too ... I call it "laying traps" and I found usually it's best to first 
> put not too many Stdouts in there, e.g. one every 4-5 statements if you're 
> not really sure where the error happens. Then you can go in and put some 
> "3a" "3b" and so on to find the exact statement that causes the problem.

Heh, yup. Same thing here. I always think of it like playing that old "HiLo" 
number-guessing game that used to be a staple of learning a new language.

>
> That's, btw, a good reason to put single-line-if/elses into {}s instead of 
> writing them on the same line. Easier to put Stdouts in if you need them.

I find that turning a single-statement if into a {} block when needed is 
trivial enough of a change (almost second-nature) to justify keeping 
single-statement if's in a nice compact {}-less form (unless the clause or 
single-statement is long enough to be broken into multiple lines for 
readability). But I'm really compulsive when it comes to code formatting 
anyway (everything's gotta be "just so" or I can't focus, kinda like that TV 
detective Monk, albiet far less severe ;) ).
May 10, 2008
Re: Error Message useless
Tower  Ty wrote:

> tango.core.Exception.IllegalArgumentException: Argument not valid
> 
> This message from the compiler is just bloody useless
> Where do you go in a 200 line program?
> 
> All I can see is go to each line that might be a cause and comment it out
> ,try to compile it again and if no good do the next one .
> 
> Some lines just can't be done anyway .
> 
> How hard could it be for you experts to add some detail to the error huh
> ??

Do a try catch at global scope and use the member variables of the exception
to print out extra detail.  Tango exceptions include file and line number
as member data.  Maybe someone should submit a ticket for them to add that
info to the default toString method.
May 10, 2008
Re: Error Message useless
On 2008-05-10 06:34:47 +0200, Tower  Ty <towerty@msn.com.au> said:

> Jarrett Billingsley Wrote:
> 
>> "Tower Ty" <tytower@hotmail.com.au> wrote in message
>> news:g02qih$16tn$1@digitalmars.com...
>>> tango.core.Exception.IllegalArgumentException: Argument not valid
>>> 
>>> This message from the compiler is just bloody useless
>>> Where do you go in a 200 line program?
>>> 
>>> All I can see is go to each line that might be a cause and comment it out
>>> ,try to compile it again and if no good do the next one .
>>> 
>>> Some lines just can't be done anyway .
>>> 
>>> How hard could it be for you experts to add some detail to the error huh
>>> ??
>> 
>> Is this a *compiler* error?  Are you *sure*?
>> 
>> Do you get the error when you compile the program or when you run it?
>> 
>> 
> No of course it is a run time error and I'm still looking for it , 
> Jarrett sorry

I recently had to look for a similar error.
I think the easiest thing is to compile everything with -g and use a debugger.

Then put a breackpoint when the exception is created (or in the handler 
to create the stack trace: traceContext in tango):
	genobj.d:916 (gdc)
	genobj.d:910 (dmd)

please not that there is an open bug wrt. this with out of bounds 
exceptions on macintosh and Linux with gdc the stack can get garbled
	http://www.dsource.org/projects/tango/ticket/1094

Fawzi
May 10, 2008
Re: Error Message useless
Nick Sabalausky escribió:
> "Tower Ty" <towerty@msn.com.au> wrote in message 
> news:g038l7$230k$1@digitalmars.com...
>> Jarrett Billingsley Wrote:
>>
>>> "Tower Ty" <tytower@hotmail.com.au> wrote in message
>>> news:g02qih$16tn$1@digitalmars.com...
>>>> tango.core.Exception.IllegalArgumentException: Argument not valid
>>>>
>>>> This message from the compiler is just bloody useless
>>>> Where do you go in a 200 line program?
>>>>
>>>> All I can see is go to each line that might be a cause and comment it 
>>>> out
>>>> ,try to compile it again and if no good do the next one .
>>>>
>>>> Some lines just can't be done anyway .
>>>>
>>>> How hard could it be for you experts to add some detail to the error 
>>>> huh
>>>> ??
>>> Is this a *compiler* error?  Are you *sure*?
>>>
>>> Do you get the error when you compile the program or when you run it?
>>>
>>>
>> No of course it is a run time error and I'm still looking for it , Jarrett 
>> sorry
> 
> Yea, that's kind of a problem with getting uncaught exceptions in the 
> abscence of the stack traces that reflection allows. Be glad it's such a 
> small program.
> 
> What I recommend doing is either step through it in a debugger

I forgot to tell in the release, but Descent now stops execution at the 
point where an uncaught exception is thrown when debugging with ddbg.
« First   ‹ Prev
1 2 3
Top | Discussion index | About this forum | D home