kontent-ai / model-generator-net

Kontent.ai .NET model generator.
https://www.nuget.org/packages/Kontent.Ai.ModelGenerator
MIT License
17 stars 19 forks source link

Self-contained executable fails for MAPI model generation #164

Closed pokornyd closed 1 year ago

pokornyd commented 1 year ago

Brief bug description

For self-contained use, the publishing is configured for single-file deployment, via PublishSingleFile=true. Invoking the generator from said executable fails with a familiar Object reference not set to an instance of object error if you pass --managementapi true --apikey <apikey>.

The error is not present when used as a .NET cli tool or if the self-contained app is not published into single file. Possibly introduced by changes in .NET 6.0 as it sounds similar to https://github.com/CarterCommunity/Carter/issues/291, though I'm not familiar with carter or if it's used in any of the generator's dependencies.

Repro steps

  1. Download the self-contained app from the repo or generate one using the PS script.
  2. Run the generator from the executable with --projectid <projid> --managementapi true --apikey <apikey> params
  3. See error

Expected behavior

MAPI models are generated.

Test environment

Sevitas commented 1 year ago

I've found that, there is an issue in the management-sdk-net, which causes generators to fail.

To fix this issue, we need to fix the issue and then bump the management-sdk-net nuget.