473,661 Members | 2,494 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A first chance exception of type 'System.Invalid CastException' occurred in scs.sr.dal.dll

Hi All

Here iam getting this Error "Specified cast is not valid."
My Project has Onc solution diffrent class libarary In that solution DALfactory solution iam getting this error
I was calling this function in DALFactory class library(this library generate the DAL.dll)

Another class library has this function

public SecurityInfo Login(string username, string password)
{
IUserSetting us = SCS.SR.DALFacto ry.UserSetting. Create(); (When i was catch the Quick watch "SCS.SR.DALFact ory.UserSetting .Create()" this that time iam getting this error "System.SystemE xception {"Specified cast is not valid."} System.SystemEx ception ")

SecurityInfo getIsusreValid = us.IsUserValid( username,passwo rd);
return getIsusreValid;
}
public static SCS.SR.IDAL.IUs erSetting Create()
{
string path = System.Configur ation.Configura tionSettings.Ap pSettings["WebDAL"];
string className = path + ".UserSetti ng";
return (SCS.SR.IDAL.IU serSetting) Assembly.Load(p ath).CreateInst ance(className) ; (Here Iam getting this error) (this is going to return the securityInfo function)

}

A first chance exception of type 'System.Invalid CastException' occurred in scs.sr.dal.dll

Additional information: Specified cast is not valid.
Regards,
Karunakara Rao.
Nov 16 '05 #1
3 8226
Hi,

In this line:

return (SCS.SR.IDAL.IU serSetting) Assembly.Load(p ath).CreateInst ance(className)

Use CreateInstanceA ndUnwrap instead of CreateInstance.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx
"karunakar" <ka***********@ stcroixsystems. com> wrote in message news:Oi******** ******@TK2MSFTN GP15.phx.gbl...
Hi All

Here iam getting this Error "Specified cast is not valid."
My Project has Onc solution diffrent class libarary In that solution DALfactory solution iam getting this error
I was calling this function in DALFactory class library(this library generate the DAL.dll)

Another class library has this function

public SecurityInfo Login(string username, string password)
{
IUserSetting us = SCS.SR.DALFacto ry.UserSetting. Create(); (When i was catch the Quick watch "SCS.SR.DALFact ory.UserSetting .Create()" this that time iam getting this error "System.SystemE xception {"Specified cast is not valid."} System.SystemEx ception ")

SecurityInfo getIsusreValid = us.IsUserValid( username,passwo rd);
return getIsusreValid;
}
public static SCS.SR.IDAL.IUs erSetting Create()
{
string path = System.Configur ation.Configura tionSettings.Ap pSettings["WebDAL"];
string className = path + ".UserSetti ng";
return (SCS.SR.IDAL.IU serSetting) Assembly.Load(p ath).CreateInst ance(className) ; (Here Iam getting this error) (this is going to return the securityInfo function)

}

A first chance exception of type 'System.Invalid CastException' occurred in scs.sr.dal.dll

Additional information: Specified cast is not valid.
Regards,
Karunakara Rao.
Nov 16 '05 #2
Hi,

CreateInstanceA ndUnwrap is a member of AppDomain , not of Assembly.
I would check the className to be a correct FQN of the class in question.

replace the line for this:

object tempO = Assembly.Load(p ath).CreateInst ance(className) ;

and see in the watch window what tempO is.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote in message news:ep******** ********@TK2MSF TNGP14.phx.gbl. ..
Hi,

In this line:

return (SCS.SR.IDAL.IU serSetting) Assembly.Load(p ath).CreateInst ance(className)

Use CreateInstanceA ndUnwrap instead of CreateInstance.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx
"karunakar" <ka***********@ stcroixsystems. com> wrote in message news:Oi******** ******@TK2MSFTN GP15.phx.gbl...
Hi All

Here iam getting this Error "Specified cast is not valid."
My Project has Onc solution diffrent class libarary In that solution DALfactory solution iam getting this error
I was calling this function in DALFactory class library(this library generate the DAL.dll)

Another class library has this function

public SecurityInfo Login(string username, string password)
{
IUserSetting us = SCS.SR.DALFacto ry.UserSetting. Create(); (When i was catch the Quick watch "SCS.SR.DALFact ory.UserSetting .Create()" this that time iam getting this error "System.SystemE xception {"Specified cast is not valid."} System.SystemEx ception ")

SecurityInfo getIsusreValid = us.IsUserValid( username,passwo rd);
return getIsusreValid;
}
public static SCS.SR.IDAL.IUs erSetting Create()
{
string path = System.Configur ation.Configura tionSettings.Ap pSettings["WebDAL"];
string className = path + ".UserSetti ng";
return (SCS.SR.IDAL.IU serSetting) Assembly.Load(p ath).CreateInst ance(className) ; (Here Iam getting this error) (this is going to return the securityInfo function)

}

A first chance exception of type 'System.Invalid CastException' occurred in scs.sr.dal.dll

Additional information: Specified cast is not valid.
Regards,
Karunakara Rao.
Nov 16 '05 #3
I agree - this is most likely the cause. I should have checked the Assembly's method list - shame on me!

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.mach in AT dot.state.fl.us > wrote in message news:ey******** ******@tk2msftn gp13.phx.gbl...
Hi,

CreateInstanceA ndUnwrap is a member of AppDomain , not of Assembly.
I would check the className to be a correct FQN of the class in question.

replace the line for this:

object tempO = Assembly.Load(p ath).CreateInst ance(className) ;

and see in the watch window what tempO is.

cheers,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Dmitriy Lapshin [C# / .NET MVP]" <x-****@no-spam-please.hotpop.c om> wrote in message news:ep******** ********@TK2MSF TNGP14.phx.gbl. ..
Hi,

In this line:

return (SCS.SR.IDAL.IU serSetting) Assembly.Load(p ath).CreateInst ance(className)

Use CreateInstanceA ndUnwrap instead of CreateInstance.

--
Sincerely,
Dmitriy Lapshin [C# / .NET MVP]
Bring the power of unit testing to the VS .NET IDE today!
http://www.x-unity.net/teststudio.aspx
"karunakar" <ka***********@ stcroixsystems. com> wrote in message news:Oi******** ******@TK2MSFTN GP15.phx.gbl...
Hi All

Here iam getting this Error "Specified cast is not valid."
My Project has Onc solution diffrent class libarary In that solution DALfactory solution iam getting this error
I was calling this function in DALFactory class library(this library generate the DAL.dll)

Another class library has this function

public SecurityInfo Login(string username, string password)
{
IUserSetting us = SCS.SR.DALFacto ry.UserSetting. Create(); (When i was catch the Quick watch "SCS.SR.DALFact ory.UserSetting .Create()" this that time iam getting this error "System.SystemE xception {"Specified cast is not valid."} System.SystemEx ception ")

SecurityInfo getIsusreValid = us.IsUserValid( username,passwo rd);
return getIsusreValid;
}
public static SCS.SR.IDAL.IUs erSetting Create()
{
string path = System.Configur ation.Configura tionSettings.Ap pSettings["WebDAL"];
string className = path + ".UserSetti ng";
return (SCS.SR.IDAL.IU serSetting) Assembly.Load(p ath).CreateInst ance(className) ; (Here Iam getting this error) (this is going to return the securityInfo function)

}

A first chance exception of type 'System.Invalid CastException' occurred in scs.sr.dal.dll

Additional information: Specified cast is not valid.
Regards,
Karunakara Rao.
Nov 16 '05 #4

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

Similar topics

1
6362
by: Ben | last post by:
Hi I have a program that has just been developed on a machine running VS .NET 2003, we installed VS6 on the same machine and now we receive the below error on click event. The on click event doesent even seem to fire? An unhandled exception of type 'System.InvalidCastException' occurred in system.windows.forms.dll
3
31131
by: Pieter | last post by:
Hi, I have a Windows Forms application (VB.NET 2.0) which uses a Class Library in C#. The application runs fine, but when I run it in debug mode, I get several "A first chance exception of type 'System.ArgumentOutOfRangeException' occurred in mscorlib.dll" -exceptions that are shown in the Immediate window of Visual Studio 2005. I want to get rid of these exceptions, but I can(t find where they occur.
1
1677
by: Tommy | last post by:
I get this message in the output window of my app I just converted from VS 2003 to 2005. It's a VB.Net app. A first chance exception of type 'System.InvalidCastException' occurred in Microsoft.VisualBasic.dll How can I find these exceptions so I can take care of them? They do not show up in the errors or warnings window. Thanks
4
2050
by: Lammert | last post by:
Good afternoon, I have a very strange problem. When I execute the code below the program throws an InvalidCastException. When I debug the code I see e.Item.DataItem is an object from the type OrganisatieOnderdeel. When you read the additional you can see the types are the same. How can I solve this problem? Kinds regards, Lammert
7
15669
by: illegal.prime | last post by:
Hi all, I've got a client/server application and just wanted to ensure that this is expected behavior. I recently set the following configuration in Visual Studio: Debug->Exceptions->Break Into Debugger for the CLR Exceptions And when my debugger hits the TcpClient.Connect statement and the server is not available - I get the following three first chance exceptions: A first chance exception of type 'System.Net.Sockets.SocketException'
3
22364
by: GS | last post by:
why am i getting A first chance exception of type 'System.NullReferenceException' occurred in myapp.exe below? and what can i do get rid of it? Private Function getPrefxType() As String If bSkipGetListBOxComboBoxValue Then Return "" Try
7
1821
by: Pixel.to.life | last post by:
Gurus, Another question on one of the coveted Microsoft products: JIT debugger with VS2005. I have a managed app that builds great on one machine (Vista Home basic, VS2005, JIT enabled for managed/unmanaged code). I can also debug it on this machine with breakpoints and all. Now I move the same code on another machine (XP Pro, VS2005, JIT
0
1410
by: Pixel.to.life | last post by:
Gurus, Another question on one of the coveted Microsoft products: JIT debugger with VS2005. I have a managed app that builds great on one machine (Vista Home basic, VS2005, JIT enabled for managed/unmanaged code). I can also debug it on this machine with breakpoints and all.
6
4791
by: zubair1 | last post by:
Hi, Today, i added some new code which was to see if a file is locked or not (in use by another application). While i did that it was showing me some errors like in the Output window:- A first chance exception of type 'System.UnauthorizedAccessException' occurred in Microsoft.VisualBasic.dll A first chance exception of type 'System.UnauthorizedAccessException' occurred in Microsoft.VisualBasic.dll A first chance exception of type...
0
8432
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8856
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8762
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8633
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
6185
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4179
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4347
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2762
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1992
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.