mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-11-04 10:35:27 +08:00 
			
		
		
		
	Adds fallback for ExceptionFormatter in AOT
This commit is contained in:
		
				
					committed by
					
						
						Patrik Svensson
					
				
			
			
				
	
			
			
			
						parent
						
							2a8810affd
						
					
				
				
					commit
					2be8e8da4e
				
			@@ -27,6 +27,13 @@ internal static class ExceptionFormatter
 | 
			
		||||
            throw new ArgumentNullException(nameof(exception));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // fallback to default ToString() if someone in an AOT is insisting on using this method
 | 
			
		||||
        var stackTrace = new StackTrace(exception, fNeedFileInfo: false);
 | 
			
		||||
        if (stackTrace.GetFrame(0)?.GetMethod() is null)
 | 
			
		||||
        {
 | 
			
		||||
            return new Text(exception.ToString());
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        return new Rows(GetMessage(exception, settings), GetStackFrames(exception, settings)).Expand();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user