# .Net 4.7.2 Application Crashing

**URL:** <https://discuss.elastic.co/t/net-4-7-2-application-crashing/366710>\
**Category:** APM\
**Tags:** dotnet\
**Created:** [September 18, 2024, 5:48am UTC](https://discuss.elastic.co/t/net-4-7-2-application-crashing/366710 "2024-09-18T05:48:03Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![agierens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agierens/32/137670_2.png) [@agierens](https://discuss.elastic.co/u/agierens)\
**Post date:** [September 18, 2024, 5:48am UTC](https://discuss.elastic.co/t/net-4-7-2-application-crashing/366710/1 "2024-09-18T05:48:03Z")

</div>

**Kibana version** : 8.13.0

**Elasticsearch version** : 8.13

**APM Server version** : 8.13.0

**APM Agent language and version** : Profiler 1.26.0

**Fresh install or upgraded from other version?** Fresh install

Notes:

- APM .net agent works fine to add traces. We had no issues with this
- The reason we were exploring the profiler as an option was to give us SQL tracing, as I believe this isn't supported with the agent in .net framework [mentioned here](https://www.elastic.co/guide/en/apm/agent/dotnet/current/setup-sqlclient.html)
- Microsoft.Data.SqlClient is used, 1.1.3, but we have tried upgrading this with no success
- We have tried removing all references to the Elastic APM agent in code also, this does not have any affect.
- Screenshots in comments, as im a new user

**Description of the problem** :  
When starting our application after enabling the profiler with the below script, our application crashes (screenshot below of some logs). When the profiler is disabled, the application loads as normal.

**Script to init profiler** :

```auto
$appcmd = "$($env:systemroot)\system32\inetsrv\AppCmd.exe"
$appPool = "AppPoolName" 
$profilerHomeDir = "C:\source\ApmProfiler\elastic_apm_profiler_1.26.0-win-x64" 
$environment = @{
  COR_ENABLE_PROFILING = "1"
  COR_PROFILER = "{FA65FE15-F085-4681-9B20-95E04F6C03CC}"
  COR_PROFILER_PATH = "$profilerHomeDir\elastic_apm_profiler.dll"
  ELASTIC_APM_PROFILER_HOME = "$profilerHomeDir"
  ELASTIC_APM_PROFILER_INTEGRATIONS = "$profilerHomeDir\integrations.yml"
  ELASTIC_APM_SERVER_URL = "https://XYZ:8200" 
  ELASTIC_APM_PROFILER_LOG = "trace"
}

$environment.Keys | ForEach-Object {
  & $appcmd set config -section:system.applicationHost/applicationPools /+"[name='$appPool'].environmentVariables.[name='$_',value='$($environment[$_])']"
}

```

---

<div class="post-metadata">

**Author:** ![agierens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agierens/32/137670_2.png) [@agierens](https://discuss.elastic.co/u/agierens)\
**Post date:** [September 18, 2024, 5:48am UTC](https://discuss.elastic.co/t/net-4-7-2-application-crashing/366710/2 "2024-09-18T05:48:42Z")

</div>

![460199282_1235795410792434_7657287818502651798_n](https://us1.discourse-cdn.com/elastic/original/3X/f/c/fcf52e11d7c51fba72f3698f64c3e3f6001f063c.png)

---

<div class="post-metadata">

**Author:** ![agierens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agierens/32/137670_2.png) [@agierens](https://discuss.elastic.co/u/agierens)\
**Post date:** [September 18, 2024, 5:49am UTC](https://discuss.elastic.co/t/net-4-7-2-application-crashing/366710/3 "2024-09-18T05:49:23Z")

</div>

![458540694_1428842084452837_4753795714448055319_n](https://us1.discourse-cdn.com/elastic/original/3X/c/d/cd766c41a7f897995c2ee1b3de69e8b9e92f61be.png)

---

<div class="post-metadata">

**Author:** ![agierens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agierens/32/137670_2.png) [@agierens](https://discuss.elastic.co/u/agierens)\
**Post date:** [September 18, 2024, 5:49am UTC](https://discuss.elastic.co/t/net-4-7-2-application-crashing/366710/4 "2024-09-18T05:49:59Z")

</div>

![image](https://us1.discourse-cdn.com/elastic/original/3X/d/6/d6ec866e63d97aff528693cf100abe771f79b75d.png)

---

<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:** [September 18, 2024, 6:37am UTC](https://discuss.elastic.co/t/net-4-7-2-application-crashing/366710/5 "2024-09-18T06:37:38Z")

</div>

Hi, @agierens. I'm sorry to hear about this crash. As a starting point, could you please try [v1.28.6](https://github.com/elastic/apm-agent-dotnet/releases/tag/v1.28.6)? There are fixes since 1.26.0, which might help in some scenarios.

Do any of the profiler/agent logs get produced before the crash? Are there any errors towards the end that might line up with the crash if they are present?

---

<div class="post-metadata">

**Author:** ![agierens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agierens/32/137670_2.png) [@agierens](https://discuss.elastic.co/u/agierens)\
**Post date:** [September 18, 2024, 7:11am UTC](https://discuss.elastic.co/t/net-4-7-2-application-crashing/366710/6 "2024-09-18T07:11:16Z")

</div>

Hi Steve,

We did try with the latest with no luck.

The only error we saw in the trace logs from the profiler was an error related to Postgres integration, so we disabled via the integration exclusion variable, but that made no difference unfortunately.

I will provide the trace logs asap, I will just need to remove some IP. Should have this to you in the next 24h

Do you have any recommendations on getting other traces or debugging this somehow?

---

<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:** [September 18, 2024, 8:45am UTC](https://discuss.elastic.co/t/net-4-7-2-application-crashing/366710/7 "2024-09-18T08:45:32Z")

</div>

@agierens It might be worth opening an issue on [our repo](https://github.com/elastic/apm-agent-dotnet) so we can track this more formally.

The next step after the logs would be to try to capture a crash dump to investigate what triggers the crash.

---

<div class="post-metadata">

**Author:** ![agierens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agierens/32/137670_2.png) [@agierens](https://discuss.elastic.co/u/agierens)\
**Post date:** [September 18, 2024, 10:46pm UTC](https://discuss.elastic.co/t/net-4-7-2-application-crashing/366710/8 "2024-09-18T22:46:45Z")

</div>

Will do - Thanks. Will post the github link for tracking after I have created it so others can track if they run into the same issue 🙂

---

<div class="post-metadata">

**Author:** ![agierens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/agierens/32/137670_2.png) [@agierens](https://discuss.elastic.co/u/agierens)\
**Post date:** [September 19, 2024, 6:36am UTC](https://discuss.elastic.co/t/net-4-7-2-application-crashing/366710/9 "2024-09-19T06:36:38Z")

</div>

Github link: [[BUG] .Net 4.7.2 Application Crashing · Issue #2449 · elastic/apm-agent-dotnet · GitHub](https://github.com/elastic/apm-agent-dotnet/issues/2449)
