Skip to content

Commit cfd5b24

Browse files
KevinRansombaronfel
authored andcommitted
Fix arcade (#9381)
* fix loader * typos
1 parent daa62c2 commit cfd5b24

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/absil/ilreflect.fs

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -325,9 +325,12 @@ type cenv =
325325

326326
let convResolveAssemblyRef (cenv: cenv) (asmref: ILAssemblyRef) qualifiedName =
327327
let assembly =
328-
match cenv.resolveAssemblyRef asmref with
328+
match cenv.resolveAssemblyRef asmref with
329329
| Some (Choice1Of2 path) ->
330-
FileSystem.AssemblyLoadFrom path
330+
// asmRef is a path but the runtime is smarter with assembly names so make one
331+
let asmName = AssemblyName.GetAssemblyName(path)
332+
asmName.CodeBase <- path
333+
FileSystem.AssemblyLoad asmName
331334
| Some (Choice2Of2 assembly) ->
332335
assembly
333336
| None ->
@@ -359,8 +362,6 @@ let convTypeRefAux (cenv: cenv) (tref: ILTypeRef) =
359362
| ILScopeRef.PrimaryAssembly ->
360363
convResolveAssemblyRef cenv cenv.ilg.primaryAssemblyRef qualifiedName
361364

362-
363-
364365
/// The (local) emitter env (state). Some of these fields are effectively global accumulators
365366
/// and could be placed as hash tables in the global environment.
366367
[<AutoSerializable(false)>]

src/fsharp/fsi/fsi.fs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2809,11 +2809,18 @@ type FsiEvaluationSession (fsi: FsiEvaluationSessionHostConfig, argv:string[], i
28092809

28102810
let fsiInteractionProcessor = FsiInteractionProcessor(fsi, tcConfigB, fsiOptions, fsiDynamicCompiler, fsiConsolePrompt, fsiConsoleOutput, fsiInterruptController, fsiStdinLexerProvider, lexResourceManager, initialInteractiveState)
28112811

2812+
// Raising an exception throws away the exception stack making diagnosis hard
2813+
// this wraps the existing exception as the inner exception
2814+
let makeNestedException (userExn: #Exception) =
2815+
// clone userExn -- make userExn the inner exception, to retain the stacktrace on raise
2816+
let arguments = [| userExn.Message :> obj; userExn :> obj |]
2817+
Activator.CreateInstance(userExn.GetType(), arguments) :?> Exception
2818+
28122819
let commitResult res =
28132820
match res with
28142821
| Choice1Of2 r -> r
28152822
| Choice2Of2 None -> raise (FsiCompilationException(FSIstrings.SR.fsiOperationFailed(), None))
2816-
| Choice2Of2 (Some userExn) -> raise userExn
2823+
| Choice2Of2 (Some userExn) -> raise (makeNestedException userExn)
28172824

28182825
let commitResultNonThrowing errorOptions scriptFile (errorLogger: CompilationErrorLogger) res =
28192826
let errs = errorLogger.GetErrors()

0 commit comments

Comments
 (0)