Closed FelixReuthlinger closed 1 year ago
What OS are you using? If you are not using Windows this might the problem: https://learn.microsoft.com/en-us/dotnet/api/system.drawing?view=net-6.0#remarks You could try to resolve it by installing this nuget package: https://www.nuget.org/packages/System.Drawing.Common/
I am using Win11 latest versions to compile and run the dll. I also tried referring the System.Drawing.Common and also repacked it into the target dll, but that does not change the program to later fail on missing this dependency
Is this maybe due to using .NETFramework v4.6.2 ? I am not a specialist in dotnet, but the page you linked I also found before and it mentions on .net 5 and .net 6, right?
Hum, not sure it could be because of the framework version, there is no reason .NET 4.6.2 doesn't include the Color type. Could you try to create a console application with the same framework version please? (but outside unity) so we could determine if the problem is coming from Unity.
I have just tested on a Windows machine and it works fine outside Unity, so the problem is coming from Unity. Have you tried this already? https://stackoverflow.com/a/70217835
Thanks for the answers. What I did now is to copy the System.Drawing.dll into my project and let it, together with Syste.Drawing.Common.dll get repacked to the target .dll - but this still does not change the issue I am facing...
Maybe bit stupid question: why does the DotNetGraph require colors if it will just write text files that I later will import into GraphViz or similar? The text file would not require things like a color, would it? Can I somehow work around this need for the extra libraries to just assemble the text file?
There is no stupid question! It requires the Color type because I wanted the users to be able to set the various color properties (node/edge color/background...) using a .NET type (converted to hex format in the compiled dot file). But since it can cause problems in some environments I might create my own color type based on the System.Drawing's one.
for what I am trying to do (drawing graphs of in-game objects) colorless would also be fine. Any ideas on when you might have time to do a change that does not require System.Drawing?
I've just pushed a beta version with my own color type DotColor
, it is available here: https://www.nuget.org/packages/DotNetGraph/3.0.0-beta3
This is version 3.0 so it will require some changes on your side, creating graph/node/edge is a bit different and using fluent extension methods. You can check the readme file on master for some examples, it shouldn't be difficult!
Very nice :) Are you using a special StringWriter lib that supports async? I get this error copying the code from README: Type 'System.IO.StringWriter' used in a 'await using' declaration must be implicitly convertible to 'System.IAsyncDisposable' or implement a suitable 'DisposeAsync' method. Did you mean to use 'using' instead of 'await using'?
btw I am not sure if you really need to use the async writer, do you? calling like this did also work (at least for a small example
var writer = new StringWriter();
directedGraph.CompileAsync(new CompilationContext(writer, new CompilationOptions()));
var result = writer.GetStringBuilder().ToString();
You don't need the await using on the string writer, this is a new feature of .net that is not in .net framework. But you still need to await the CompileAsync method.
@FelixReuthlinger Is it all good? Can I close the issue?
yes, sorry, been hiking the last couple of days ;) works, thx a lot :D
Hey, I am using the latest from DotNetGraph from Nuget and compiling into a dotnet v 4.6.2 project. Getting this error:
Any clue what I can do about this?