By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,213 Members | 2,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,213 IT Pros & Developers. It's quick & easy.

[Question/Feature request]User defined warning for experimential/incomplete functions

P: n/a
Hello,

As a programmer, I'm sure many of you have written libraries to do many
of the repeatative tasks, and possibly sharing them with other team members.

In my case, I have about a dozen functions in hand that are either "not
completely tested" or simply "half done", while another half-dozen functions
that'll require another one or two more functions in order to run correctly.

Currently, I've marked these functions with XML comments so they
"should" notice them as intellisense pop up. But it happens that sometimes
they simply didn't notice them. So is there any sort of compiler directives
that'll allow me to show warnings "only if the properties/methods is being
used". The #error and #warning simply doesn't work as they show warnings and
errors when the class is included in the project even if these possibly
problematic properties/methods are not used.

--
If you want to mail to me, please replace all instance of "e" to "a" in my
email address. Thank you.
Sorry for any inconvience caused, but there's many spam-mailers.
Nov 17 '05 #1
Share this Question
Share on Google+
8 Replies


P: n/a
Where exactly do you want to notify the users of the methods/properties?
Let's assume that they use a certain property that they shouldn't use how do
you want to warn them exactly? During runtime? During compilation of their
code?

Gabriel Lozano-Mor醤

"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
Hello,

As a programmer, I'm sure many of you have written libraries to do many
of the repeatative tasks, and possibly sharing them with other team
members.

In my case, I have about a dozen functions in hand that are either "not
completely tested" or simply "half done", while another half-dozen
functions that'll require another one or two more functions in order to
run correctly.

Currently, I've marked these functions with XML comments so they
"should" notice them as intellisense pop up. But it happens that sometimes
they simply didn't notice them. So is there any sort of compiler
directives that'll allow me to show warnings "only if the
properties/methods is being used". The #error and #warning simply doesn't
work as they show warnings and errors when the class is included in the
project even if these possibly problematic properties/methods are not
used.

--
If you want to mail to me, please replace all instance of "e" to "a" in my
email address. Thank you.
Sorry for any inconvience caused, but there's many spam-mailers.

Nov 17 '05 #2

P: n/a
I believe there is an attribute that specifies to a compiler that a member is outdated. I think the compiler shows a warning if the
member is referenced. This may server your purpose.

I'll try to look it up for you now...

System.ObsoleteAttribute: Marks the program elements that are no longer in use. (Or in your case, were never in use)

Hope it helps :)

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Gabriel Lozano-Mor醤" <ga************@no-spam.com> wrote in message news:Om**************@TK2MSFTNGP10.phx.gbl...
Where exactly do you want to notify the users of the methods/properties? Let's assume that they use a certain property that they
shouldn't use how do you want to warn them exactly? During runtime? During compilation of their code?

Gabriel Lozano-Mor醤

"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message news:uv**************@TK2MSFTNGP09.phx.gbl...
Hello,

As a programmer, I'm sure many of you have written libraries to do many of the repeatative tasks, and possibly sharing them
with other team members.

In my case, I have about a dozen functions in hand that are either "not completely tested" or simply "half done", while
another half-dozen functions that'll require another one or two more functions in order to run correctly.

Currently, I've marked these functions with XML comments so they "should" notice them as intellisense pop up. But it happens
that sometimes they simply didn't notice them. So is there any sort of compiler directives that'll allow me to show warnings
"only if the properties/methods is being used". The #error and #warning simply doesn't work as they show warnings and errors when
the class is included in the project even if these possibly problematic properties/methods are not used.

--
If you want to mail to me, please replace all instance of "e" to "a" in my
email address. Thank you.
Sorry for any inconvience caused, but there's many spam-mailers.


Nov 17 '05 #3

P: n/a
BTW, I just realized that it's not a sealed class.. i.e., you can inherit from it. Try making a custom attribute called
"CompilerWarning : ObsoleteAttribute" and see if it works :)

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Gabriel Lozano-Mor醤" <ga************@no-spam.com> wrote in message news:Om**************@TK2MSFTNGP10.phx.gbl...
Where exactly do you want to notify the users of the methods/properties? Let's assume that they use a certain property that they
shouldn't use how do you want to warn them exactly? During runtime? During compilation of their code?

Gabriel Lozano-Mor醤

"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message news:uv**************@TK2MSFTNGP09.phx.gbl...
Hello,

As a programmer, I'm sure many of you have written libraries to do many of the repeatative tasks, and possibly sharing them
with other team members.

In my case, I have about a dozen functions in hand that are either "not completely tested" or simply "half done", while
another half-dozen functions that'll require another one or two more functions in order to run correctly.

Currently, I've marked these functions with XML comments so they "should" notice them as intellisense pop up. But it happens
that sometimes they simply didn't notice them. So is there any sort of compiler directives that'll allow me to show warnings
"only if the properties/methods is being used". The #error and #warning simply doesn't work as they show warnings and errors when
the class is included in the project even if these possibly problematic properties/methods are not used.

--
If you want to mail to me, please replace all instance of "e" to "a" in my
email address. Thank you.
Sorry for any inconvience caused, but there's many spam-mailers.


Nov 17 '05 #4

P: n/a
"Gabriel Lozano-Mor醤" <ga************@no-spam.com> 级糶秎ン穝籇:Om**************@TK2MSFTNGP10.phx.g bl...
Where exactly do you want to notify the users of the methods/properties? My throught would be something like compiler directives, or as Dave suggest,
a n attribute I can set to the function.
Let's assume that they use a certain property that they shouldn't use how
do you want to warn them exactly? During runtime? During compilation of
their code? During compilation is the best as my teammates will surely not miss them. If
it's in runtime, it'll be too late as the function maybe shipped to the
clients.

Btw, if I need runtime notification I think it wouldn't be too difficult to
include a MessageBox popup for the function.

Gabriel Lozano-Mor醤

"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
Hello,

As a programmer, I'm sure many of you have written libraries to do
many of the repeatative tasks, and possibly sharing them with other team
members.

In my case, I have about a dozen functions in hand that are either
"not completely tested" or simply "half done", while another half-dozen
functions that'll require another one or two more functions in order to
run correctly.

Currently, I've marked these functions with XML comments so they
"should" notice them as intellisense pop up. But it happens that
sometimes they simply didn't notice them. So is there any sort of
compiler directives that'll allow me to show warnings "only if the
properties/methods is being used". The #error and #warning simply doesn't
work as they show warnings and errors when the class is included in the
project even if these possibly problematic properties/methods are not
used.

--
If you want to mail to me, please replace all instance of "e" to "a" in
my
email address. Thank you.
Sorry for any inconvience caused, but there's many spam-mailers.


Nov 17 '05 #5

P: n/a
Thanks for your suggestion... but my MSDN library say that it's a sealed
class......

Anyway perheps I can use it directly for now then tell my teammates to be
caution when they see something funny in the compiler output... <g>

"Dave" <NO*********@dotcomdatasolutions.com> 级糶秎ン穝籇:OP**************@TK2MSFTNGP09.phx.g bl...
BTW, I just realized that it's not a sealed class.. i.e., you can inherit
from it. Try making a custom attribute called "CompilerWarning :
ObsoleteAttribute" and see if it works :)

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Gabriel Lozano-Mor醤" <ga************@no-spam.com> wrote in message
news:Om**************@TK2MSFTNGP10.phx.gbl...
Where exactly do you want to notify the users of the methods/properties?
Let's assume that they use a certain property that they shouldn't use how
do you want to warn them exactly? During runtime? During compilation of
their code?

Gabriel Lozano-Mor醤

"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
Hello,

As a programmer, I'm sure many of you have written libraries to do
many of the repeatative tasks, and possibly sharing them with other team
members.

In my case, I have about a dozen functions in hand that are either
"not completely tested" or simply "half done", while another half-dozen
functions that'll require another one or two more functions in order to
run correctly.

Currently, I've marked these functions with XML comments so they
"should" notice them as intellisense pop up. But it happens that
sometimes they simply didn't notice them. So is there any sort of
compiler directives that'll allow me to show warnings "only if the
properties/methods is being used". The #error and #warning simply
doesn't work as they show warnings and errors when the class is included
in the project even if these possibly problematic properties/methods are
not used.

--
If you want to mail to me, please replace all instance of "e" to "a" in
my
email address. Thank you.
Sorry for any inconvience caused, but there's many spam-mailers.



Nov 17 '05 #6

P: n/a
Sorry, you are correct -- it is sealed.

However, you can declare it as such:
[ObsoleteAttribute("Untested code... Use at your own risk!")]
or...
[ObsoleteAttribute("Untested code... Sorry, can't use it yet!", true)]

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message news:Oa*************@TK2MSFTNGP12.phx.gbl...
Thanks for your suggestion... but my MSDN library say that it's a sealed class......

Anyway perheps I can use it directly for now then tell my teammates to be caution when they see something funny in the compiler
output... <g>

"Dave" <NO*********@dotcomdatasolutions.com> 级糶秎ン穝籇:OP**************@TK2MSFTNGP09.phx.g bl...
BTW, I just realized that it's not a sealed class.. i.e., you can inherit from it. Try making a custom attribute called
"CompilerWarning : ObsoleteAttribute" and see if it works :)

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Gabriel Lozano-Mor醤" <ga************@no-spam.com> wrote in message news:Om**************@TK2MSFTNGP10.phx.gbl...
Where exactly do you want to notify the users of the methods/properties? Let's assume that they use a certain property that they
shouldn't use how do you want to warn them exactly? During runtime? During compilation of their code?

Gabriel Lozano-Mor醤

"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message news:uv**************@TK2MSFTNGP09.phx.gbl...
Hello,

As a programmer, I'm sure many of you have written libraries to do many of the repeatative tasks, and possibly sharing them
with other team members.

In my case, I have about a dozen functions in hand that are either "not completely tested" or simply "half done", while
another half-dozen functions that'll require another one or two more functions in order to run correctly.

Currently, I've marked these functions with XML comments so they "should" notice them as intellisense pop up. But it happens
that sometimes they simply didn't notice them. So is there any sort of compiler directives that'll allow me to show warnings
"only if the properties/methods is being used". The #error and #warning simply doesn't work as they show warnings and errors
when the class is included in the project even if these possibly problematic properties/methods are not used.

--
If you want to mail to me, please replace all instance of "e" to "a" in my
email address. Thank you.
Sorry for any inconvience caused, but there's many spam-mailers.



Nov 17 '05 #7

P: n/a
It works, but the result is not so obvious. - If the compiler window is set
to too small, the person who compile it may just see the "X success, Y
failure, Z skipped" message and ignore the warning, but it's better anyway.

Still thinking if I can attempt to make the message morre obvious...

"Dave" <NO*********@dotcomdatasolutions.com> 级糶秎ン穝籇:ee**************@TK2MSFTNGP10.phx.g bl...
Sorry, you are correct -- it is sealed.

However, you can declare it as such:
[ObsoleteAttribute("Untested code... Use at your own risk!")]
or...
[ObsoleteAttribute("Untested code... Sorry, can't use it yet!", true)]

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message
news:Oa*************@TK2MSFTNGP12.phx.gbl...
Thanks for your suggestion... but my MSDN library say that it's a sealed
class......

Anyway perheps I can use it directly for now then tell my teammates to be
caution when they see something funny in the compiler output... <g>

"Dave" <NO*********@dotcomdatasolutions.com> 级糶秎ン穝籇:OP**************@TK2MSFTNGP09.phx.g bl...
BTW, I just realized that it's not a sealed class.. i.e., you can
inherit from it. Try making a custom attribute called "CompilerWarning
: ObsoleteAttribute" and see if it works :)

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Gabriel Lozano-Mor醤" <ga************@no-spam.com> wrote in message
news:Om**************@TK2MSFTNGP10.phx.gbl...
Where exactly do you want to notify the users of the
methods/properties? Let's assume that they use a certain property that
they shouldn't use how do you want to warn them exactly? During
runtime? During compilation of their code?

Gabriel Lozano-Mor醤

"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message
news:uv**************@TK2MSFTNGP09.phx.gbl...
> Hello,
>
> As a programmer, I'm sure many of you have written libraries to do
> many of the repeatative tasks, and possibly sharing them with other
> team members.
>
> In my case, I have about a dozen functions in hand that are either
> "not completely tested" or simply "half done", while another
> half-dozen functions that'll require another one or two more functions
> in order to run correctly.
>
> Currently, I've marked these functions with XML comments so they
> "should" notice them as intellisense pop up. But it happens that
> sometimes they simply didn't notice them. So is there any sort of
> compiler directives that'll allow me to show warnings "only if the
> properties/methods is being used". The #error and #warning simply
> doesn't work as they show warnings and errors when the class is
> included in the project even if these possibly problematic
> properties/methods are not used.
>
> --
> If you want to mail to me, please replace all instance of "e" to "a"
> in my
> email address. Thank you.
> Sorry for any inconvience caused, but there's many spam-mailers.
>
>



Nov 17 '05 #8

P: n/a
You can create an add-in for VS.NET that subscribes to one of the build events on a project or solution level. Upon completion of a
build you can browse the current tasks list for your message, and if there are one or more popup a MessageBox, using VS.NET as an
owner, to alert the user that they must check their Task List.

-- Just an idea.

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message news:ur*************@TK2MSFTNGP09.phx.gbl...
It works, but the result is not so obvious. - If the compiler window is set to too small, the person who compile it may just see
the "X success, Y failure, Z skipped" message and ignore the warning, but it's better anyway.

Still thinking if I can attempt to make the message morre obvious...

"Dave" <NO*********@dotcomdatasolutions.com> 级糶秎ン穝籇:ee**************@TK2MSFTNGP10.phx.g bl...
Sorry, you are correct -- it is sealed.

However, you can declare it as such:
[ObsoleteAttribute("Untested code... Use at your own risk!")]
or...
[ObsoleteAttribute("Untested code... Sorry, can't use it yet!", true)]

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message news:Oa*************@TK2MSFTNGP12.phx.gbl...
Thanks for your suggestion... but my MSDN library say that it's a sealed class......

Anyway perheps I can use it directly for now then tell my teammates to be caution when they see something funny in the compiler
output... <g>

"Dave" <NO*********@dotcomdatasolutions.com> 级糶秎ン穝籇:OP**************@TK2MSFTNGP09.phx.g bl...
BTW, I just realized that it's not a sealed class.. i.e., you can inherit from it. Try making a custom attribute called
"CompilerWarning : ObsoleteAttribute" and see if it works :)

--
Dave Sexton
dave@www..jwaonline..com
-----------------------------------------------------------------------
"Gabriel Lozano-Mor醤" <ga************@no-spam.com> wrote in message news:Om**************@TK2MSFTNGP10.phx.gbl...
> Where exactly do you want to notify the users of the methods/properties? Let's assume that they use a certain property that
> they shouldn't use how do you want to warn them exactly? During runtime? During compilation of their code?
>
> Gabriel Lozano-Mor醤
>
> "Lau Lei Cheong" <le****@yehoo.com.hk> wrote in message news:uv**************@TK2MSFTNGP09.phx.gbl...
>> Hello,
>>
>> As a programmer, I'm sure many of you have written libraries to do many of the repeatative tasks, and possibly sharing
>> them with other team members.
>>
>> In my case, I have about a dozen functions in hand that are either "not completely tested" or simply "half done", while
>> another half-dozen functions that'll require another one or two more functions in order to run correctly.
>>
>> Currently, I've marked these functions with XML comments so they "should" notice them as intellisense pop up. But it
>> happens that sometimes they simply didn't notice them. So is there any sort of compiler directives that'll allow me to show
>> warnings "only if the properties/methods is being used". The #error and #warning simply doesn't work as they show warnings
>> and errors when the class is included in the project even if these possibly problematic properties/methods are not used.
>>
>> --
>> If you want to mail to me, please replace all instance of "e" to "a" in my
>> email address. Thank you.
>> Sorry for any inconvience caused, but there's many spam-mailers.
>>
>>
>
>



Nov 17 '05 #9

This discussion thread is closed

Replies have been disabled for this discussion.