structurizr / dotnet-extensions

Structurizr for .NET extensions
Apache License 2.0
18 stars 9 forks source link

dotnet-extensions v0.9.3.0, Does not work with Struturizr.Core 1.0.0 #4

Open jeffcollaboro opened 3 years ago

jeffcollaboro commented 3 years ago

Just a heads up to anyone hitting an exception :

Whilst trying to write a workspace e.g. plantUMLWriter.Write(workspace, streamWriter);

Internally this fails as the code attempts to use the RelationshipViewExtensions class to get the direction of the relationship using the GetDirection extension (SetDirection also fails). It attempts to cast the relationship view into a Structurizr.ModelItemView that has been deprecated and removed from Structurizr between v0.9.7 and v1.0.0.

Nuget is not your friend here, it defaults to the latest and greatest, and there are no version dependencies defined between the two packages.

The easy fix is to roll back to v0.9.7 (or 0.9.3) of Structurizr.Core

kirchsth commented 3 years ago

I fixed the build problems on my branch (The direction is stored in Position as workaround). You can test it

But the I didn't update the generated code that it works with the latest PlantUML version (I will creata a PR as soon this is finished)

BR Helmut

kirchsth commented 3 years ago

@jeffcollaboro: with PR #5 you should have a working version which creates correct plantuml-stdlib/C4-PlantUML v2.2.0 diagrams (not all new features are used atm)

@simonbrowndotje: Atm RelationshipView specific "DirectionValues" are stored in Position (I found no other usefull place). Can we (re)add Properties to RelationshipView that extensions are possible.

JohnLeyva commented 2 years ago

The issue is still present the following reproduces the issue

            var plantUmlWriter = new C4PlantUmlWriter();
            plantUmlWriter.Write(workspace, stringWriter);
kirchsth commented 2 years ago

Did you test it with my branch?

JohnLeyva commented 2 years ago

I think with the branch actually works, but not with the latest released packages

<Project Sdk="Microsoft.NET.Sdk">
  <PropertyGroup>
    <OutputType>Exe</OutputType>
    <TargetFramework>net60</TargetFramework>
  </PropertyGroup>
  <ItemGroup>
    <PackageReference Include="Structurizr.Client" Version="1.0.0" />
    <PackageReference Include="Structurizr.PlantUML" Version="0.9.3" />
  </ItemGroup>
</Project>
simonbrowndotje commented 2 years ago

With the Structurizr CLI having much better support for exporting views to PlantUML (and I appreciate it's written in Java), I'm not actively supporting the .NET exporters at this time ... I would recommend forking the repo (and creating your own Nuget package if required).