Closed trsh closed 3 years ago
Ah, indeed, I realized now that some resources weren't packed in the zip.
Are these what you mean? But you can still see the Program.cs and Readme, right?
Yes. I ended up copying City.slxg
over with all assets and submodules. But I am getting this error with out the exact line. Please tell me what I am doing wrong.
Sceelix.MyExternalApplication.zip
System.InvalidCastException: Specified cast is not valid.
at Sceelix.Extensions.XmlNodeExtension.GetAttributeOrDefault[T](XmlNode node, String attributeName)
at Sceelix.Core.Graphs.GraphLoad.LoadNodes(XmlElement root, Graph graph, IProcedureEnvironment procedureEnvironment, Dictionary`2 graphCache)
I got it working on my side, but only after adjusting the assembly references. If I'm looking at it correctly, you have installed Sceelix under C:\Engines\Sceelix
, so the library assemblies are under C:\Engines\Sceelix\Bin
. Are your project assembly references also pointing to these same assemblies?
I got it working on my side, but only after adjusting the assembly references. If I'm looking at it correctly, you have installed Sceelix under
C:\Engines\Sceelix
, so the library assemblies are underC:\Engines\Sceelix\Bin
. Are your project assembly references also pointing to these same assemblies?
Yes
@pabsilva any chance you could help me solve this issue?
Sorry, these last couple of weeks have been very busy for me.
I've tried to set up and environment exactly like yours, namely installing Sceelix under C:\Engines
, in order to try to reproduce your issue. And I managed to do so.
Now, the solution is to replace line 25:
SceelixDomain.LoadAssembliesFrom("C:\\Engines\\Sceelix\\Bin");
with
SceelixDomain.LoadAssembliesFromCurrentDirectory();
or
SceelixDomain.LoadAssembliesFrom("");
Now for the explanation:
Basically this was a case of .NET Dll Hell. When you build this console project, Visual Studio creates a copy of the referenced Sceelix assemblies, places them into the Debug (or Release folder) and loads these assemblies into its Assembly Domain when the console application starts. However, on this line 25, you were loading a new copy of the assemblies (this time, from the C:\Engine\Sceelix
), which created a mismatch/conflict of assembly versions. This is known to cause all sorts of confusing effects.
So the solution is to make sure that the engine assemblies that we're referencing and loading are at the same location when the application runs (hence the use of the LoadAssembliesFromCurrentDirectory
function).
At any rate, in the future I'll try to find out a way to have these code samples deployed in such a way that the assembly paths and references are updated, so as to match the user's machine. This should make the process less error-prone.
When I change the line I am getting these:
System.Exception: Could not find type 'PathCreateProcedure'.
The procedure may have been moved, deleted or simply not loaded.
at Sceelix.Core.Procedures.InvalidProcedure.Run()
at Sceelix.Core.Procedures.Procedure.ExecuteRound()
Sceelix.Core.Exceptions.GraphException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index ---> System.ArgumentOutOfRangeException: Index was out of range. Must be non-negative and less than the size of the collection.
Parameter name: index
at System.ThrowHelper.ThrowArgumentOutOfRangeException(ExceptionArgument argument, ExceptionResource resource)
at Sceelix.Core.IO.OutputReferenceCollection.get_Item(Int32 index)
at Sceelix.Core.Graphs.Execution.ExecutionNode.Execute()
--- End of inner exception stack trace ---
at Sceelix.Core.Graphs.Execution.ExecutionNode.Execute()
at Sceelix.Core.Procedures.GraphProcedure.Run()
at Sceelix.Core.Procedures.Procedure.ExecuteRound()
Finished Execution.
Thats on excecution enabled
//once we have finished the parameterization, execute it!
procedure.Execute();
Never mind. Needed to add the required DLL.
In
Sceelix.MyExternalApplication
there is noSampleProject
folder. It shows up in Visual Studio solution, but is physically missing. I used windows 64 bit installer.