473,396 Members | 1,764 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

BUG Compiler

Hi,

Repro:

Make a call to the Cursor ctor like this.Cursor = new Cursor(GetType(),
"SomeCur.cur");

DO NOT have the following line in the program... using System.Reflection;

Watch the Cursor ctro FAIL yet no compiler warning.

Add the using System.Reflection; reference

Build, again no compiler errror or warning (this time correctly) and call
the Cursor ctor, it succeeds.

Why no compiler warning or error?

Thanks.
Nov 15 '05 #1
10 1217
The line:

using System.Reflection;

Is not actually setting a reference, but rather, it is declaring the
shorthand for a namespace, which is different.

What is the error that you are getting when you call it?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<di********@discussion.microsoft.com> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl...
Hi,

Repro:

Make a call to the Cursor ctor like this.Cursor = new Cursor(GetType(),
"SomeCur.cur");

DO NOT have the following line in the program... using System.Reflection;
Watch the Cursor ctro FAIL yet no compiler warning.

Add the using System.Reflection; reference

Build, again no compiler errror or warning (this time correctly) and call the Cursor ctor, it succeeds.

Why no compiler warning or error?

Thanks.

Nov 15 '05 #2
ArgumentNullException.

Yet it is perfectly correct parameters. Works fine with the using
System.Reflection but craps out without it.

"Nicholas Paldino [.NET/C# MVP]" <mv*@spam.guard.caspershouse.com> wrote in
message news:%2****************@TK2MSFTNGP11.phx.gbl...
The line:

using System.Reflection;

Is not actually setting a reference, but rather, it is declaring the
shorthand for a namespace, which is different.

What is the error that you are getting when you call it?
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<di********@discussion.microsoft.com> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl...
Hi,

Repro:

Make a call to the Cursor ctor like this.Cursor = new Cursor(GetType(), "SomeCur.cur");

DO NOT have the following line in the program... using

System.Reflection;

Watch the Cursor ctro FAIL yet no compiler warning.

Add the using System.Reflection; reference

Build, again no compiler errror or warning (this time correctly) and

call
the Cursor ctor, it succeeds.

Why no compiler warning or error?

Thanks.


Nov 15 '05 #3
<di********@discussion.microsoft.com> wrote:
ArgumentNullException.

Yet it is perfectly correct parameters. Works fine with the using
System.Reflection but craps out without it.


That seems very unlikely to me. Could you post a short but complete
program which demonstrates the problem?

See http://www.pobox.com/~skeet/csharp/complete.html for what I mean.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
Nov 15 '05 #4
why dont you just code what he said numbnuts

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
<di********@discussion.microsoft.com> wrote:
ArgumentNullException.

Yet it is perfectly correct parameters. Works fine with the using
System.Reflection but craps out without it.


That seems very unlikely to me. Could you post a short but complete
program which demonstrates the problem?

See http://www.pobox.com/~skeet/csharp/complete.html for what I mean.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too

Nov 15 '05 #5
IMO this has nothing to do with Reflection, take a look at your call stack,
probably your resource name is different from the one you used to embed the
cursor resource, resuling in a nullreference exception for the (embedded)
stream.

try this:

using System;
using System.Windows.Forms;
using System.Drawing;
namespace HelpCursor
{
class CursorForm : Form
{
static void Main()
{
CursorForm form = new CursorForm();
form.Text = "Hello";
form.BackColor = Color.Blue;
form.Paint += new PaintEventHandler(form.HelloPaintHandler);
Application.Run(form);

}
void HelloPaintHandler(object sender, PaintEventArgs args)
{
CursorForm form = sender as CursorForm;
Graphics grp = args.Graphics;
grp.DrawString("Setting help cursor", form.Font, Brushes.Black, 0, 0);
this.Cursor = new Cursor(GetType(), @"Help.Cur");
}
}
}

compile with : csc /t:winexe cursp1.cs /res:help,HelpCursor.Help.Cur
the help.cur file from the VS distribution(or any other cursor file).
Willy.

<di********@discussion.microsoft.com> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl...
Hi,

Repro:

Make a call to the Cursor ctor like this.Cursor = new Cursor(GetType(),
"SomeCur.cur");

DO NOT have the following line in the program... using System.Reflection;
Watch the Cursor ctro FAIL yet no compiler warning.

Add the using System.Reflection; reference

Build, again no compiler errror or warning (this time correctly) and call the Cursor ctor, it succeeds.

Why no compiler warning or error?

Thanks.

Nov 15 '05 #6
First of all, with your attitude, you don't really deserve a response, but
Jon is likely to code it correctly. If the original poster has coded it
incorrectly, the only way to know is if he posts the code, numbnuts!
"Alvin Bruney" <alvin.bruney@.telia.com.> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
why dont you just code what he said numbnuts

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
<di********@discussion.microsoft.com> wrote:
ArgumentNullException.

Yet it is perfectly correct parameters. Works fine with the using
System.Reflection but craps out without it.


That seems very unlikely to me. Could you post a short but complete
program which demonstrates the problem?

See http://www.pobox.com/~skeet/csharp/complete.html for what I mean.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 15 '05 #7
Temper temper :P
"Pete Davis" <pd******@hotmail.com> wrote in message
news:ce******************************@news.meganet news.com...
First of all, with your attitude, you don't really deserve a response, but
Jon is likely to code it correctly. If the original poster has coded it
incorrectly, the only way to know is if he posts the code, numbnuts!
"Alvin Bruney" <alvin.bruney@.telia.com.> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
why dont you just code what he said numbnuts

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
<di********@discussion.microsoft.com> wrote:
> ArgumentNullException.
>
> Yet it is perfectly correct parameters. Works fine with the using
> System.Reflection but craps out without it.

That seems very unlikely to me. Could you post a short but complete
program which demonstrates the problem?

See http://www.pobox.com/~skeet/csharp/complete.html for what I mean.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too



Nov 15 '05 #8
100
Hi,
I haven't got this particular Cursor constructor working either. I think
there is some problem in the Cursor class.
Actually, I haven't tried hard.
To load a cursor from resource get the cursor resouce as a stream and use
Cursor's constructor which accepts
streams.

I don't see any reason to have "using System.Reflection" line since you
don't use any type defined in this namespace.

HTH
B\rgds
100

<di********@discussion.microsoft.com> wrote in message
news:uu**************@TK2MSFTNGP10.phx.gbl...
Hi,

Repro:

Make a call to the Cursor ctor like this.Cursor = new Cursor(GetType(),
"SomeCur.cur");

DO NOT have the following line in the program... using System.Reflection;
Watch the Cursor ctro FAIL yet no compiler warning.

Add the using System.Reflection; reference

Build, again no compiler errror or warning (this time correctly) and call the Cursor ctor, it succeeds.

Why no compiler warning or error?

Thanks.

Nov 15 '05 #9
You're the fake Alvin Bruney, right, as opposed to the clever one?
Can you keep your email constant so I don't have to keep adding you to my
kill-file?
"Alvin Bruney" <alvin.bruney@.telia.com.> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
why dont you just code what he said numbnuts

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
<di********@discussion.microsoft.com> wrote:
ArgumentNullException.

Yet it is perfectly correct parameters. Works fine with the using
System.Reflection but craps out without it.


That seems very unlikely to me. Could you post a short but complete
program which demonstrates the problem?

See http://www.pobox.com/~skeet/csharp/complete.html for what I mean.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too


Nov 15 '05 #10
Yes sir overlord

whatever you say sir overlord.

3 bags full overlord
"Stu Smith" <st*****@remove.digita.com> wrote in message
news:Ot**************@TK2MSFTNGP11.phx.gbl...
You're the fake Alvin Bruney, right, as opposed to the clever one?
Can you keep your email constant so I don't have to keep adding you to my
kill-file?
"Alvin Bruney" <alvin.bruney@.telia.com.> wrote in message
news:%2***************@tk2msftngp13.phx.gbl...
why dont you just code what he said numbnuts

"Jon Skeet [C# MVP]" <sk***@pobox.com> wrote in message
news:MP************************@msnews.microsoft.c om...
<di********@discussion.microsoft.com> wrote:
> ArgumentNullException.
>
> Yet it is perfectly correct parameters. Works fine with the using
> System.Reflection but craps out without it.

That seems very unlikely to me. Could you post a short but complete
program which demonstrates the problem?

See http://www.pobox.com/~skeet/csharp/complete.html for what I mean.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too



Nov 15 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Jeff Epler | last post by:
Hello. Recently, Generator Comprehensions were mentioned again on python-list. I have written an implementation for the compiler module. To try it out, however, you must be able to rebuild...
13
by: Bryan Parkoff | last post by:
You may notice that switch (...) is much faster than function that can gain a big improved performance because it only use JMP instruction however function is required to use CALL, PUSH, and POP...
10
by: Bjorn | last post by:
I'm using interfaces in C++ by declaring classes with only pure virtual methods. If then someone wants to implement the interface they needs to inherit from the class. If the implementing class...
7
by: Tao Wang | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi, I saw cuj's conformance roundup, but the result is quite old. I think many people like me want to know newer c++ standard conformance test...
14
by: joshc | last post by:
I'm writing some C to be used in an embedded environment and the code needs to be optimized. I have a question about optimizing compilers in general. I'm using GCC for the workstation and Diab...
16
by: pj | last post by:
(Was originally, probably wrongly, posted to the vc subgroup.) (This doesn't appear to be a c# problem, but a problem with a bug in the Visual Studio c# compiler, but, any help will be welcome...)...
0
by: rollasoc | last post by:
Hi, I seem to be getting a compiler error Internal Compiler Error (0xc0000005 at address 535DB439): likely culprit is 'BIND'. An internal error has occurred in the compiler. To work around...
3
by: Mark Rockman | last post by:
------ Build started: Project: USDAver2, Configuration: Debug .NET ------ Preparing resources... Updating references... Performing main compilation... error CS0583: Internal Compiler Error...
6
by: toton | last post by:
Hi, Anyone have a link to comparative study of different C++ compilers and how much they conform to C++ language standard? Most of the big platforms I know have GCC which well supports C++...
41
by: Miroslaw Makowiecki | last post by:
Where can I download Comeau compiler as a trial version? Thanks in advice.
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.