|
misha1983 wrote: what publicly available tools like that are out there?
I don't know of any.
In fact I opened an FR with MS that would have the XML documentation created include any exceptions thrown inside the documented method, just to be sure that they get into the documentation.
My Blog[^] FFRF[^]
-- modified at 10:33 Friday 14th July, 2006
|
|
|
|
|
Static code analyzers like Reflector (it has a very good API but nearly no docu) can do this to a certain degree. You will never get 100% coverage since today software is plugable/configurable. There is no way to find out what module you did configure into you software. But for a good overview if some big holes are missed static code analyzers (FXCop should also be able to do this to a certain extent) they are surely useful.
Yours,
Alois Kraus
|
|
|
|
|
misha1983 wrote: Can someone cast light on why are exceptions being handled this way in .NET? What are the advantages of treating all exceptions as run-time exceptions?
I would say that the checked exceptions in Java are still run-time exceptions (they get thrown at run-time, not at compile time) it is just that Java has the ability to explicitly declare which exceptions a method will throw as part of the method signature and the compiler just ensures they are either caught or become part of the signature of the calling method.
I would say that the best discipline would be to ensure that, when you document the code, you define which exceptions a method will throw in the documentation. Intellisence in Visual Studio will read the XML documentation and generate appropriate tool tips while you are typing the method name to remind you that exceptions are thrown.
misha1983 wrote: Is it something that you just learn to deal with as a .NET developer? How do you deal with it?
I've never really thought about it before. I was a C++ developer since 1992 before .NET came along and it never had checked exceptions either. In fact, in C++ you could throw any object you liked as an exception - which is probably a worse situation.
Scottish Developers events:
* .NET debugging, tracing and instrumentation by Duncan Edwards Jones and Code Coverage in .NET by Craig Murphy
* Developer Day Scotland: are you interested in speaking or attending?
My: Website | Blog
|
|
|
|
|
Colin Angus Mackay wrote: it never had checked exceptions either.
C++ does have exception specifications with the same syntax. An exception specification in C++ provides a solution that can be used to list the exceptions a function may throw with the function declaration, but it does not force the caller to write code to catch the listed exceptions. I like the C++ way
Best,
Jun
|
|
|
|
|
Apart from Anders's article at Artima there has been lots of discussion about this (and research) elsewhere on the web. The general consensus seems to be that checked exceptions seem like a good idea at first, but not such a good idea eventually!
However, Spec#, MS's research language, which is a C# superset, does have checked exceptions and I think they provide a rationale for this, given the extra features of Spec#! So maybe some form of them may be rolled back into C#! Confusing, eh?
Kevin
|
|
|
|
|
Hi,
Iam new to .Net programming and this problem is keeping me ideal for last few days.
I like to read the Roles list from the configuration file for a particular form to control the visibility of the web controls.
My web.Config has authorisation like this:
<location path="iApprove/Doctor">
<system.web>
<authorization>
<allow roles="Doctor, ID Specialist, MHS - Guidance Doctor, MHS - Guidance Authorised Approver" />
<deny users="*"></deny>
</authorization>
</system.web>
</location>
But inside that locatiion i have many forms and in one form i need to make few fields invisible for roles Doctors alone.
How can i achieve this? if it is not possible by reading configuration file then please give me some other way of doing it.
Am using .Net 1.1.
I am looking forward some help.
Thanks
Renu
|
|
|
|
|
Hi
U can use the session variable. When use logs in , set the role of that user in session variable. While displaying the forms, check the value of session variable & display appropriate controls
Regards
Manish
|
|
|
|
|
Hi Manish,
Thank you so much for your time.
Actually there is another thing i need to consider. I will explain the situation with example:
A user may be under more than one user group and each group has different functionality.
User1 is under Role1 and Role2
User2 is only under Role2
The specified location can have access by both role1 and role2, but user from only role2 cannot have access to few fields in a page.
So far am having user's role saved in FormAuthenticationTicket as DataUser and i need to check their Roles list with the list specified under the configuration <location> tag to make sure the user is only under role2 to invisible the fields.
I hope it explains well. Now is it possible reading config file's <location>? if so, please tell me how. If not could you please give me few other suggestion to achieve it?
Expecting reply...
Thanks
Renu
|
|
|
|
|
In the ASP.NET 1.0 framework, the Page class has a "User" property. That property has an "IsInRole" method which returns a Boolean value indicating if the logged in user is in the given role. This could be used to set the visibility of your fields:
myControl.Visible = this.User.IsInRole("Doctor");
Jim Conigliaro
jconigliaro@ieee.org
|
|
|
|
|
If I write a program, say in C#, to read and write to a serial port and use the SerialPort class in .NET 2.0, will this program be compatible with machines still using .NET framework 1.1?
|
|
|
|
|
No. To use any 2.0 classes you need the 2.0 framework.
|
|
|
|
|
So if I developed it on a machine using .NET 2.0, compiled it, and moved the EXE to a computer with .NET 1.1, it would fail?
|
|
|
|
|
|
ok, good to know, thank you.
|
|
|
|
|
I think the serial port classes were new in 2.0 so they wouldn't even be in 1.1.
|
|
|
|
|
They aren't. MS published a net1.1 beta version of them on a code site with a non commercial use only license, but otherwise you can't use them without .net 2.0.
|
|
|
|
|
How can i access web services from .net cf. I added the references properly.still it says "unable to connect to remote server". what is giong wrong ? do i need to do some emulator settings?
|
|
|
|
|
You haven't said which versions of the Framework or which OS you're using. .NET Compact Framework 1.0 did not establish a network connection for you; CF 2.0 does, when using HttpWebRequest and web services, on Windows Mobile (2003 or 5.0). The exact behaviour depends on the URL you're using and the configuration of the unit. Generally speaking, the Connection Manager treats any URL with a dot in the host portion as being an Internet URL while URLs with no dot are considered to be Work URLs.
If you have a network card and its media is connected - associated for wireless network cards - then it will be used, if the setting at the top of the Wireless Network/Network Cards control panel (Start, Settings, Connection, Network Cards but some devices have Wireless Network) labelled 'My network card connects to' matches the URL. Otherwise, the Connection Manager will use any modem or cell network data connections set up in the Connections control panel. If required to connect to Work it may use a VPN connection if you configure one.
If you are currently connected to ActiveSync and ActiveSync's 'This computer is connected to' setting (in Connection Settings) matches the URL, Connection Manager will try to use the desktop pass-through. This does not work for all protocols.
Finally, Windows Mobile 5.0 disables all network connections - disconnecting from modems and cell data networks, and disabling network cards - when connected to ActiveSync. This was apparently a feature requested by some corporate customers and phone networks. There's no way to switch this off (that I have yet discovered).
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
I used SetupDiEnumDeviceInterfaces to loop hDevInfo list and found 4 items with guid : GUID_DEVINTERFACE_VOLUME
But SetupDiGetDeviceInterfaceDetail returns error: "1421 Control ID not found" for each device information set.
What's the cause??
|
|
|
|
|
hello friends i m converting vc .net 2003 project into vc 2005 (vc7).
i open my proj in vc2005 and then compile . i m getting following error in header file atlmisc.h file.
c:\program files\microsoft visual studio 8\vc\include\atlmisc.h(1159) : error C2440: 'return' : cannot convert from 'const wchar_t *' to 'TCHAR *'
can someone help me......
Harish
|
|
|
|
|
atlmisc.h is from the Windows Template Library. Further help is really only possible if you tell us which version of WTL you're using.
Also, this is a native C++ programming question. This board is for questions relating to the .NET Framework: the CLR, the base class library, and Windows Forms. Try asking here[^].
I suspect your problem may be that UNICODE is not defined or that you have a mismatch between the definition of UNICODE and _UNICODE .
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|
|
Hi!
I am doing a windows desktop application. I have a tab control which is aligned on thr gith, meaning that the tabs for the tab pages are displayed on the right. It is working fine. But when I added the "Application.EnableVisualStyle();", the titles for the tabs are not displayed anymore. They will display again if the alignment is Top or Bottom. But I really need to place them on the right since that is what is required of me.
Help anyone?
Regards,
Aldrich
|
|
|
|
|
It's a bug. If you add .manifest file to any application, wich contains control with right tabs, you'll see the same picture sigh:
My english is bad. Please, correct my errors.
Best regards, Alexey.
|
|
|
|
|
aww.. ok. I guess I won't be able to use the XP style for my desktop application..
Thanks!
Your english isn't bad. It's very understandable. My English is not very good too, but as long as it is understandable, then I guess it's ok. Practice makes perfect! hehe!
Regards,
Aldrich
|
|
|
|
|
Aldrich Caw wrote: ok. I guess I won't be able to use the XP style for my desktop application..
Don't give up, you can draw tab text yourself.
My english is bad. Please, correct my errors.
Best regards, Alexey.
|
|
|
|