Azure / Azure/azure-functions-host
Debugger assemblies clash with user code assemblies
- Dominant language
- C#
- Stars
- 2k
- Forks
- 482
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 38
Description
I am attempting to start a visual studio debug session, of a V2 Functions Project, that uses `System.ComponentModel.DataAnnotations Version=4.0.0.0`. When I start the session, I get an exception. The log stream reads:
```
Exception thrown: 'System.TypeLoadException' in EntityFramework.dll
An exception of type 'System.TypeLoadException' occurred in EntityFramework.dll but was not handled in user code
Could not load type 'System.ComponentModel.DataAnnotations.AssociatedMetadataTypeTypeDescriptionProvider' from assembly 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35'.
```
It was discovered that I am dependent on assembly file version: 4.7.2558.0 while the function core tools is dependent on assembly file version: 4.6.27207.3. I discovered this fact by looking further at the log stream from the debug session:
```
'func.exe' (CoreCLR: clrhost): Loaded 'C:\Users\sjsui\AppData\Local\AzureFunctionsTools\Releases\2.18.5\cli\System.ComponentModel.DataAnnotations.dll'. Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
```
So whats happening is the debug session cannot load two versions of the assembly. The app domain of the debugger should be isolated from the app domain of the user code yet it does not appear the case.
I tried removing all my references to the standard library in favour of references to azurefunctionstools/releases, but this did not fix the issue.
## environment
visual studio 15.9.7
Azure function core tools 2.18.5
- Timestamp: Monday, April 8, 2019 2:15:48 AM
- Function App version (1.0 or 2.0): 2.0.12382.0
- Function App: serversidearchitecture.serverless.strategy
- Function name(s) (as appropriate): serversidearchitecture.serverless.utility
- Invocation ID: 2596959c-cc2e-484c-ba77-ee0d9b91d0f2
- Region: azure region australia southeast (this is not a relevant question)
Contributor guide
Research direction
Start by reproducing the Visual Studio debug session for the V2 Functions project and inspect the func.exe log entries for System.ComponentModel.DataAnnotations.dll and the TypeLoadException in EntityFramework.dll. Trace how the debugger and host load assemblies; done means the session no longer clashes with the user's assembly version and the exception is absent.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, csharp
- Domain
- backend, cloud, developer-experience
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100