Hi,
During compilation, a C# project in my solution triggers the following
warning:
"warning CS0168: The variable 'ex' is declared but never used"
To trigger this warning, it appears the C# compiler WarningLevel needs to be
3 or above.
In the same solution, I also have a VB project, however Help document
ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vxlrfvslangprojprojectconfigurationpropertieswarni nglevel.htm
says VB maximum WarningLevel is 1.
Is there a workaround? or
Does anyone know of an addin or tool to help me identify declared but unused
variables in my VB.NET code?
Thanks
Harry 9 2317
Remove the variable. If its never used, why have it in ?, I note that the
vairable is 'ex', if this is an exception in a try catch block, then either
put some implementation in there to stop the message or remove the try catch
completely as it is serving no purpose.
--
OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me
Time flies when you don't know what you're doing
"harry" <harry@nospam> wrote in message
news:ui**************@TK2MSFTNGP12.phx.gbl... Hi,
During compilation, a C# project in my solution triggers the following warning:
"warning CS0168: The variable 'ex' is declared but never used"
To trigger this warning, it appears the C# compiler WarningLevel needs to
be 3 or above.
In the same solution, I also have a VB project, however Help document
ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vxlrfvslangprojprojectconfigurationpr
opertieswarninglevel.htm says VB maximum WarningLevel is 1.
Is there a workaround? or Does anyone know of an addin or tool to help me identify declared but
unused variables in my VB.NET code?
Thanks Harry
Hi,
Assuming I understood your question correctly: changing the warning level of
a Visual Basic .NET project will not affect C# Project warning level. So,
change the warning level of the C# project to something less than 3 to avoid
this warning.
With respect to the addins to detect unused variables, the tool Total .NET
analyzer ( www.fmsinc.com) does that check (in addition to other code
checks).
HTH
"harry" <harry@nospam> wrote in message
news:ui**************@TK2MSFTNGP12.phx.gbl...
Hi,
During compilation, a C# project in my solution triggers the following
warning:
"warning CS0168: The variable 'ex' is declared but never used"
To trigger this warning, it appears the C# compiler WarningLevel needs to be
3 or above.
In the same solution, I also have a VB project, however Help document
ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vxlrfvslangprojprojectconfigurationpr
opertieswarninglevel.htm
says VB maximum WarningLevel is 1.
Is there a workaround? or
Does anyone know of an addin or tool to help me identify declared but unused
variables in my VB.NET code?
Thanks
Harry
> Remove the variable. If its never used, why have it in ?,
LOL
Hi Harry
I'm not sure how my colleagues here have come to misunderstand your
question, but for everyone perhaps I can provide my own interpretation:
You have a program containing both C# and VB.NET code. The C# compiler
helpfully tells you of variables that are declared but not used, so that you
can remove them. The VB.NET compiler is not so helpful.
I'm sure you would remove the unused variables, if the compiler would be so
good as to tell you where they are ;-)
The de facto standard (perhaps because it is free) seems to FxCop, at http://www.gotdotnet.com/team/fxcop/
HTH
Charles
"harry" <harry@nospam> wrote in message
news:ui**************@TK2MSFTNGP12.phx.gbl... Hi,
During compilation, a C# project in my solution triggers the following warning:
"warning CS0168: The variable 'ex' is declared but never used"
To trigger this warning, it appears the C# compiler WarningLevel needs to be 3 or above.
In the same solution, I also have a VB project, however Help document ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vxlrfvslangprojprojectconfigurationpropertieswarni nglevel.htm says VB maximum WarningLevel is 1.
Is there a workaround? or Does anyone know of an addin or tool to help me identify declared but unused variables in my VB.NET code?
Thanks Harry
> The de facto standard (perhaps because it is free) seems to FxCop, at http://www.gotdotnet.com/team/fxcop/
Hi Charles,
It is freely available, but it is a product in one sense: it has a dedicated
team of individuals within Microsoft who do nothing else but work on this
product. Microsoft isn't just being generous. They use FxCop internally to
perform static analysis of their own code before releasing it to the general
public.
--- N
* "harry" <harry@nospam> scripsit: During compilation, a C# project in my solution triggers the following warning:
"warning CS0168: The variable 'ex' is declared but never used"
To trigger this warning, it appears the C# compiler WarningLevel needs to be 3 or above.
In the same solution, I also have a VB project, however Help document ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vxlrfvslangprojprojectconfigurationpropertieswarni nglevel.htm says VB maximum WarningLevel is 1.
AFAIK, VB.NET currently doesn't detect these variables. I remember that
there will be a warning in VB 2005.
--
M S Herfried K. Wagner
M V P <URL:http://dotnet.mvps.org/>
V B <URL:http://dotnet.mvps.org/dotnet/faqs/>
Thank you Charles.
"Charles Law" <bl***@nowhere.com> wrote in message
news:uv**************@tk2msftngp13.phx.gbl... Hi Harry
I'm not sure how my colleagues here have come to misunderstand your question, but for everyone perhaps I can provide my own interpretation:
You have a program containing both C# and VB.NET code. The C# compiler helpfully tells you of variables that are declared but not used, so that you can remove them. The VB.NET compiler is not so helpful.
I'm sure you would remove the unused variables, if the compiler would be so good as to tell you where they are ;-)
The de facto standard (perhaps because it is free) seems to FxCop, at
http://www.gotdotnet.com/team/fxcop/
HTH
Charles
"harry" <harry@nospam> wrote in message news:ui**************@TK2MSFTNGP12.phx.gbl... Hi,
During compilation, a C# project in my solution triggers the following warning:
"warning CS0168: The variable 'ex' is declared but never used"
To trigger this warning, it appears the C# compiler WarningLevel needs to be 3 or above.
In the same solution, I also have a VB project, however Help document ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vxlrfvslangprojprojectconfigurationpropertieswarni nglevel.htm says VB maximum WarningLevel is 1.
Is there a workaround? or Does anyone know of an addin or tool to help me identify declared but unused variables in my VB.NET code?
Thanks Harry
OHM,
You can also have just the Catch without a variable defined.
Try
SomethingNew()
Catch
' I really don't want to do any thing here
' Yet I don't want others to know that
' SomethingNew failed
End Try
Hope this helps
Jay
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in message
news:%2***************@TK2MSFTNGP14.phx.gbl... Remove the variable. If its never used, why have it in ?, I note that the vairable is 'ex', if this is an exception in a try catch block, then either put some implementation in there to stop the message or remove the try catch completely as it is serving no purpose.
--
OHM ( Terry Burns ) . . . One-Handed-Man . . . If U Need My Email ,Ask Me
Time flies when you don't know what you're doing
"harry" <harry@nospam> wrote in message news:ui**************@TK2MSFTNGP12.phx.gbl... Hi,
During compilation, a C# project in my solution triggers the following warning:
"warning CS0168: The variable 'ex' is declared but never used"
To trigger this warning, it appears the C# compiler WarningLevel needs to be 3 or above.
In the same solution, I also have a VB project, however Help document ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vxlrfvslangprojprojectconfigurationpr opertieswarninglevel.htm says VB maximum WarningLevel is 1.
Is there a workaround? or Does anyone know of an addin or tool to help me identify declared but unused variables in my VB.NET code?
Thanks Harry
Do you know, I never tried that construct configuration before, as I have
allways implemented the handling, interesting to know though.
Thanks
OHM ( Terry Burns )
. . . One-Handed-Man . . .
If U Need My Email ,Ask Me
Time flies when you don't know what you're doing
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> wrote in message
news:Om*************@tk2msftngp13.phx.gbl... OHM, You can also have just the Catch without a variable defined.
Try SomethingNew() Catch ' I really don't want to do any thing here ' Yet I don't want others to know that ' SomethingNew failed End Try
Hope this helps Jay
"One Handed Man ( OHM - Terry Burns )" <news.microsoft.com> wrote in
message news:%2***************@TK2MSFTNGP14.phx.gbl... Remove the variable. If its never used, why have it in ?, I note that
the vairable is 'ex', if this is an exception in a try catch block, then either put some implementation in there to stop the message or remove the try catch completely as it is serving no purpose.
--
OHM ( Terry Burns ) . . . One-Handed-Man . . . If U Need My Email ,Ask Me
Time flies when you don't know what you're doing
"harry" <harry@nospam> wrote in message news:ui**************@TK2MSFTNGP12.phx.gbl... Hi,
During compilation, a C# project in my solution triggers the following warning:
"warning CS0168: The variable 'ex' is declared but never used"
To trigger this warning, it appears the C# compiler WarningLevel needs
to be 3 or above.
In the same solution, I also have a VB project, however Help document
ms-help://MS.VSCC/MS.MSDNVS/vbcon/html/vxlrfvslangprojprojectconfigurationpr opertieswarninglevel.htm says VB maximum WarningLevel is 1.
Is there a workaround? or Does anyone know of an addin or tool to help me identify declared but unused variables in my VB.NET code?
Thanks Harry
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: harry |
last post by:
Hi,
During compilation, a C# project in my solution triggers the following
warning:
"warning CS0168: The variable 'ex' is declared but never used"
To trigger this warning, it appears the C#...
|
by: Dave Hansen |
last post by:
Please note crosspost.
Often when writing code requiring function pointers, it is necessary
to write functions that ignore their formal parameters. For example,
a state machine function might...
|
by: ~~~ .NET Ed ~~~ |
last post by:
It is not the first time I see this happen. I am using VS.NET 2003 with .NET
Framework 1.1. In this particular situation I have a custom user control in
a windows form. There is a member variable...
|
by: Pierre |
last post by:
Hello,
In an aspx page (mypage.aspx) from a web projet,
I would like to get the value of a variable of the projet that is declared
as public in a module.
The variable can be called from...
|
by: What-A-Tool |
last post by:
In the following code, "catch" is underlined in blue, and the error "the
variable fx is declared but never used" is displayed when I mouse hover over
it.
Am I doing something wrong, or do I just...
|
by: Yansky |
last post by:
If I have the following code:
var abc;
if(!abc){
alert('test');
}
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome former...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
| |