File tree Expand file tree Collapse file tree
STAR ODK/NextGenSoftware.OASIS.STAR.WebAPI Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -181,6 +181,19 @@ TOGETHER WE CAN CREATE A BETTER WORLD...</b></b>
181181 {
182182 try
183183 {
184+ // Ensure OASIS is booted before loading avatar
185+ if ( ! OASISBootLoader . OASISBootLoader . IsOASISBooted )
186+ {
187+ var dnaPath = OASISBootLoader . OASISBootLoader . OASISDNAPath ??
188+ Path . Combine ( AppContext . BaseDirectory , "OASIS_DNA.json" ) ;
189+ var bootResult = await OASISBootLoader . OASISBootLoader . BootOASISAsync ( dnaPath ) ;
190+ if ( bootResult . IsError )
191+ {
192+ // Log but don't fail - avatar loading will fail gracefully
193+ System . Diagnostics . Debug . WriteLine ( $ "Warning: OASIS boot failed in middleware: { bootResult . Message } ") ;
194+ }
195+ }
196+
184197 var avatarLoadResult = AvatarManager . Instance . LoadAvatar ( avatarId ) ;
185198 if ( avatarLoadResult is OASISResult < IAvatar > typedResult && typedResult . Result is not null )
186199 {
@@ -191,9 +204,10 @@ TOGETHER WE CAN CREATE A BETTER WORLD...</b></b>
191204 context . Items [ "Avatar" ] = directAvatar ;
192205 }
193206 }
194- catch
207+ catch ( Exception ex )
195208 {
196- // Best-effort context hydration for local API routes.
209+ // Best-effort context hydration for local API routes - log but don't fail
210+ System . Diagnostics . Debug . WriteLine ( $ "Warning: Failed to load avatar in middleware: { ex . Message } ") ;
197211 }
198212 }
199213 }
You can’t perform that action at this time.
0 commit comments