473,466 Members | 1,548 Online
Bytes | Software Development & Data Engineering Community
Create 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.TypeInitializationException was unhandled
Message="The type initializer for
'Microsoft.PointOfService.Management.Explorer' threw an exception."
Source="Microsoft.PointOfService"
TypeName="Microsoft.PointOfService.Management.Expl orer"
StackTrace:
at Microsoft.PointOfService.Management.Explorer.Creat eExplorer()
at Microsoft.PointOfService.PosExplorer.LoadExplorer( )
at Microsoft.PointOfService.PosExplorer.Initialize()
at Microsoft.PointOfService.PosExplorer..ctor()
at Retail.frmPrinterSetUp.frmPrinterSetUp_Load(Object sender,
EventArgs e) in C:\Documents and Settings\HP_Owner\My Documents\Visual Studio
2005\Projects\Retail\Retail\frmPrinterSetUp.cs:lin e 21
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.SafeNativeMethods.ShowWindow( HandleRef hWnd,
Int32 nCmdShow)
at System.Windows.Forms.Control.SetVisibleCore(Boolea n value)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at Retail.frmMain.frmMain_Load(Object sender, EventArgs e) in
C:\Documents and Settings\HP_Owner\My Documents\Visual Studio
2005\Projects\Retail\Retail\frmMain.cs:line 24
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Mes sage& m)
at System.Windows.Forms.ContainerControl.WndProc(Mess age& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at
System.Windows.Forms.Control.ControlNativeWindow.O nMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.W ndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallba ck(IntPtr hWnd,
Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.SendMessa ge(HandleRef
hWnd, Int32 msg, Int32 wParam, Int32 lParam)
at System.Windows.Forms.Form.SetVisibleCore(Boolean value)
at System.Windows.Forms.Control.set_Visible(Boolean value)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoopInner(Int32
reason, ApplicationContext context)
at
System.Windows.Forms.Application.ThreadContext.Run MessageLoop(Int32 reason,
ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at Retail.Program.Main() in C:\Documents and Settings\HP_Owner\My
Documents\Visual Studio 2005\Projects\Retail\Retail\Program.cs:line 20
at System.AppDomain.nExecuteAssembly(Assembly assembly, String[] args)
at System.Runtime.Hosting.ManifestRunner.Run(Boolean checkAptModel)
at System.Runtime.Hosting.ManifestRunner.ExecuteAsAss embly()
at
System.Runtime.Hosting.ApplicationActivator.Create Instance(ActivationContext
activationContext, String[] activationCustomData)
at
System.Runtime.Hosting.ApplicationActivator.Create Instance(ActivationContext
activationContext)
at
Microsoft.VisualStudio.HostingProcess.HostProc.Run UsersAssemblyDebugInZone()
at System.Threading.ThreadHelper.ThreadStart_Context( Object state)
at System.Threading.ExecutionContext.Run(ExecutionCon text
executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()

--
L. A. Jones
Mar 4 '07 #1
5 6239
In article <D2**********************************@microsoft.co m>,
Da**@discussions.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.TypeInitializationException was unhandled
Message="The type initializer for
'Microsoft.PointOfService.Management.Explorer' threw an exception."
Source="Microsoft.PointOfService"
Whenever you see a TypeInitializationException, 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.orgwrote:
In article <D23F6DE9-A23E-4171-9ED9-6A46528B8...@microsoft.com>,
D...@discussions.microsoft.com says...
Whenever you see a TypeInitializationException, 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.InnerException != null) clause in all of your exception handlers?

Mar 6 '07 #3
In article <11**********************@8g2000cwh.googlegroups.c om>,
sh*************@gmail.com says...
On Mar 5, 7:05 pm, Patrick Steele <patr...@mvps.orgwrote:
In article <D23F6DE9-A23E-4171-9ED9-6A46528B8...@microsoft.com>,
D...@discussions.microsoft.com says...
Whenever you see a TypeInitializationException, 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.InnerException != null) clause in all of your exception handlers?
I'm not sure what you're asking. The InnerException property helps you
determine why the TypeLoadInitializationException 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.orgwrote:
In article <1173151420.085767.309...@8g2000cwh.googlegroups.c om>,
sherifffruit...@gmail.com says...
On Mar 5, 7:05 pm, Patrick Steele <patr...@mvps.orgwrote:
In article <D23F6DE9-A23E-4171-9ED9-6A46528B8...@microsoft.com>,
D...@discussions.microsoft.com says...
Whenever you see a TypeInitializationException, 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.InnerException != null) clause in all of your exception handlers?

I'm not sure what you're asking. The InnerException property helps you
determine why the TypeLoadInitializationException 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.orgwrote:
In article <1173151420.085767.309...@8g2000cwh.googlegroups.c om>,
sherifffruit...@gmail.com says...
On Mar 5, 7:05 pm, Patrick Steele <patr...@mvps.orgwrote:
In article <D23F6DE9-A23E-4171-9ED9-6A46528B8...@microsoft.com>,
D...@discussions.microsoft.com says...
Whenever you see a TypeInitializationException, 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.InnerException != null) clause in all of your exception handlers?

I'm not sure what you're asking. The InnerException property helps you
determine why the TypeLoadInitializationException 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
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...
0
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...
2
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. ...
3
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
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...
1
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...
1
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...
6
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) ...
2
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)...
0
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...
0
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...
0
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,...
0
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...
1
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...
0
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...
0
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...
0
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...
0
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 ...

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.