Comments (10)
Hi Felix, It took me some time to find the issue, but the ILRepacker caused it. When you comment out the GraphReaderWriter lib line, the problem suddenly disappears.
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="ILRepacker" AfterTargets="Build">
<ItemGroup>
<InputAssemblies Include="$(TargetPath)" />
<!--<InputAssemblies Include="$(OutputPath)\GraphMLReaderWriter.dll" />-->
</ItemGroup>
<ILRepack Parallel="true" DebugInfo="true" Internalize="true" InputAssemblies="@(InputAssemblies)" OutputFile="$(TargetPath)" TargetKind="SameAsPrimaryAssembly" LibraryPath="$(OutputPath)" />
</Target>
</Project>
There was a respective question on StackOverflow about this topic, too.
On https://www.phillipsj.net/posts/using-ilrepack-with-dotnet-core-sdk-and-dotnet-standard/, it describes how to deal with such a situation. I have changed your code respectively:
<?xml version="1.0" encoding="utf-8"?>
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Target Name="ILRepacker" AfterTargets="Build">
<ItemGroup>
<InputAssemblies Include="$(TargetPath)" />
</ItemGroup>
<ItemGroup>
<!-- Dot not internalize any types inside this assembly -->
<InternalizeExcludeAssemblies Include="$(OutputPath)\GraphMLReaderWriter.dll" />
</ItemGroup>
<ILRepack Parallel="true" DebugInfo="true" Internalize="true" InputAssemblies="@(InputAssemblies)" OutputFile="$(TargetPath)" TargetKind="SameAsPrimaryAssembly" LibraryPath="$(OutputPath)" />
</Target>
</Project>
You can see the changes I have made to test it on https://github.com/budul100/ValheimGraphML/tree/e439a2661cb0d1daff2fd0b3187eb1b3c7919b14/ValheimGraphML.
from graphmlreaderwriter.
Hi Felix, When you say you have repacked it into another dll: Is the resulting class public, too?
GraphMLType is the class representing the resulting, serialized GraphML output and can be found here. This class must be public to serialize it.
Would you happen to have your code somewhere available to get an idea of the issue?
from graphmlreaderwriter.
I think it was all public in my model I used for serializing, but had the code dropped, will need to set up some again
from graphmlreaderwriter.
I am happy to have a look at the code if it is available ;-)
from graphmlreaderwriter.
Here you go: https://github.com/FelixReuthlinger/ValheimGraphML/blob/master/ValheimGraphML/ValheimGraphMLPlugin.cs
[Info : BepInEx] Loading [ValheimGraphML 0.0.1]
[Error : Unity Log] InvalidOperationException: GraphML.GraphMLType is inaccessible due to its protection level. Only public types can be processed.
Stack trace:
System.Xml.Serialization.TypeDesc.CheckSupported () (at <0f9699188f0c414ea6fb5557f5c16d15>:0)
System.Xml.Serialization.TypeScope.GetTypeDesc (System.Type type, System.Reflection.MemberInfo source, System.Boolean directReference, System.Boolean throwOnError) (at <0f9699188f0c414ea6fb5557f5c16d15>:0)
System.Xml.Serialization.TypeScope.GetTypeDesc (System.Type type, System.Reflection.MemberInfo source, System.Boolean directReference) (at <0f9699188f0c414ea6fb5557f5c16d15>:0)
System.Xml.Serialization.ModelScope.GetTypeModel (System.Type type, System.Boolean directReference) (at <0f9699188f0c414ea6fb5557f5c16d15>:0)
System.Xml.Serialization.ModelScope.GetTypeModel (System.Type type) (at <0f9699188f0c414ea6fb5557f5c16d15>:0)
System.Xml.Serialization.XmlReflectionImporter.ImportTypeMapping (System.Type type, System.Xml.Serialization.XmlRootAttribute root, System.String defaultNamespace) (at <0f9699188f0c414ea6fb5557f5c16d15>:0)
System.Xml.Serialization.XmlSerializer..ctor (System.Type type, System.String defaultNamespace) (at <0f9699188f0c414ea6fb5557f5c16d15>:0)
System.Xml.Serialization.XmlSerializer..ctor (System.Type type) (at <0f9699188f0c414ea6fb5557f5c16d15>:0)
GraphMLWriter.Writer`1[T]..ctor (System.Text.Encoding encoding) (at <e2187ad1d51f4c31812700c6b5534a5a>:0)
GraphMLWriter.Writer`1[T]..ctor () (at <e2187ad1d51f4c31812700c6b5534a5a>:0)
ValheimGraphML.ValheimGraphMLPlugin.Awake () (at C:/Users/felix/source/ValheimGraphML/ValheimGraphML/ValheimGraphMLPlugin.cs:22)
UnityEngine.GameObject:AddComponent(Type)
BepInEx.Bootstrap.Chainloader:Start()
UnityEngine.UI.Image:OnCanvasHierarchyChanged()
from graphmlreaderwriter.
thx for the hint ;)
I tried the small change you suggested, but it seems not internalizing the assembly will also not work, since it then will not be able to load the library properly:
[Info : BepInEx] Loading [ValheimGraphML 0.0.1]
[Error : Unity Log] FileNotFoundException: Could not load file or assembly 'GraphMLReaderWriter, Version=1.1.3.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies.
Stack trace:
UnityEngine.GameObject:AddComponent(Type)
BepInEx.Bootstrap.Chainloader:Start()
UnityEngine.UI.Image:OnCanvasHierarchyChanged()
This might be a problem on how Unity and BepInEx do load libraries.
I am absolutely not a specialist in c#, so bare with me, still not understanding it.
Usually I can use any kind of library with nuget and repacking properly, first time I get into such issues.
from graphmlreaderwriter.
But btw, with this setup it works fine, as long as I put the GraphMLReaderWriter.dll into the path loaded with the plugin. No clue, why it would not accept repacking it.
from graphmlreaderwriter.
ok, so, with that I can use it, not repacking, but can use. is there a place, where I can read how to use the framework? from reading the code itself I personally cannot imagine tbh ;) I was having a look into the unit tests, but there is not much more to get from it than some basics. generated graphml does not show node names in yed for example.
from graphmlreaderwriter.
Hi Felix, Sorry for my late reply. I have a lot of business to do currently. I am going to provide a simple example by next week.
from graphmlreaderwriter.
Hi Felix, I have added a simple example for writing and reading graphML files. I have also added some explanations in the ReadMe file.
from graphmlreaderwriter.
Related Issues (1)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from graphmlreaderwriter.