The System.Diagnostics namespace (and GetFrame(int frameNumber) in particular) is not available in the CF. How do I go about getting callstack details when running on CE (6.0 R3) ?
Thanks!
If you throw an exception you can then look at the callstack in the exception by parsing the callstack string. There really aren't any cleaner alternatives.
Related
Microsoft documents EnumerationOptions at [https://learn.microsoft.com/en-us/dotnet/api/system.io.enumerationoptions?view=netcore-3.1]
and it seems to infer that the VB.Net code below would be acceptable
Dim ENumOptions = New System.IO.EnumerationOptions()
But it is not! Visual Studio reports "Type system.io.enumerationoptions is not defined"
What have I done wrong?
I'm guessing what's happening here is that you want to call Directory.GetFiles or the like and you want to do a recursive search without throwing an exception if you hit an inaccessible folder. If you're targeting the .NET Framework then too bad, because you can't. Go here and search for Directory.GetFiles filtered by .NET Framework 4.8 and .NET Core 3.1 and you'll see that the overload that uses EnumerationOptions is not available in the former.
If you are using below .Net 5 version,
Add reference to System.Management
Then Import.
Imports System.Management
From .Net 5 it is available in System.IO
I'm developping a winform application and I would like to make it as robust as possible.
In my code there are classes where I throw exceptions that I master very well and catch them whenever it's needed. However, there are some other classes/methods that throw exception that I may have forgotten and are not thrown in the current testing scenarios.
Let's say for example the class StreamReader The constructor may throw different exceptions that should be handeled (MSDN)
My question is there any tool for VB.Net (which works) that would check if am I instanciating the class StreamReader in a Try and Catch ?
I have been looking to the page : Wiki
I checked also the threads StackOverFlow and StackOverFlow
But none of them really helped me.
I read somewhere that every operation theoretically can throw an exception. Well, the idea is to reduce at least the "first level" exception and at least only for core .Net components that may have been forgotten without necessarily targetting 100% of the exceptions or targetting third parties classes.
If someone has an answer I would appreciate your help :)
Cheers in advance.
I am converting .Net code to winRT. I searched but did not find replace of ThreadAbortException that I may write for winRT. Please tell me about this or about some general thread exception.
Thanks
There is no thread abort in winRT. so, you don't need to handle this.
Probably the most similar error you can use is OperationCanceledException. This error is thrown by WinRT asynchronous operations when they are aborted and it is supported in all WinRT projections. For more information, take a look at http://msdn.microsoft.com/en-in/library/windows/apps/hh699896.aspx
I'm trying to reference a com component and it is throwing the below error.
Creating an instance of the COM component with CLSID {xxx} from the IClassFactory failed due to the following error: 800a0153.
Specifically the error gets thrown when I try to instantiate an object. I checked that
The project being built for x86 processors which it is
The com object is registered using regsvr32, and is available in the registry.
I can also see the methods in the object browser, so I know .net is finding it.
Any ideas on what I'm missing?
This is an error code that's specific to the component. If you don't have documentation that explains what the code might mean then you'll need support from the vendor.
As noted in my comment to Hans' answer, this error code is FACILITY_CONTROL, which is supposed to relate to OLE/ActiveX controls, and has an error code which lies in the standard range (i.e. for Microsoft use) defined in OleCtl.h, but is not documented in the Win32 header files so is probably internal to a Microsoft product such as Visual Basic.
Can you tell us anything else about the COM component you are trying to use?
If the COM component was written using Visual Basic, I think it's probable that what you are seeing is equivalent to the Runtime Error 339 which users of Visual Basic see if they try to reference an OCX control which has some of its dependencies missing. You might look at the dependencies of the COM server's DLL/EXE using Depends.exe and see whether you have them all present on your machine.
Back when I had to do a lot of COM work, I used COM Explorer quite a bit from these guys:
http://download.cnet.com/COM-Explorer/3000-2206_4-10022464.html?tag=mncol;lst
I had to install it last year to debug a bizarre COM registration issue with Office plugins.
Also, I have no affiliation with these guys whatsoever (and it looks like the company might be toast anyway).
Can anyone help me out, how to detect if MSXML parser is installed on a machine or not. I looked for a registry entry,but unable to get one. I am writing a VB.NET application.
Thanks in advance :)
One way you can do it is to create an instance of one of the MSXML objects in your code. e.g. Dim t As Type
Dim o As Object
' If this code causes an exception the object doesn't exist
t = Type.GetTypeFromProgID("MSXML2.DOMDocument")
o = Activator.CreateInstance(t);
System.Runtime.InteropServices.Marshal.ReleaseComObject(o)
I apologize if my vb.net code is bad :)
I would check if these files exists and check the version.
Or I would use this
Or maybe there is a better way?
If possible, target MSXML 3.0. It's included in all Windows operating systems starting with Win2k SP4, so there's usually no need to check for it's presence.
Anyway, if you are using VB.NET, consider using the System.Xml namespace instead. It is part of the .net framework, which is needed by your VB.NET application anyway.
One thing to notice is that The use of MSXML is not supported in .NET applications since the GC inside MSXML is not compatible with .Net framework.