473,566 Members | 2,812 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Cannot fifure out how to fix this exception.

I am unable to execute the following statement in my current project. The
class PosExplorer is in a dll file (created by Microsoft).

PosExplorer explorer = new PosExplorer()

but now I get this dreaded exception below. What I cannot understand, is
that, if I create another small project with a single form and execute the
line above, then it works. But it does not work in my current project.
The innerexception. Message is : "Attempt to access the method failed".

Here is the exception.

System.TypeInit ializationExcep tion was unhandled
Message="The type initializer for
'Microsoft.Poin tOfService.Mana gement.Explorer ' threw an exception."
Source="Microso ft.PointOfServi ce"
TypeName="Micro soft.PointOfSer vice.Management .Explorer"
StackTrace:
at Microsoft.Point OfService.Manag ement.Explorer. CreateExplorer( )
at Microsoft.Point OfService.PosEx plorer.LoadExpl orer()
at Microsoft.Point OfService.PosEx plorer.Initiali ze()
at Microsoft.Point OfService.PosEx plorer..ctor()
at Retail.frmPrint erSetUp.frmPrin terSetUp_Load(O bject sender,
EventArgs e) in C:\Documents and Settings\HP_Own er\My Documents\Visua l Studio
2005\Projects\R etail\Retail\fr mPrinterSetUp.c s:line 21
at System.Windows. Forms.Form.OnLo ad(EventArgs e)
at System.Windows. Forms.Form.OnCr eateControl()
at System.Windows. Forms.Control.C reateControl(Bo olean fIgnoreVisible)
at System.Windows. Forms.Control.C reateControl()
at System.Windows. Forms.Control.W mShowWindow(Mes sage& m)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
at System.Windows. Forms.Container Control.WndProc (Message& m)
at System.Windows. Forms.Form.WmSh owWindow(Messag e& m)
at System.Windows. Forms.Form.WndP roc(Message& m)
at
System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows. Forms.SafeNativ eMethods.ShowWi ndow(HandleRef hWnd,
Int32 nCmdShow)
at System.Windows. Forms.Control.S etVisibleCore(B oolean value)
at System.Windows. Forms.Form.SetV isibleCore(Bool ean value)
at System.Windows. Forms.Control.s et_Visible(Bool ean value)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
reason, ApplicationCont ext context)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason,
ApplicationCont ext context)
at System.Windows. Forms.Form.Show Dialog(IWin32Wi ndow owner)
at System.Windows. Forms.Form.Show Dialog()
at Retail.frmMain. frmMain_Load(Ob ject sender, EventArgs e) in
C:\Documents and Settings\HP_Own er\My Documents\Visua l Studio
2005\Projects\R etail\Retail\fr mMain.cs:line 24
at System.Windows. Forms.Form.OnLo ad(EventArgs e)
at System.Windows. Forms.Form.OnCr eateControl()
at System.Windows. Forms.Control.C reateControl(Bo olean fIgnoreVisible)
at System.Windows. Forms.Control.C reateControl()
at System.Windows. Forms.Control.W mShowWindow(Mes sage& m)
at System.Windows. Forms.Control.W ndProc(Message& m)
at System.Windows. Forms.Scrollabl eControl.WndPro c(Message& m)
at System.Windows. Forms.Container Control.WndProc (Message& m)
at System.Windows. Forms.Form.WmSh owWindow(Messag e& m)
at System.Windows. Forms.Form.WndP roc(Message& m)
at
System.Windows. Forms.Control.C ontrolNativeWin dow.OnMessage(M essage& m)
at System.Windows. Forms.Control.C ontrolNativeWin dow.WndProc(Mes sage& m)
at System.Windows. Forms.NativeWin dow.DebuggableC allback(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows. Forms.UnsafeNat iveMethods.Send Message(HandleR ef
hWnd, Int32 msg, Int32 wParam, Int32 lParam)
at System.Windows. Forms.Form.SetV isibleCore(Bool ean value)
at System.Windows. Forms.Control.s et_Visible(Bool ean value)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo pInner(Int32
reason, ApplicationCont ext context)
at
System.Windows. Forms.Applicati on.ThreadContex t.RunMessageLoo p(Int32 reason,
ApplicationCont ext context)
at System.Windows. Forms.Applicati on.Run(Form mainForm)
at Retail.Program. Main() in C:\Documents and Settings\HP_Own er\My
Documents\Visua l Studio 2005\Projects\R etail\Retail\Pr ogram.cs:line 20
at System.AppDomai n.nExecuteAssem bly(Assembly assembly, String[] args)
at System.Runtime. Hosting.Manifes tRunner.Run(Boo lean checkAptModel)
at System.Runtime. Hosting.Manifes tRunner.Execute AsAssembly()
at
System.Runtime. Hosting.Applica tionActivator.C reateInstance(A ctivationContex t
activationConte xt, String[] activationCusto mData)
at
System.Runtime. Hosting.Applica tionActivator.C reateInstance(A ctivationContex t
activationConte xt)
at
Microsoft.Visua lStudio.Hosting Process.HostPro c.RunUsersAssem blyDebugInZone( )
at System.Threadin g.ThreadHelper. ThreadStart_Con text(Object state)
at System.Threadin g.ExecutionCont ext.Run(Executi onContext
executionContex t, ContextCallback callback, Object state)
at System.Threadin g.ThreadHelper. ThreadStart()

--
L. A. Jones
Mar 4 '07 #1
5 6254
In article <D2************ *************** *******@microso ft.com>,
Da**@discussion s.microsoft.com says...
>
I am unable to execute the following statement in my current project. The
class PosExplorer is in a dll file (created by Microsoft).

PosExplorer explorer = new PosExplorer()

but now I get this dreaded exception below. What I cannot understand, is
that, if I create another small project with a single form and execute the
line above, then it works. But it does not work in my current project.
The innerexception. Message is : "Attempt to access the method failed".

Here is the exception.

System.TypeInit ializationExcep tion was unhandled
Message="The type initializer for
'Microsoft.Poin tOfService.Mana gement.Explorer ' threw an exception."
Source="Microso ft.PointOfServi ce"
Whenever you see a TypeInitializat ionException, you really need to look
at it's InnerException to see why the type couldn't be initialized.

--
Patrick Steele
http://weblogs.asp.net/psteele
Mar 6 '07 #2
On Mar 5, 7:05 pm, Patrick Steele <patr...@mvps.o rgwrote:
In article <D23F6DE9-A23E-4171-9ED9-6A46528B8...@mi crosoft.com>,
D...@discussion s.microsoft.com says...
Whenever you see a TypeInitializat ionException, you really need to look
at it's InnerException to see why the type couldn't be initialized.
If you don't "just know" that a given exception *has* an
InnerException, do you basically just have to put an if
(ex.InnerExcept ion != null) clause in all of your exception handlers?

Mar 6 '07 #3
In article <11************ **********@8g20 00cwh.googlegro ups.com>,
sh************* @gmail.com says...
On Mar 5, 7:05 pm, Patrick Steele <patr...@mvps.o rgwrote:
In article <D23F6DE9-A23E-4171-9ED9-6A46528B8...@mi crosoft.com>,
D...@discussion s.microsoft.com says...
Whenever you see a TypeInitializat ionException, you really need to look
at it's InnerException to see why the type couldn't be initialized.

If you don't "just know" that a given exception *has* an
InnerException, do you basically just have to put an if
(ex.InnerExcept ion != null) clause in all of your exception handlers?
I'm not sure what you're asking. The InnerException property helps you
determine why the TypeLoadInitial izationExceptio n occurred.

The base Exception class contains an InnerException property so any
exception in .NET has the potential to have an InnerException.

--
Patrick Steele
http://weblogs.asp.net/psteele
Mar 6 '07 #4
On Mar 5, 7:32 pm, Patrick Steele <patr...@mvps.o rgwrote:
In article <1173151420.085 767.309...@8g20 00cwh.googlegro ups.com>,
sherifffruit... @gmail.com says...
On Mar 5, 7:05 pm, Patrick Steele <patr...@mvps.o rgwrote:
In article <D23F6DE9-A23E-4171-9ED9-6A46528B8...@mi crosoft.com>,
D...@discussion s.microsoft.com says...
Whenever you see a TypeInitializat ionException, you really need to look
at it's InnerException to see why the type couldn't be initialized.
If you don't "just know" that a given exception *has* an
InnerException, do you basically just have to put an if
(ex.InnerExcept ion != null) clause in all of your exception handlers?

I'm not sure what you're asking. The InnerException property helps you
determine why the TypeLoadInitial izationExceptio n occurred.

The base Exception class contains an InnerException property so any
exception in .NET has the potential to have an InnerException.
Ah - gotcha. I had the cockamamie idea that there were some types of
exceptions that were guaranteed to have inners, and other types of
exceptions there were guaranteed NOT to have inners. If I understand
you correctly, having an inner exception (or not) isn't decided at the
type level, rather it's decided at the instance level.

So basically, if you care about them in the first place, you would
always have an inner-exception-checker in your exception handler - for
any exception you don't know the instantiation/property-setting
details of ahead of time.

Mar 6 '07 #5
On Mar 5, 7:32 pm, Patrick Steele <patr...@mvps.o rgwrote:
In article <1173151420.085 767.309...@8g20 00cwh.googlegro ups.com>,
sherifffruit... @gmail.com says...
On Mar 5, 7:05 pm, Patrick Steele <patr...@mvps.o rgwrote:
In article <D23F6DE9-A23E-4171-9ED9-6A46528B8...@mi crosoft.com>,
D...@discussion s.microsoft.com says...
Whenever you see a TypeInitializat ionException, you really need to look
at it's InnerException to see why the type couldn't be initialized.
If you don't "just know" that a given exception *has* an
InnerException, do you basically just have to put an if
(ex.InnerExcept ion != null) clause in all of your exception handlers?

I'm not sure what you're asking. The InnerException property helps you
determine why the TypeLoadInitial izationExceptio n occurred.

The base Exception class contains an InnerException property so any
exception in .NET has the potential to have an InnerException.
Ah - gotcha. I had the cockamamie idea that there were some types of
exceptions that were guaranteed to have inners, and other types of
exceptions there were guaranteed NOT to have inners. If I understand
you correctly, having an inner exception (or not) isn't decided at the
type level, rather it's decided at the instance level.

So basically, if you care about them in the first place, you would
always have an inner-exception-checker in your exception handler - for
any exception you don't know the instantiation/property-setting
details of ahead of time.

Mar 6 '07 #6

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

Similar topics

2
57891
by: Chris Herring | last post by:
Hi there: Well, let me start off by saying that I am a Visual Studio drag and drop weenie, not a real programmer. So I tend to get confused when things do not look like the instructions said they were going to look :) . Here is my current dilemma: I am having a strange problem with my ASP.NET application. I am building the application using...
0
391
by: John Mason | last post by:
Hi, I have developed an asp.net application that uses forms authentication. I have a local install and a remotely hosted install of the application. Intermittently the remote application falls over with an error (see below for details). This seems to happen on different pages after an asp forms button is clicked, and brings down the...
2
8132
by: Tim Reynolds | last post by:
Team, When my web service throws an exception and I am debugging on my PC - I get the exception back in my browser fine. My web.config shows <customErrors mode="Off"/> and this is working well. However, when I test this web service on the deployment server, I only get 'The page cannot be displayed' instead of the exception. That is when I...
3
3909
by: thomson | last post by:
Hi All, Are there any sort of exceptions that cannot be caught by the Runtime, Any Insights? Thanks in Advance thomson
2
7028
by: mudge | last post by:
Hi, I'm getting some very strange problems with some C# code. We're running an ASP.NET application on a local server in a DMZ. If I access it using the internal address, the application works fine, every time. But, if I access on it's public IP, from my office workstation, from home, over the VPN, a test machine on ADSL, or whatever else...
1
2006
by: Simon Harvey | last post by:
Hi everyone, If anyone can help me with the following - I would be VERY grateful. I need to deploy an 2 ASP.net applications that I've been creating onto one of our live servers. Both applications use the Microsoft Enterprise Library dlls and have them located in their respective bin directories. Everything works fine on my development...
1
5030
by: Fawad Ahsan | last post by:
Hi i am having problem with the microsoft enterprise library. i have uploaded the site to the hosting server and it gives the following error it works well in my server. can some one help me what kind of permission to set? thanks Server Error in '/' Application.
6
11995
by: Dave | last post by:
I really don't like the users getting an unhandled expception page, and I'm still to new with ASP.Net and C#. So please accept my appology for the 2 part question. SqlException (0x80131904) 1.) Is an "Cannot insert duplicate key row" exception from a FormView returned as part of the ItemInserting or ItemInserted event? 2.) What is...
2
6644
by: karinmorena | last post by:
I'm having 4 errors, I'm very new at this and I would appreciate your input. The error I get is: Week5MortgageGUI.java:151:cannot find symbol symbol: method allInterest(double,double,double) Location: class Week5MortgageGUI Week5MortgageLogic allint = logic.allInterest(amount, term, rate); Week5MortgageGUI.java:152:cannot find symbol...
0
7584
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8108
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...
1
7644
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7951
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...
0
6260
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5484
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...
0
5213
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3643
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...
0
3626
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.