Pillow
Pillow
CC#
Created by Pillow on 8/4/2023 in #help
❔ Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly
Full error:
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'xTile, Version=2.0.4.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'xTile, Version=2.0.4.0, Culture=neutral, PublicKeyToken=null'
at ToasterMapCLI.ToasterMapCLI.Main(String[] args)
Unhandled exception. System.IO.FileNotFoundException: Could not load file or assembly 'xTile, Version=2.0.4.0, Culture=neutral, PublicKeyToken=null'. The system cannot find the file specified.
File name: 'xTile, Version=2.0.4.0, Culture=neutral, PublicKeyToken=null'
at ToasterMapCLI.ToasterMapCLI.Main(String[] args)
the part of the csproj for it
<ItemGroup>
<Reference Include="xTile" HintPath="C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\xTile.dll" />
</ItemGroup>
<ItemGroup>
<Reference Include="xTile" HintPath="C:\Program Files (x86)\Steam\steamapps\common\Stardew Valley\xTile.dll" />
</ItemGroup>
that dll exists, both in the hintpath and the compiled folders though
18 replies
CC#
Created by Pillow on 8/4/2023 in #help
System.InvalidOperationException: ... cannot be serialized because it does not have a parameterles..
I'm trying to make an AOT class library, but I am unable to run it once compiled. Here's the bit of code it doesn't like
var parser = new TMXParser();
parser.Export(tmx, tmxpath);
var parser = new TMXParser();
parser.Export(tmx, tmxpath);
and the full error:
Unhandled Exception: System.InvalidOperationException: There was an error generating the XML document.
---> System.InvalidOperationException: TMXTile.TMXMap cannot be serialized because it does not have a parameterless constructor.
at System.Xml.Serialization.TypeDesc.CheckSupported() + 0x44
at System.Xml.Serialization.TypeScope.GetTypeDesc(Type, MemberInfo, Boolean, Boolean) + 0xa5
at System.Xml.Serialization.ModelScope.GetTypeModel(Type, Boolean) + 0x5a
at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type, XmlRootAttribute, String) + 0x50
at System.Xml.Serialization.XmlSerializer.GetMapping() + 0x4f
at System.Xml.Serialization.XmlSerializer.SerializeUsingReflection(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id) + 0x1a
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id) + 0x84
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id) + 0x1a8
at TMXTile.TMXParser.Export(TMXMap, Stream, DataEncodingType) + 0x97
at TMXTile.TMXParser.Export(TMXMap, String, DataEncodingType) + 0x73
at ToasterMap.ToasterMap.Init(IntPtr, IntPtr) + 0xef
Unhandled Exception: System.InvalidOperationException: There was an error generating the XML document.
---> System.InvalidOperationException: TMXTile.TMXMap cannot be serialized because it does not have a parameterless constructor.
at System.Xml.Serialization.TypeDesc.CheckSupported() + 0x44
at System.Xml.Serialization.TypeScope.GetTypeDesc(Type, MemberInfo, Boolean, Boolean) + 0xa5
at System.Xml.Serialization.ModelScope.GetTypeModel(Type, Boolean) + 0x5a
at System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping(Type, XmlRootAttribute, String) + 0x50
at System.Xml.Serialization.XmlSerializer.GetMapping() + 0x4f
at System.Xml.Serialization.XmlSerializer.SerializeUsingReflection(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id) + 0x1a
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id) + 0x84
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id) + 0x1a8
at TMXTile.TMXParser.Export(TMXMap, Stream, DataEncodingType) + 0x97
at TMXTile.TMXParser.Export(TMXMap, String, DataEncodingType) + 0x73
at ToasterMap.ToasterMap.Init(IntPtr, IntPtr) + 0xef
17 replies
CC#
Created by Pillow on 8/3/2023 in #help
❔ [UnmanagedCallersOnly] with a function that takes a string
I'm trying to make a C# library, and had success with
using System.Runtime.InteropServices;

namespace ToasterMap
{
static class ToasterMap
{
[UnmanagedCallersOnly(EntryPoint = "add")]
public static int Add(int a, int b) => a + b;
}
}
using System.Runtime.InteropServices;

namespace ToasterMap
{
static class ToasterMap
{
[UnmanagedCallersOnly(EntryPoint = "add")]
public static int Add(int a, int b) => a + b;
}
}
but once I made it
using System.Runtime.InteropServices;
using System;

namespace ToasterMap
{
static class ToasterMap
{
public static String tbinPath;

[UnmanagedCallersOnly(EntryPoint = "add")]
public static int Add(int a, int b) => a + b;

[UnmanagedCallersOnly(EntryPoint = "init")]
public static void Init(string tbinPath)
{
if (!File.Exists(tbinPath))
{
throw new Exception("TBin path does not exist");
}

ToasterMap.tbinPath = tbinPath;
}
}
}
using System.Runtime.InteropServices;
using System;

namespace ToasterMap
{
static class ToasterMap
{
public static String tbinPath;

[UnmanagedCallersOnly(EntryPoint = "add")]
public static int Add(int a, int b) => a + b;

[UnmanagedCallersOnly(EntryPoint = "init")]
public static void Init(string tbinPath)
{
if (!File.Exists(tbinPath))
{
throw new Exception("TBin path does not exist");
}

ToasterMap.tbinPath = tbinPath;
}
}
}
It now fails to compile with:
C:\Coding\C#\ToasterMap\ToasterMap.cs(14,33): error CS8894: Cannot use 'string' as a
parameter type on a method attributed with 'UnmanagedCallersOnly'. [C:\Coding\C#\To
asterMap\ToasterMap.csproj]
C:\Coding\C#\ToasterMap\ToasterMap.cs(14,33): error CS8894: Cannot use 'string' as a
parameter type on a method attributed with 'UnmanagedCallersOnly'. [C:\Coding\C#\To
asterMap\ToasterMap.csproj]
I understand that it seems I can't use string as a type, but not sure what else to use? char[] and byte[] also fails
9 replies
CC#
Created by Pillow on 8/2/2023 in #help
❔ C# library usable from python
I was wondering how to do this, and stumbled upon https://stackoverflow.com/a/29854281 which answered the question, but then caused two new ones. 1. can this be done without .NET installed on the user's machine 2. how do I create a project for that in VS? Do I just choose class library or something else?
27 replies
CC#
Created by Pillow on 1/8/2023 in #help
❔ CS version of python dictionary
Is there a good alternative to python's dictionaries? As in json "objects".
19 replies
CC#
Created by Pillow on 12/22/2022 in #help
❔ WinForms textbox doesn't work with newlines
5 replies
CC#
Created by Pillow on 12/22/2022 in #help
✅ Button doesn't trigger function for it
6 replies
CC#
Created by Pillow on 12/22/2022 in #help
❔ Is it possible to have a 'big' textbox in a WinForm?
4 replies
CC#
Created by Pillow on 10/26/2022 in #help
.lnk parsing
This tool https://github.com/securifybv/ShellLink seems to be decent for parsing/modifying/creating .lnk files, but I can't find/know how you use it, anyone used it/know how to use it? (Or any other options)
23 replies