# Elastic APM support for .net (MAUI) version 8

**URL:** <https://discuss.elastic.co/t/elastic-apm-support-for-net-maui-version-8/354338>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [February 28, 2024, 12:01pm UTC](https://discuss.elastic.co/t/elastic-apm-support-for-net-maui-version-8/354338 "2024-02-28T12:01:47Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![mrki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrki/32/132156_2.png) [@mrki](https://discuss.elastic.co/u/mrki)\
**Post date:** [February 28, 2024, 12:01pm UTC](https://discuss.elastic.co/t/elastic-apm-support-for-net-maui-version-8/354338/1 "2024-02-28T12:01:47Z")

</div>

Is it possible to use Elastic APM Agent in a .net MAUI application (android) for .net 8?

As far as I can tell only legacy IHostBuilder is suppored by APM nugets, which is no longer used since .net 6. Even worse, MAUI uses it's own MauiAppBuilder.

Thanks.

---

<div class="post-metadata">

**Author:** ![stevejgordon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stevejgordon/32/80912_2.png) [@stevejgordon](https://discuss.elastic.co/u/stevejgordon)\
**Post date:** [February 28, 2024, 1:41pm UTC](https://discuss.elastic.co/t/elastic-apm-support-for-net-maui-version-8/354338/2 "2024-02-28T13:41:33Z")

</div>

We don't have extension methods which would work here right now. I've updated [an issue](https://github.com/elastic/apm-agent-dotnet/issues/2262) we have around adding an `IServiceCollection` based mechanism, which could also cover this use case.

I'm unfamiliar with Maui, and we haven't explicitly tested what does/doesn't work from an APM perspective when using the framework. You could try [explicitly creating the agent](https://www.elastic.co/guide/en/apm/agent/dotnet/current/public-api.html#explicit-initialization) via our public API which would enable APM. You would also likely need to manually instrument your code to start transactions for appropriate units of work.

---

<div class="post-metadata">

**Author:** ![mrki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrki/32/132156_2.png) [@mrki](https://discuss.elastic.co/u/mrki)\
**Post date:** [February 28, 2024, 8:37pm UTC](https://discuss.elastic.co/t/elastic-apm-support-for-net-maui-version-8/354338/3 "2024-02-28T20:37:58Z")

</div>

Thank you for your response.

IServiceCollection based mechanism would work, yes. Is there any estimate on when it could be implemented?

Manual instrumentation is not ideal as it sounds like I'd need to delegate logs and http requests myself.

---

<div class="post-metadata">

**Author:** ![stevejgordon](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stevejgordon/32/80912_2.png) [@stevejgordon](https://discuss.elastic.co/u/stevejgordon)\
**Post date:** [February 29, 2024, 7:46am UTC](https://discuss.elastic.co/t/elastic-apm-support-for-net-maui-version-8/354338/4 "2024-02-29T07:46:39Z")

</div>

I don't have an ETA for when we'll get this new extension in. My goal is to pick it up quite soon around some other priorities.

With Maui, you will need to (at least in the near term) start a transaction for your work in your code. Spans for HTTP, etc, will then be instrumented by our library. I've not looked into Maui enough to know if there are any natural hooks for us to create the top-level transactions automatically as we do for incoming HTTP requests, for example, in [ASP.NET](http://ASP.NET) Core.

---

<div class="post-metadata">

**Author:** ![mrki](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/mrki/32/132156_2.png) [@mrki](https://discuss.elastic.co/u/mrki)\
**Post date:** [February 29, 2024, 9:09am UTC](https://discuss.elastic.co/t/elastic-apm-support-for-net-maui-version-8/354338/5 "2024-02-29T09:09:05Z")

</div>

MAUI uses all the standard .net functionality - Microsoft.Extensions.Logging, Entity framework, etc.

My (questionable) assumption is that it 's enough to implement DI extensions.

Thank you for now.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [March 28, 2024, 9:09am UTC](https://discuss.elastic.co/t/elastic-apm-support-for-net-maui-version-8/354338/6 "2024-03-28T09:09:48Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
