Евгений Напрягло ".net framework hosting api overview"
TRANSCRIPT
![Page 1: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/1.jpg)
.NET CLR Hosting APIEvgen NapryagloIntetics
![Page 2: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/2.jpg)
1. Runtime Customizations
Runtime
AssemblyLoading
PolicyManagement
HostProtection
MemoryManagement
GarbageCollection
I/O Completion
CLREvents
TaskManagement
SynchronizationManagement
Thread PoolManagement
Application Host – Native Environment
.NET Application Environment
![Page 3: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/3.jpg)
Objectives• Monitoring• Diagnostics
• Customization• Restriction
• Integration• Extensibility
Development Operations
Product Development
Enterprise Integration
![Page 4: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/4.jpg)
2. Execution & State Monitoring
ProfilingAPI
DebuggingAPI
![Page 5: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/5.jpg)
CLR Hosting
Host
Runtime
.NET CodemscoreeICLRRuntimeHost
CorBindToRuntimeEx
ICLRControlIHostControl
Assembly
![Page 6: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/6.jpg)
Initialization Flow:Host :mscoree :Runtime
CorBindToRuntimeEx
ICLRRuntimeHost
SetHostControl
StartInitialization
ICLRControlStatus
GetCLRControl
ICLRControl
ExecuteInDefaultAppDomain
![Page 7: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/7.jpg)
Assembly Loading
ICLRAssemblyReferenceListICLRAssemblyIdentityManager
• The location from which assemblies are loaded
• The way versions are managed
• The formats from which assemblies can be loaded
Customize
IHostAssemblyManagerIHostAssemblyStore
![Page 8: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/8.jpg)
Synchronization Management
IHostSyncManager ICLRSyncManager
Enables the host to implement its own synchronization primitives for the runtime to use.
Custom
Events IHostManualEvent, IHostAutoEvent
Critical Section
Semaphore IHostSemaphore
IHostCrst
![Page 9: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/9.jpg)
Policy Management
ICLRPolicyManager IHostPolicyManager
Enables the host to specify the way program failures are handled, to support different reliability requirements.
NoActionThrowExceptionAbortThread RudeAbortThread UnloadAppDomain RudeUnloadAppDomain ExitProcess FastExitProcess RudeExitProcess DisableRuntime
NonCriticalResourceCriticalResourceFatalRuntimeOrphanedLockStackOverflow
ThreadAbortThreadRudeAbortInNonCriticalRegionThreadRudeAbortInCriticalRegionAppDomainUnloadAppDomainRudeUnloadProcessExitFinalizerRun
ActionsFailures
Events
![Page 10: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/10.jpg)
Host ProtectionEnables the host to enforce its own programming model, by
preventing the use of specified types or members.
ICLRHostProtectionManager
Reflection
Licensing
Synchronization
UI Components
![Page 11: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/11.jpg)
Thread Pool ManagementEnables the host to implement its own thread pool for the
runtime to use.
IHostThreadPoolManager
GetAvailableThreads GetMaxThreads GetMinThreads QueueUserWorkItem SetMaxThreads SetMinThreads
![Page 12: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/12.jpg)
I/O Completion
IHostIoCompletionManager
Enables the host to implement its own implementation of asynchronous input/output.
ICLRIoCompletionManager
CLRHost
IHostIoCompletionManager
ICLRIoCompletionManager
IO Operations Calls
Results & Feedback
![Page 13: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/13.jpg)
Profiling• Class loading and unloading
events.
• Thread creation and destruction events.
• Function entry and exit events.
• Exceptions.
• Transitions between different runtime contexts.
• Information about runtime suspensions.
• Information about the runtime memory heap and garbage collection activity.
ApplicationFor
Profiling
CLR
HOST IPC Transport
ProfilerUser
Interface
Profile Target Profiler
ICorProfilerInfo
ICorProfilerCallback
![Page 14: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/14.jpg)
Debugging
ApplicationFor
Debugging
CLR
HOST IPC Transport
DebuggerUser
Interface
Profile Target Debugger
ICorDebug
ICorDebugManagedCallback
• Accessing Call Stacks and Variables
• Accessing IL Code and Native Code
• On-the-Fly Data and Code modifications
• Runtime Expressions Evaluation
• IL Code Injections
• Custom Breakpoints
• Step by Step Execution
![Page 15: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/15.jpg)
Practical Case
![Page 16: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/16.jpg)
ArchitectureDomestic Area
![Page 17: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/17.jpg)
New ArchitecturePrinter
Domestic Area
Internet
![Page 18: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/18.jpg)
Windows User Mode Driver Framework
Virtual Printer Driver
CLR Host
.NET Data Converter
.NET Data Converter
.NET Data Converter
Native
Native
Native
![Page 19: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/19.jpg)
CLR Hosting vs COM Integration
Simple Programming Model
Fully Managed
Good Performance
Flexible Programming Model
High Reliability
Tailored Integration with Native Services
Native Programming Environment
Low Reliability
COM Infrastructure Availability
Complex Diagnostics
Strange Errors
![Page 20: Евгений Напрягло ".NET Framework Hosting API Overview"](https://reader036.vdocument.in/reader036/viewer/2022062900/58e4a5bd1a28abf5428b6efd/html5/thumbnails/20.jpg)
THANK YOU