Debugging COMException - com

I am using an ancient Intergraph routing library to do some routing.
I could create several ActiveX and COM objects just fine but there is this one type "Location" and "LocationCtrl" that throws a COMException on creation.
Here's the relevant code
_sourceLocation.Streets = _streets;
_sourceLocation.VerifyAutomatic = fa_sourceLocationse;
_sourceLocation.VerifyType = VerifyTypeConstants.VerifyUsingA_sourceLocation_sourceLocation;
_sourceLocation.ReplaceTextAfterParse = true;
_sourceLocation.ReplaceTextAfterVerify = true;
_sourceLocation.Map = _mapOcx;
The COMException was thrown upon setting the Streets property.
Here's the exception:
System.Runtime.InteropServices.COMException was unhandled
Message="Catastrophic failure (Exception from HRESULT: 0x8000FFFF (E_UNEXPECTED))"
Source="mscorlib"
ErrorCode=-2147418113
StackTrace:
at System.RuntimeType.ForwardCallToInvokeMember(String memberName, BindingFlags flags, Object target, Int32[] aWrapperTypes, MessageData& msgData)
at Intergraph.LocationCtrlClass.set_Streets(Object )
at ECNavigator.Routing.<InitializeRouting>b__0(LocationCtrl l) in C:\Users\Chakrit\Projects\NavigatorService\Experimental\Routing.cs:line 92
at ECNavigator.Util.FrameworkExtensions.ForEach[T](IEnumerable`1 enum, Action`1 action) in C:\Users\Chakrit\Projects\NavigatorService\Experimental\Util\FrameworkExtensions.cs:line 18
at ECNavigator.Routing.InitializeRouting() in C:\Users\Chakrit\Projects\NavigatorService\Experimental\Routing.cs:line 90
at ECNavigator.Routing..ctor(String mapFile, LocationCtrl sourceLocation, LocationCtrl destinationLocation) in C:\Users\Chakrit\Projects\NavigatorService\Experimental\Routing.cs:line 62
at ECNavigator.Program.Main() in C:\Users\Chakrit\Projects\NavigatorService\Experimental\Program.cs:line 23
at System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
The entire application is extremely simple, it contained only code that initialize some of the supporting objects, however this particular Location type would initialize just fine but on first invocation of property getters/setters, it would throw the above exception.
I have been debugging this for a few days already and havn't found a way to instantiate and initialize the Location class properly.
Any clue? Some pointers on how to further investigate this?

Related

How to make Akka.NET's ClusterClient work?

I'm trying out ClusterClient as per the docs.
However my client test app keeps getting the following error:
Error while creating actor instance of type Akka.Cluster.Tools.Client.ClusterClient with 1 args: (Akka.Cluster.Tools.Client.ClusterClientSettings)
Cause: [akka://TestSystem/user/$a#705838478]: Akka.Actor.ActorInitializationException: Exception during creation ---> System.TypeLoadException: Error while creating actor instance of type Akka.Cluster.Tools.Client.ClusterClient with 1 args: (Akka.Cluster.Tools.Client.ClusterClientSettings) ---> System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.ArgumentException: failure-detector.heartbeat-interval must be > 0s
at Akka.Remote.DeadlineFailureDetector..ctor(TimeSpan acceptableHeartbeatPause, TimeSpan heartbeatInterval, Clock clock)
at Akka.Remote.DeadlineFailureDetector..ctor(TimeSpan acceptableHeartbeatPause, Clock clock)
at Akka.Cluster.Tools.Client.ClusterClient..ctor(ClusterClientSettings settings)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeConstructorInfo.Invoke(BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.RuntimeType.CreateInstanceImpl(BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes, StackCrawlMark& stackMark)
at System.Activator.CreateInstance(Type type, BindingFlags bindingAttr, Binder binder, Object[] args, CultureInfo culture, Object[] activationAttributes)
at System.Activator.CreateInstance(Type type, Object[] args)
at Akka.Actor.Props.ActivatorProducer.Produce()
at Akka.Actor.Props.NewActor()
--- End of inner exception stack trace ---
at Akka.Actor.Props.NewActor()
at Akka.Actor.ActorCell.CreateNewActorInstance()
at Akka.Actor.ActorCell.<>c__DisplayClass118_0.<NewActor>b__0()
at Akka.Actor.ActorCell.UseThreadContext(Action action)
at Akka.Actor.ActorCell.NewActor()
at Akka.Actor.ActorCell.Create(Exception failure)
--- End of inner exception stack trace ---
at Akka.Actor.ActorCell.Create(Exception failure)
at Akka.Actor.ActorCell.SysMsgInvokeAll(EarliestFirstSystemMessageList messages, Int32 currentState)
The minimal code I'm using to get this error:
using (var system = ActorSystem.Create("TestSystem")) {
system.Settings.InjectTopLevelFallback(ClusterClientReceptionist.DefaultConfig());
var settings = ClusterClientSettings.Create(system);
var client = system.ActorOf(ClusterClient.Props(settings));
Console.Write("Press any key to exit...");
Console.ReadKey();
}
The HOCON config for the client contains:
akka {
actor {
provider = "Akka.Remote.RemoteActorRefProvider, Akka.Remote"
}
remote {
helios.tcp {
port = 0
hostname = localhost
}
}
cluster {
client {
initial-contacts: ["akka.tcp://TestSystem#localhost:8082/user/receptionist"]
}
}
}
Also checked the settings variable, seemed to be populated and looks ok to me:
Tried several random stuff to actually fulfill the error message:
failure-detector.heartbeat-interval must be > 0s
including various permutation of HOCON entries, but to no avail.
Anything else I missed out?
Update #1
Modified HOCON to initialize Akka.Remote.
Still received what looks like the same error message.
But now it is stating:
failure-detector.heartbeat-interval must be > 0s
Previously it was stating:
failure-detector.acceptable-heartbeat-pause must be >= 0s
Managed to make it working now.
The cause of the issue: I was using Akka.Cluster.Tools latest release version 1.0.6
The fix: Upgraded to the latest beta version 1.1.2.30-beta
p/s: I wished the docs could have specified the minimum NuGet version required to make it work.

Atlassian SDK InvalidCastException when using LINQ expressions

Let's start out by saying I'm not a terrifically experienced developer, so there is every possibility that I'm completely missing something here.
I'm implementing the Atlassian.NET SDK in a VB .Net solution. For the most part things work well, but I get the following error when I try to use the LINQ provider directly:
An unhandled exception of type 'System.InvalidCastException' occurred
in Atlassian.Jira.dll
Additional information: Unable to cast object of type
'System.Linq.Expressions.PropertyExpression' to type
'System.Linq.Expressions.ConstantExpression'.
The full exception:
System.InvalidCastException was unhandled HResult=-2147467262
Message=Unable to cast object of type
'System.Linq.Expressions.PropertyExpression' to type
'System.Linq.Expressions.ConstantExpression'. Source=Atlassian.Jira
StackTrace:
at Atlassian.Jira.Linq.JqlExpressionVisitor.GetFieldNameFromBinaryExpression(BinaryExpression
expression) in
c:\projects\atlassian-net-sdk\Atlassian.Jira\Linq\JqlExpressionVisitor.cs:line
65
at Atlassian.Jira.Linq.JqlExpressionVisitor.ProcessIndexedMemberEqualityOperator(BinaryExpression
expression, Boolean equal) in
c:\projects\atlassian-net-sdk\Atlassian.Jira\Linq\JqlExpressionVisitor.cs:line
142
at Atlassian.Jira.Linq.JqlExpressionVisitor.ProcessEqualityOperator(BinaryExpression
expression, Boolean equal) in
c:\projects\atlassian-net-sdk\Atlassian.Jira\Linq\JqlExpressionVisitor.cs:line
136
at Atlassian.Jira.Linq.JqlExpressionVisitor.VisitBinary(BinaryExpression
node) in
c:\projects\atlassian-net-sdk\Atlassian.Jira\Linq\JqlExpressionVisitor.cs:line
325
at System.Linq.Expressions.BinaryExpression.Accept(ExpressionVisitor
visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at System.Linq.Expressions.ExpressionVisitor.VisitLambda[T](Expression`1
node)
at System.Linq.Expressions.Expression`1.Accept(ExpressionVisitor visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at System.Linq.Expressions.ExpressionVisitor.VisitUnary(UnaryExpression
node)
at System.Linq.Expressions.UnaryExpression.Accept(ExpressionVisitor
visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at System.Linq.Expressions.ExpressionVisitor.VisitArguments(IArgumentProvider
nodes)
at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression
node)
at Atlassian.Jira.Linq.JqlExpressionVisitor.VisitMethodCall(MethodCallExpression
node) in
c:\projects\atlassian-net-sdk\Atlassian.Jira\Linq\JqlExpressionVisitor.cs:line
252
at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor
visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at System.Linq.Expressions.ExpressionVisitor.VisitArguments(IArgumentProvider
nodes)
at System.Linq.Expressions.ExpressionVisitor.VisitMethodCall(MethodCallExpression
node)
at Atlassian.Jira.Linq.JqlExpressionVisitor.VisitMethodCall(MethodCallExpression
node) in
c:\projects\atlassian-net-sdk\Atlassian.Jira\Linq\JqlExpressionVisitor.cs:line
252
at System.Linq.Expressions.MethodCallExpression.Accept(ExpressionVisitor
visitor)
at System.Linq.Expressions.ExpressionVisitor.Visit(Expression node)
at Atlassian.Jira.Linq.JqlExpressionVisitor.Process(Expression expression) in
c:\projects\atlassian-net-sdk\Atlassian.Jira\Linq\JqlExpressionVisitor.cs:line
42
at Atlassian.Jira.Linq.JiraQueryProvider.Execute(Expression expression, Boolean isEnumerable) in
c:\projects\atlassian-net-sdk\Atlassian.Jira\Linq\JiraQueryProvider.cs:line
44
at Atlassian.Jira.Linq.JiraQueryProvider.Execute(Expression expression) in
c:\projects\atlassian-net-sdk\Atlassian.Jira\Linq\JiraQueryProvider.cs:line
39
at Atlassian.Jira.Linq.JiraQueryable`1.GetEnumerator() in c:\projects\atlassian-net-sdk\Atlassian.Jira\Linq\JiraQueryable.cs:line
29
at System.Linq.Buffer1..ctor(IEnumerable\1 source)
at System.Linq.Enumerable.ToArray[TSource](IEnumerable`1 source)
at JiraUpdater.JiraStuff.GetIssueByDetail(String summary) in C:\Users\v709092\Documents\Visual Studio
2013\Projects\JiraUpdater\JiraUpdater\JiraStuff.vb:line 33
at JiraUpdater.Form1.ButtonMassUpdate_Click(Object sender, EventArgs e) in C:\Users\v709092\Documents\Visual Studio
2013\Projects\JiraUpdater\JiraUpdater\Form1.vb:line 98
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr
dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32
reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32
reason, ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[]
commandLine)
at JiraUpdater.My.MyApplication.Main(String[] Args) in :line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext
executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean
preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart() InnerException:
My code is a straight forward conversion of sample code found on the project WIKI page.
Dim myJira As Jira = Jira.CreateRestClient("JiraServer", "username", "password")
Dim myIssueQuery = From i In myJira.Issues
Where i.Project = "JiraProjectName"
Select i
Console.WriteLine( myIssueQuery.Count())
After doing some research I've become pretty convinced that this is an issue with how the LINQ provider is handling the query. This issue was reported to the developer a long while ago and marked as "Won't Fix" because the developer was not familiar with VB.
I'd really appreciate any assistance in either providing the developer relevant details to fix the issue on their side, or more realistically help pointing out what I'm doing wrong.
The Api for Jira can get a little complex and it is easy to end up using an older one that won't do what you want. I have had the best results using the nuget package "Atlassian.SDK".
With this it is relatively trivial to do what you want. this is C# code but I guess the vb.net can't be much different.
this.JiraConnection = Jira.CreateRestClient(jiraUrl, jiraUser, jiraPassword);
string jql = "project = TC";
IEnumerable<Issue> issues = this.JiraConnection.GetIssuesFromJql(jql, 100);
This allows you to use use the Jira Query Language to get the issues you want, which in my tests proved faster & more reliable than querying using Linq.
HTH

Create dynamic custom selector

I have MultiRecordEngine with a CustomSelector in which I'm trying to loop through many lines starting with different strings
Instead of a long list of 'ifs' like this (which works fine):
if (recordLine.Length == 0)
return null;
if (recordLine.StartsWith("EDI_DC40_U"))
return typeof(IDOC_EDI_DC40_U);
if (recordLine.StartsWith("E2EDL22"))
return typeof(IDOC_E2EDL22);
[...(some more ifs)...]
else
return null;
I wanted to try something more fancy. Having a class with the line prefix in its name for each kind of possible lines, I wanted to do this:
if (recordLine.Length == 0)
return null;
foreach(Type type in GetIDOCTypes()) {
// remove class prefix (IDOC_) from type name
string name = type.Name.Substring(6,type.Name.Length - 5);
if (recordLine.StartsWith(name))
return type;
}
return null
{"You must call BeginRead before use the engine in a foreach loop."} System.Exception {FileHelpers.FileHelpersException}
When I do this I get above Filehelper exception and I just don't get how, when and where I should call the 'BeginRead'...
Is my approach completely wrong?
Here is my sample project.
Thanks!
Have you got a sample project I can look at ? There is certainly nothing to prevent you from doing this specifically unless you are accessing the engines record array but I suspect that you actually returning null rather than a default type thus it doesn't know what type of record you have.
BeginRead must be called in order to start parsing the file in an asynchronous fashion. You haven't actually posted your code to show how you are reading the data. I'm on my phone right now but you must have something like:
var engine = new MultiRecordEngine(typeof (Orders),
typeof (Customer),
typeof (SampleType));
engine.RecordSelector = new RecordTypeSelector(CustomSelector);
var res = engine.ReadFile("Input.txt");
At which point the engine will start to loop through the records in a synchronous pattern calling your custom selector as it goes.
Diagnosis
Error handling
So I took a look at the sample project and it would appear that I failed to make sure to ask you whether you'd checked the inner exceptions. The full error you get from the test project is:
System.Exception was unhandled
HResult=-2146233088
Message=Selector failed to process correctly
Source=FileHelpers
StackTrace:
at FileHelpers.MultiRecordEngine.ReadStream(IRecordReader reader)
at FileHelpers.MultiRecordEngine.ReadFile(String fileName)
at FileHelpersLoopTest.IDOCFileClass.readIDOCFile()
at FileHelpersLoopTest.Program.Main(String[] args)
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
HResult=-2146233086
Message=Index and length must refer to a location within the string.
Parameter name: length
ParamName=length
Source=mscorlib
StackTrace:
at System.String.Substring(Int32 startIndex, Int32 length)
at FileHelpersLoopTest.IDOCFileClass.CustomSelector(MultiRecordEngine engine, String recordLine)
at FileHelpers.MultiRecordEngine.ReadStream(IRecordReader reader)
InnerException:
This should have immediately given you a hint from the inner exception as the stack trace says it failed with "Index and length must refer to a location within the string. Parameter name: length" inside System.String.Substring called from CustomSelector showing that it had indeed reached your code but you were using some incorrect indexing namely the length of the string.
Also, I noticed that you are checking the length of RecordLine but not whether it is null, so another error could occur there. I would advise using System.String.IsNullOrWhiteSpace inside of just checking the length to be safe.
Working code
The following works fine for me, but you still have work to do on matching your IODC types to the EDI types that were in the file. I tried to add the EDI_ prefix but the types were still a mismatch so I'll leave that part up to you as I'm assuming this is just down to it being sample data or a naming problem.
// Failing code block
if (string.IsNullOrWhiteSpace(recordLine))
return null;
var types = GetIDOCTypes();
foreach (Type type in types)
{
// remove class prefix (IDOC_) from type name
string name = "EDI_" + type.Name.Substring(6, type.Name.Length - 5);
Console.WriteLine($"{name} vs {recordLine.Substring(0, name.Length)}");
if (recordLine.StartsWith(name))
return type;
}
return null;
// END Failing code block

Get "ALL" Filename and Path from a Running Process VB.net

IT;S VB.NET not C# and i don't know how to exchange source from C# to VB.NET, THANKS
I want to get all paths from all running processes.
This is my source so far:
For Each p As Process In Process.GetProcesses
Try
ListBox1.Items.Add(p.MainModule.FileName.ToString)
Catch ex As Exception
RichTextBox1.Text = ex.Message
End Try
Next
But I can't get all path folders of the running processes.
If I examine the ex.Message, the response is like this
Unable to enumerate the process modules.
But if I not using ex.Message, the response is like this :
System.ComponentModel.Win32Exception was unhandled
ErrorCode=-2147467259
HResult=-2147467259
Message=A 32 bit processes cannot access modules of a 64 bit process.
NativeErrorCode=299
Source=System
StackTrace:
at System.Diagnostics.NtProcessManager.GetModuleInfos(Int32 processId, Boolean firstModuleOnly)
at System.Diagnostics.NtProcessManager.GetFirstModuleInfo(Int32 processId)
at System.Diagnostics.Process.get_MainModule()
at Anti_Cheat.Form1.Button6_Click(Object sender, EventArgs e) in c:\users\adiyatma\documents\visual studio 2012\Projects\Anti Cheat\Anti Cheat\Form1.vb:line 40
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(ApplicationContext context)
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at Anti_Cheat.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:
Can anyone help me?
Take a look at the so-question How to get the full path of running process?
Instead of
ListBox1.Items.Add(p.MainModule.FileName.ToString)
try
ListBox1.Items.Add(p.Modules(0).FileName.ToString)
Edit:
Have you tried to evaluate the property of different processes directly? Maybe there is a certain process you cannot access, resulting in the error described.
You can try to iterate trough the processes one by one by creating the following loop:
For Each p As System.Diagnostics.Process In System.Diagnostics.Process.GetProcesses()
Try
Console.WriteLine(p.Modules(0).FileName)
Catch ex As Exception
Console.WriteLine(String.Format("{0}: Error - {1}", p.ProcessName, ex.Message))
End Try
Next
By doing so, you should be able to determine the processes you're not allowed to access and get a couple of processes you should be able to experiment with.
Mate the problem is obvious, you are targeting 32-bit but are testing your app on a computer that has 64-bit installed system, that's why you get the error.
Message=A 32 bit processes cannot access modules of a 64 bit process.
to fix this issue you should make the target 64-bit, there IS NO SOLUTION for this...
if you know the famous procexp (sysinternals) it has two separate application, when the system is 32-bit it lauches an instance of 32-bit, but when it is 64-bit it lauches another separate process for the system...
so if you want to deal with this issue, you have to make two instances for system compability,
Hope this is helpful

VB.NET program crashing on other pc's

I'm trying to make a launcher for a game I am making. The program works perfectly fine on my other computer. I recently transferred the source to my computer. I'm having issues though, I tried debugging the application and I got this error.
I figured out the issue. This code right here
.GetVersionInfo("C:\Users\eriger777\Desktop\test\bin\Launcher.exe")
Was trying to execute a file that wasn't there :3.
An error occurred creating the form.
Here's the code that's causing the error.
<Global.System.Diagnostics.DebuggerStepThroughAttribute()> _
Protected Overrides Sub OnCreateMainForm()
Me.MainForm = Global.Launcher.frmMain
End Sub
End Class
Stack Trace
at Launcher.My.MyProject.MyForms.Create__Instance__[T](T Instance) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 190
at Launcher.My.MyProject.MyForms.get_frmMain()
at Launcher.My.MyApplication.OnCreateMainForm() in C:\Users\Gryphon\Downloads\Launcher\Launcher Source Main\Launcher Source\My Project\Application.Designer.vb:line 35
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.OnRun()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.DoApplicationModel()
at Microsoft.VisualBasic.ApplicationServices.WindowsFormsApplicationBase.Run(String[] commandLine)
at Launcher.My.MyApplication.Main(String[] Args) in 17d14f5c-a337-4978-8281-53493378c1071.vb:line 81
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
I figured out the issue. This code right here
.GetVersionInfo("C:\Users\eriger777\Desktop\test\bin\Launcher.exe")
Was trying to execute a file that wasn't there :3.