System.Assembly.Load() Error - vb.net

So I'm trying to load a Windows Forms application with Assembly.Load() and it's throwing this error when the bytes are trying to run:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.InvalidOperationException: SetCompatibleTextRenderingDefault must be called before the first IWin32Window object is created in the application.
at System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(Boolean defaultValue)
at CrypterTestFile.My.MyApplication.Main(String[] Args)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
at Test.Module1.Main() in C:\Users\Jeffrey\AppData\Local\Temporary Projects\Test\Module1.vb:line 15
Here's my code:
Dim entryPoint As MethodInfo = Assembly.Load(IO.File.ReadAllBytes(OFD.FileName)).EntryPoint
If entryPoint.GetParameters().Length = 0 Then
entryPoint.Invoke(Nothing, Nothing)
Else
entryPoint.Invoke(Nothing, New Object() {New String() {"0"}})
'Error is being thrown ^
End If
I'm not sure why this is happening, but it's just a simple Windows Forms application that has a label in the center of it.

Related

How to avoid IE Navigation error which says the RPC server is unavailable?

I have a service which is installed on my server. It suddenly stops with the following error log:
The RPC server is unavailable. (Exception from HRESULT: 0x800706BA) at System.RuntimeType.InvokeDispMethod(String name, BindingFlags invokeAttr, Object target, Object[] args, Boolean[] byrefModifiers, Int32 culture, String[] namedParameters)
at System.RuntimeType.InvokeMember(String name, BindingFlags bindingFlags, Binder binder, Object target, Object[] providedArgs, ParameterModifier[] modifiers, CultureInfo culture, String[] namedParams)
at Microsoft.VisualBasic.CompilerServices.VBBinder.InvokeMember(String name, BindingFlags invokeAttr, Type objType, IReflect objIReflect, Object target, Object[] args, String[] namedParameters)
at Microsoft.VisualBasic.CompilerServices.LateBinding.InternalLateCall(Object o, Type objType, String name, Object[] args, String[] paramnames, Boolean[] CopyBack, Boolean IgnoreReturn)
at Microsoft.VisualBasic.CompilerServices.NewLateBinding.LateCall(Object Instance, Type Type, String MemberName, Object[] Arguments, String[] ArgumentNames, Type[] TypeArguments, Boolean[] CopyBack, Boolean IgnoreReturn)
at vbIranStock.VBNetLib.vbScript4.Parsing(Object& objIE, Object& MainHTML, String[]& logid, String& logpath, String& Servicepath, Boolean& doPrint) in vbScript4.vb:line 119
at vbIranStock.VBNetLib.vbScript4.VbsRun4(Boolean doPrint) in vbScript4.vb:line 50
at WindowsServiceVB.Service1.MyProgram() in Service1.vb:line 106
at WindowsServiceVB.Service1.ScheduleService() in Service1.vb:line 73
When I refer to the specified Visual Basic code line, I see following codes:
119: objIE.Navigate("https://www.example.ir" + lblUrl)
I checked following RPC related services which all are running and are not stopped:
Remote Process Call
Remote Process Call Locator
DeCom Server Process Launcher
RPC Endpoint Mapper
Remote Access Connection Manager
Remote Access Auto Connection Manager
Remote Registry
Besides I checked firewall and added inbound and outbound rules to allow my service connection.
But again I have this error. Please help me to stop getting the error.

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.

Sitecore 8.1 : sitecore_fxm_web_index - Root item could not be found

We are using Sitecore 8.1 powered by Lucene index and xDB disabled.
We noticed that the CMS CA is quiet slow. While looking at logs noticed a number of error logged below:
ManagedPoolThread #4 2015:12:18 10:17:05 ERROR [Index=sitecore_fxm_web_index, Crawler=SitecoreItemCrawler, Database=web] Root item could not be found: /sitecore/system/Marketing Control Panel/fxm/.
ManagedPoolThread #15 2015:12:18 10:17:08 ERROR Exception
Exception: System.Reflection.TargetInvocationException
Message: Exception has been thrown by the target of an invocation.
Source: mscorlib
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object[] parameters, Object[] arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Sitecore.Reflection.ReflectionUtil.InvokeMethod(MethodInfo method, Object[] parameters, Object obj)
at Sitecore.Reflection.MethodInstance.Invoke()
at Sitecore.Jobs.JobRunner.RunMethod(JobArgs args)
at (Object , Object[] )
at Sitecore.Pipelines.PipelineMethod.Invoke(Object[] parameters)
at Sitecore.Pipelines.CorePipeline.Run(PipelineArgs args)
at Sitecore.Pipelines.CorePipeline.Run(String pipelineName, PipelineArgs args, String pipelineDomain, Boolean failIfNotExists)
at Sitecore.Jobs.Job.ThreadEntry(Object state)
Nested Exception
Exception: System.InvalidOperationException
Message: [Index=sitecore_fxm_web_index, Crawler=SitecoreItemCrawler, Database=web] Root item could not be found: /sitecore/system/Marketing Control Panel/fxm/.
Source: Sitecore.ContentSearch
at Sitecore.ContentSearch.SitecoreItemCrawler.get_RootItem()
at Sitecore.ContentSearch.SitecoreItemCrawler.IsAncestorOf(Item item)
at Sitecore.ContentSearch.SitecoreItemCrawler.IsExcludedFromIndex(IIndexableUniqueId indexableUniqueId, Boolean checkLocation)
at Sitecore.ContentSearch.SitecoreItemCrawler.Update(IProviderUpdateContext context, IIndexableUniqueId indexableUniqueId, IndexEntryOperationContext operationContext, IndexingOptions indexingOptions)
at Sitecore.ContentSearch.AbstractSearchIndex.PerformUpdate(IEnumerable`1 indexableInfo, IndexingOptions indexingOptions)
at Sitecore.ContentSearch.AbstractSearchIndex.Update(IEnumerable`1 indexableInfo)
Could someone please suggest why sitecore is looking for Web forms for marketing index which we don't need it?
Thanks
Sitecore looks for sitecore_fxm_web_index index. It's not a WFFM index - it's Federated Experience Manager Index. This is an integral part of Sitecore 8.1.
Here you can read more about Federated Experience Manager.
Looks like you're missing root item of this index, which is /sitecore/system/Marketing Control Panel/fxm/. I guess you're migration process from Sitecore 7 (which you mentioned in other question) to Sitecore 8.1 was not 100% successful.

Wix- Invoke custom actions during rollback

We have a custom action that has to be executed during roll back before file removal. How can we add a particular custom action to be executed as a first step during rollback?
We have the below code but it is not working.
<CustomAction Id="Delete_Directory_Rollback" BinaryKey="UnifiedAgentCustomActions.dll" DllEntry="DeleteDirectory" Execute="rollback" />
<Custom Action="Delete_Directory_Rollback" Before="RemoveFiles" >NOT (REMOVE="ALL")</Custom>
Custom Action
string InstallPath = session["INSTALLDIR"];
DeleteDir(InstallPath, session);
Error message:
Exception thrown by custom action:
System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.Deployment.WindowsInstaller.InstallerException: Cannot access session details from a non-immediate custom action
at Microsoft.Deployment.WindowsInstaller.Session.ValidateSessionAccess()
at Microsoft.Deployment.WindowsInstaller.Session.get_Item(String property)
at UnifiedAgentCustomActions.CustomActions.DeleteDirectory(Session session)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle.InvokeMethod(Object target, Object arguments, Signature sig, Boolean constructor)
at System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Object parameters, Object arguments)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object parameters, CultureInfo culture)
at Microsoft.Deployment.WindowsInstaller.CustomActionProxy.InvokeCustomAction(Int32 sessionHandle, String entryPoint, IntPtr remotingDelegatePtr)
CustomAction Delete_Directory_Rollback returned actual error code 1603 but will be translated to success due to continue marking.
Expected Result
The same CA is working during uninstall but during roll back it is not working.
Are you reading/writing session property in that custom action.
If yes,then that may be your problem, as seen in log.

Service Reference return value size issue

I have a Web Service method which returns a list of objects List<T>
When the the length of the list is 9000 objects or so, the service returns this list well, but when the length is like 12000 or more objects, the service returns an error:
The underlying connection was closed: The connection was closed unexpectedly.
`System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> Microsoft.FSharp.Core.FailureException: System.Net.WebException: The underlying connection was closed: The connection was closed unexpectedly.
at System.Net.HttpWebRequest.GetResponse()
at .$Type.httprequest.webRespBase#162#162(DelegatingHttpReq x#162, Unit _unit)
at .$Type.httprequest.webRespBase#162#162(DelegatingHttpReq x#162, Unit _unit)
at Storm.Types.WebHttp.DelegatingHttpReq.GetResponse()
at System.Web.Services.Protocols.WebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.HttpWebClientProtocol.GetWebResponse(WebRequest request)
at System.Web.Services.Protocols.SoapHttpClientProtocol.Invoke(String methodName, Object[] parameters)
at ServiceLogic.LoadRestriccionCanalPlano(String CodRuta, String CodTipoRuta)
--- End of inner exception stack trace ---
at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
at Storm.UI.Forms.FormMainOps.clo#651.Invoke(Object[] methodParams#41)
at .$Type.bgworker.run#51#57_2.Invoke(DoWorkEventArgs dArgs)
at .$Type.bgworker.run#51#57_1.Invoke(Object sender, DoWorkEventArgs e)
at System.ComponentModel.BackgroundWorker.WorkerThreadStart(Object argument)`
I've tried changing the maxBufferSize maxBufferPoolSize maxReceivedMessageSize maxStringContentLength maxArrayLength etc in the binding configuration on the Web.config, but it still not working.
Any other ideas?
I've already found a solution in this post
The underlying connection was closed: The connection was closed unexpectedly