dotnet-extensions icon indicating copy to clipboard operation
dotnet-extensions copied to clipboard

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

Open jeffcollaboro opened this issue 3 years ago • 6 comments

Just a heads up to anyone hitting an exception :

  • {"Could not load type 'Structurizr.ModelItemView' from assembly 'Structurizr.Core, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null'.":"Structurizr.ModelItemView"}

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

jeffcollaboro avatar Jun 03 '21 12:06 jeffcollaboro

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 avatar Jun 22 '21 20:06 kirchsth

@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.

kirchsth avatar Jun 23 '21 11:06 kirchsth

The issue is still present the following reproduces the issue

            var plantUmlWriter = new C4PlantUmlWriter();
            plantUmlWriter.Write(workspace, stringWriter);

JohnLeyva avatar Apr 29 '22 17:04 JohnLeyva

Did you test it with my branch?

kirchsth avatar Apr 29 '22 20:04 kirchsth

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>

JohnLeyva avatar May 17 '22 17:05 JohnLeyva

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).

simonbrowndotje avatar May 17 '22 17:05 simonbrowndotje