14
14
#include " Environment.h"
15
15
#include " HostFxr.h"
16
16
17
- IN_PROCESS_APPLICATION* IN_PROCESS_APPLICATION::s_Application = NULL ;
17
+ IN_PROCESS_APPLICATION* IN_PROCESS_APPLICATION::s_Application = NULL ;
18
18
19
19
IN_PROCESS_APPLICATION::IN_PROCESS_APPLICATION (
20
20
IHttpServer& pHttpServer,
@@ -184,18 +184,26 @@ IN_PROCESS_APPLICATION::LoadManagedApplication(ErrorContext& errorContext)
184
184
{
185
185
if (p.path () != shadowCopyDir)
186
186
{
187
- std::filesystem::remove_all (p.path ());
187
+ try
188
+ {
189
+ std::filesystem::remove_all (p.path ());
190
+ }
191
+ catch (...)
192
+ {
193
+ OBSERVE_CAUGHT_EXCEPTION ();
194
+ }
188
195
}
189
196
}
197
+
190
198
}, m_shadowCopyDirectory);
191
199
}
192
200
193
201
m_workerThread = std::thread ([](std::unique_ptr<IN_PROCESS_APPLICATION, IAPPLICATION_DELETER> application)
194
- {
195
- LOG_INFO (L" Starting in-process worker thread" );
196
- application->ExecuteApplication ();
197
- LOG_INFO (L" Stopping in-process worker thread" );
198
- }, ::ReferenceApplication (this ));
202
+ {
203
+ LOG_INFO (L" Starting in-process worker thread" );
204
+ application->ExecuteApplication ();
205
+ LOG_INFO (L" Stopping in-process worker thread" );
206
+ }, ::ReferenceApplication (this ));
199
207
200
208
const HANDLE waitHandles[2 ] = { m_pInitializeEvent, m_workerThread.native_handle () };
201
209
@@ -255,7 +263,7 @@ IN_PROCESS_APPLICATION::ExecuteApplication()
255
263
m_pConfig->QueryArguments (),
256
264
errorContext,
257
265
hostFxrResolutionResult
258
- ));
266
+ ));
259
267
260
268
hostFxrResolutionResult->GetArguments (context->m_argc , context->m_argv );
261
269
THROW_IF_FAILED (SetEnvironmentVariablesOnWorkerProcess ());
@@ -440,11 +448,11 @@ void IN_PROCESS_APPLICATION::QueueStop()
440
448
LOG_INFO (L" Queueing in-process stop thread" );
441
449
442
450
std::thread stoppingThread ([](std::unique_ptr<IN_PROCESS_APPLICATION, IAPPLICATION_DELETER> application)
443
- {
444
- LOG_INFO (L" Starting in-process stop thread" );
445
- application->Stop (false );
446
- LOG_INFO (L" Stopping in-process stop thread" );
447
- }, ::ReferenceApplication (this ));
451
+ {
452
+ LOG_INFO (L" Starting in-process stop thread" );
453
+ application->Stop (false );
454
+ LOG_INFO (L" Stopping in-process stop thread" );
455
+ }, ::ReferenceApplication (this ));
448
456
449
457
stoppingThread.detach ();
450
458
}
@@ -505,7 +513,7 @@ IN_PROCESS_APPLICATION::ExecuteClr(const std::shared_ptr<ExecuteClrContext>& con
505
513
context->m_exitCode = exitCode;
506
514
context->m_hostFxr .Close ();
507
515
}
508
- __except (GetExceptionCode () != 0 )
516
+ __except (GetExceptionCode () != 0 )
509
517
{
510
518
LOG_INFOF (L" Managed threw an exception %d" , GetExceptionCode ());
511
519
@@ -519,7 +527,7 @@ IN_PROCESS_APPLICATION::ExecuteClr(const std::shared_ptr<ExecuteClrContext>& con
519
527
// in case of startup timeout
520
528
//
521
529
VOID
522
- IN_PROCESS_APPLICATION::ClrThreadEntryPoint (const std::shared_ptr<ExecuteClrContext> & context)
530
+ IN_PROCESS_APPLICATION::ClrThreadEntryPoint (const std::shared_ptr<ExecuteClrContext>& context)
523
531
{
524
532
HandleWrapper<ModuleHandleTraits> moduleHandle;
525
533
@@ -550,7 +558,7 @@ IN_PROCESS_APPLICATION::SetEnvironmentVariablesOnWorkerProcess()
550
558
QueryApplicationPhysicalPath ().c_str (),
551
559
nullptr );
552
560
553
- for (const auto & variable : variables)
561
+ for (const auto & variable : variables)
554
562
{
555
563
LOG_INFOF (L" Setting environment variable %ls=%ls" , variable.first .c_str (), variable.second .c_str ());
556
564
SetEnvironmentVariable (variable.first .c_str (), variable.second .c_str ());
@@ -584,7 +592,7 @@ IN_PROCESS_APPLICATION::UnexpectedThreadExit(const ExecuteClrContext& context) c
584
592
QueryApplicationId ().c_str (),
585
593
QueryApplicationPhysicalPath ().c_str (),
586
594
context.m_exceptionCode
587
- );
595
+ );
588
596
}
589
597
return ;
590
598
}
@@ -618,8 +626,8 @@ IN_PROCESS_APPLICATION::UnexpectedThreadExit(const ExecuteClrContext& context) c
618
626
619
627
HRESULT
620
628
IN_PROCESS_APPLICATION::CreateHandler (
621
- _In_ IHttpContext * pHttpContext,
622
- _Out_ IREQUEST_HANDLER ** pRequestHandler)
629
+ _In_ IHttpContext* pHttpContext,
630
+ _Out_ IREQUEST_HANDLER** pRequestHandler)
623
631
{
624
632
try
625
633
{
0 commit comments