We're sorry GroupDocs doesn't work properply without JavaScript enabled.

Free Support Forum - groupdocs.com

Groupdocs.Assembly - .NET 6

Hello.

I looked at this topic but still no luck ASP.NET Core 6.0.7 Support

I’m evaluating Groupdocs.Assembly and am trying to run a simple concole app in .NET 6

I added all the internal packages but still get a runtime error:

System.TypeInitializationException
HResult=0x80131534
Message=The type initializer for ' ​ ’ threw an exception.
Source=GroupDocs.Assembly
StackTrace:
at ​ . (String )
at ​ . ( , ​ , String , Boolean , Object[] )
at ​ . ( ​ , String , ​ , String , ​ , Boolean )
at GroupDocs.Assembly.DocumentAssembler.( ​ , String , ​ , String , LoadSaveOptions , DataSourceInfo[] )
at GroupDocs.Assembly.DocumentAssembler.AssembleDocument(String sourcePath, String targetPath, LoadSaveOptions loadSaveOptions, DataSourceInfo[] dataSourceInfos)
at GroupDocs.Assembly.DocumentAssembler.AssembleDocument(String sourcePath, String targetPath, DataSourceInfo[] dataSourceInfos)
at Program.$(String[] args) in C:\Users\mark\source\repos\GroupDocs\Program.cs:line 17

This exception was originally thrown at this call stack:
[External Code]

Inner Exception 1:
TypeInitializationException: The type initializer for ' ​ ’ threw an exception.

Inner Exception 2:
InvalidOperationException: Operation is not valid due to the current state of the object.

The code:

using GroupDocs.Assembly;

Console.WriteLine(“Hello World!”);

//Setting up source document template
const String strDocumentTemplate = “c:\temp\Mark.docx”;
//Setting up destination Markdown reports
const String strDocumentReport = “c:\temp\test.docx”;
//Setting up description variable
const string description = "GroupDocs.Assembly for .NET is a class library that enables you to generate documents in popular " +
"office and email file formats based upon template documents and data obtained from various sources " +
“including databases, XML, JSON, OData, objects of custom .NET types, external documents, and more.”;

DocumentAssembler assembler = new DocumentAssembler();
//Assemble Document
assembler.AssembleDocument(
strDocumentTemplate,
strDocumentReport,
new DataSourceInfo(“GroupDocs.Assembly for .NET”, “FIRSTNAME”),
new DataSourceInfo(description, “TITLE”));

When running the exact same code in a .NET Core 3.1 console app, it works just fine.

@markstarhill

Please take a look at this console application.zip (10.1 KB), you have to specify source and output files.
Or try to add following dependencies in your .csproj file:

<PropertyGroup>
	<OutputType>Exe</OutputType>
	<LangVersion>10.0</LangVersion>
    <TargetFramework>net6.0</TargetFramework>
</PropertyGroup>

Let us know if it works at your end.

This is my project file

<Project Sdk="Microsoft.NET.Sdk">

  <PropertyGroup>
    <OutputType>Exe</OutputType>
	<LangVersion>10.0</LangVersion>
    <TargetFramework>net6.0</TargetFramework>
    <ImplicitUsings>enable</ImplicitUsings>
    <Nullable>enable</Nullable>
  </PropertyGroup>

  <ItemGroup>
    <PackageReference Include="Aspose.BarCode" Version="22.10.0" />
    <PackageReference Include="Aspose.Cells" Version="22.11.0" />
    <PackageReference Include="Aspose.Email" Version="22.10.0" />
    <PackageReference Include="Aspose.Slides.NET" Version="22.10.0" />
    <PackageReference Include="Aspose.Words" Version="22.11.0" />
    <PackageReference Include="GroupDocs.Assembly" Version="22.2.0" />
  </ItemGroup>

</Project>

@markstarhill

Could you please share the complete application using that issue could be reproduced at our end?

When changing your application to use docx files I get the same error as before.

See attached console appGroupDocs.zip (182.9 KB)

When running the exact same code in a core 3.1 console app, it works.

See attached project blah.zip (126.5 KB)

@markstarhill

Thanks for sharing the details. We are investigating this issue. Your investigation ticket ID is *ASSEMBLYNET-2278. We’ll notify you in case of any update.

Any progress? I cant see the correct status of the issue below, it shows ASSEMBLYNET-227 Closed. image.png (7.9 KB)

1 Like

@markstarhill

This issue is fixed. The new release will be available to download in about two weeks. As there’s any further update, we’ll notify you.

@Atir_Tahir That’s great. Thanks!

1 Like

@markstarhill

You’re welcome.