Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

KiotaLock fails instantiation on the browser-wasm runtime #2147

Closed
andreaTP opened this issue Jan 11, 2023 · 5 comments · Fixed by #2149
Closed

KiotaLock fails instantiation on the browser-wasm runtime #2147

andreaTP opened this issue Jan 11, 2023 · 5 comments · Fixed by #2149
Assignees
Labels
generator Issues or improvements relater to generation capabilities. type:bug A broken experience
Milestone

Comments

@andreaTP
Copy link
Contributor

First of all, again, great work!
I have been hacking on what we discussed here #2131 , and everything but this little detail seems to work out of the box!

Running Kiota.Builder in the browser-wasm runtime I'm getting this exception when KiotaLock is instantiated:

Kiota.Builder.Lock.KiotaLock..ctor(GenerationConfiguration config)
   at Kiota.Builder.KiotaBuilder.UpdateLockFile(CancellationToken cancellationToken)
   at Kiota.Builder.KiotaBuilder.GenerateClientAsync(CancellationToken cancellationToken)
   at KiotaJs.Generate(String url, String language, String clientClassName, String namespaceName)
Error: Object reference not set to an instance of an object.

** Reproducer **

  • git clone https://github.com/andreaTP/kiota-wasm-poc.git
  • comment out this section of the Dockerfile
  • docker build . -t kiota-wasm-poc:latest
  • docker run --rm -p 8080:8080 kiota-wasm-poc:latest
  • (with a modern browser) navigate to http://localhost:8080 , open the developer tools console and press the Generate button

I have implemented a quick workaround here:
main...andreaTP:kiota:disable-reflection-in-lock

I haven't opened the relevant PR as I'm not sure what would be the best practice in the .NET world to solve those kinds of issues.

@baywet baywet self-assigned this Jan 11, 2023
@baywet baywet added type:bug A broken experience generator Issues or improvements relater to generation capabilities. labels Jan 11, 2023
@baywet baywet added this to the Kiota GA milestone Jan 11, 2023
@baywet baywet added this to Kiota Jan 11, 2023
@github-project-automation github-project-automation bot moved this to Todo in Kiota Jan 11, 2023
@baywet
Copy link
Member

baywet commented Jan 11, 2023

Thanks for reporting this. The interesting thing is that kiota web doesn't fail, but it doesn't set the right version information either.
That probably has to do with the way the application is published (version of the SDK & runtime, AOT vs no AOT, etc...) which leads me to think that this issue is 2 folds:

  • depending on how the application is built, more or less APIs might be available/implemented
  • web assembly modules probably don't carry as much metadata.

The best way forward to support those "platforms" properly, is probably to implement a source generator that'd look into the csproj and update a constant.

Would you like to take a crack at this?

@andreaTP
Copy link
Contributor Author

Deal, I'll give it a spin tomorrow! Thanks for the reference @baywet !

@baywet baywet assigned andreaTP and unassigned baywet Jan 11, 2023
@baywet baywet moved this from Todo to In Progress in Kiota Jan 11, 2023
@github-project-automation github-project-automation bot moved this from In Progress to Done in Kiota Jan 12, 2023
@andreaTP
Copy link
Contributor Author

@baywet , happy to report that, after fixing this issue I was able to successfully integrate Kiota in a project I'm working on:
Apicurio/apicurio-registry#3082

This project is growing strong!!!

@baywet
Copy link
Member

baywet commented Jan 13, 2023

ah so this is what you were up to! really cool integration! Thanks for sharing it.
Do you collect some kind of telemetry that'd allow you to tell how many clients are being generated and which languages are most used?

@andreaTP
Copy link
Contributor Author

ah so this is what you were up to!

ehm, not really :-) this was actually just a quick spike that came up this week, our main interest in Kiota is for other purposes.

Regarding telemetry, that would be nice!
I'll check with the team what we can do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
generator Issues or improvements relater to generation capabilities. type:bug A broken experience
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

2 participants