Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > .NET General

Vista - Adding Exception namespace to LINQ DAL

Reply
 
Old 05-14-2008   #1 (permalink)
Alexander Wykel


 
 

Adding Exception namespace to LINQ DAL

I recently raninto major problems when I added the Exception namespace to the
Project which has my DBML file attached to it. Once I renamed all the
Exceptions instances to Syste.Exception the project would not recoginize any
assembly which had been added to the project, even know they were all there,
this happened to the designer.cs file that is attached to the dbml file. I
have no clue as to why this is the problem.

--
Alexander L. Wykel
AW Software Works


My System SpecsSystem Spec
Old 05-15-2008   #2 (permalink)
Jialiang Ge [MSFT]


 
 

RE: Adding Exception namespace to LINQ DAL

Hello Alexander,

First off, I am sorry if these major problems turn out to be caused by
Microsoft products.

I am trying to reproduce the issue that the assemblies cannot be recognized
by Visual Studio even if they were all there. But I am stuck by the step
"adding the Exception namespace to the project". In .NET framework class
library, there is no System.Exception namespace. Is the "Exception"
namespace defined by your own code? If that, when we change it to
System.Exception, we may get an compilation error "'Excpetion' is a
'namespace' but is used like a 'type'" from a code line like 'Exception e =
new Exception("");". This is because "System.Exception" is a class and
"Exception" can also be regarded as a namespace in this case. The
resolution is to explicitly specify the namespace "System" when we use
"Exception". For example, "System.Exception e = new System.Exception("");
". If I misunderstand you question, please let me know more detailed
repro-steps or send an example project to my mailbox jialge@xxxxxx
so that I can have a clearer picture.

Have a good day!

Thanks
Jialiang Ge (jialge@xxxxxx, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxx.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

My System SpecsSystem Spec
Old 05-15-2008   #3 (permalink)
Alexander Wykel


 
 

RE: Adding Exception namespace to LINQ DAL

Figured out the problem!

The problem is that I have a namespace root called NTKSDataLayer I have a
class Logger that is defined in ths name space With in this calss the
Exception class is refrenced mutiple times.

Here is the example:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

//using Snippet.Exception;
namespace Snippet
{
public class Class1
{
public Class1()
{
try
{
if (1 != 2)
throw new System.Exception("Whoops!");
}
catch (Exception ex) //This line won't compile
{

}
}
}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Snippet.Exception
{
[global::System.Serializable]
public class DALException : ApplicationException
{
//
// For guidelines regarding the creation of new exception types, see
//
http://msdn.microsoft.com/library/de...guidelines.asp
// and
//
http://msdn.microsoft.com/library/de...rp07192001.asp
//

public DALException() { }
public DALException( string message ) : base( message ) { }
public DALException( string message, System.Exception inner ) : base(
message, inner ) { }
protected DALException(
System.Runtime.Serialization.SerializationInfo info,
System.Runtime.Serialization.StreamingContext context ) : base( info,
context ) { }
}
class Exception
{
}
}

--
Alexander L. Wykel
AW Software Works



"Jialiang Ge [MSFT]" wrote:
Quote:

> Hello Alexander,
>
> First off, I am sorry if these major problems turn out to be caused by
> Microsoft products.
>
> I am trying to reproduce the issue that the assemblies cannot be recognized
> by Visual Studio even if they were all there. But I am stuck by the step
> "adding the Exception namespace to the project". In .NET framework class
> library, there is no System.Exception namespace. Is the "Exception"
> namespace defined by your own code? If that, when we change it to
> System.Exception, we may get an compilation error "'Excpetion' is a
> 'namespace' but is used like a 'type'" from a code line like 'Exception e =
> new Exception("");". This is because "System.Exception" is a class and
> "Exception" can also be regarded as a namespace in this case. The
> resolution is to explicitly specify the namespace "System" when we use
> "Exception". For example, "System.Exception e = new System.Exception("");
> ". If I misunderstand you question, please let me know more detailed
> repro-steps or send an example project to my mailbox jialge@xxxxxx
> so that I can have a clearer picture.
>
> Have a good day!
>
> Thanks
> Jialiang Ge (jialge@xxxxxx, remove 'online.')
> Microsoft Online Community Support
>
> =================================================
> Delighting our customers is our #1 priority. We welcome your comments and
> suggestions about how we can improve the support we provide to you. Please
> feel free to let my manager know what you think of the level of service
> provided. You can send feedback directly to my manager at:
> msdnmg@xxxxxx.
>
> This posting is provided "AS IS" with no warranties, and confers no rights.
> =================================================
>
>
My System SpecsSystem Spec
Old 05-22-2008   #4 (permalink)
Jialiang Ge [MSFT]


 
 

RE: Adding Exception namespace to LINQ DAL

Hello Alexander,

Glad to see the issue was resolved with your own efforts. I am sorry that I
failed to provide constructive suggestions in my initial reply. Please feel
free to let me know if there's anything else I can help.

Regards,
Jialiang Ge (jialge@xxxxxx, remove 'online.')
Microsoft Online Community Support

=================================================
Delighting our customers is our #1 priority. We welcome your comments and
suggestions about how we can improve the support we provide to you. Please
feel free to let my manager know what you think of the level of service
provided. You can send feedback directly to my manager at:
msdnmg@xxxxxx.

This posting is provided "AS IS" with no warranties, and confers no rights.
=================================================

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
getting cr/lf out of xml with linq to xml? .NET General
Linq to SQL .NET General
namespace exception PowerShell
Exception stack is corrupt when catching and storing the exception .NET General
Vista Install Error: Exception Unknown Software Exception Vista installation & setup


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46