Wizard
Wizard
CC#
Created by Wizard on 6/19/2023 in #help
❔ Output error when user missing .NET runtime
--list-runtimes isn't really available to users with the runtime and not the sdk
18 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Output error when user missing .NET runtime
because I need to support early windows operating systems. My program is written for a very old game that runs on windows xp. Realistically I can't target XP but targetting net462 at least lets me target vista
18 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Output error when user missing .NET runtime
I considered including a bat script that'd open my program and call dotnet --listsdks, until I found out that the end user NET version doesn't include the sdk.. so I'm stumped.
18 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Output error when user missing .NET runtime
regardless of if i pack it
18 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Output error when user missing .NET runtime
I don't think that's feasable as I target both linux and windows. If a user downloads the net462 version it definitely ain't going to run on linux.
18 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Output error when user missing .NET runtime
I just want some sort of diagnostic to inform the user the problem rather than crashing with no info. Currently the #1 question being asked on my issues board lol. I figure there might be some sort of early event that doesn't need a NET runtime?
18 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Output error when user missing .NET runtime
Entry point:
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Avalonia;

namespace KOTORModSync.GUI
{
internal static class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main( string[] args ) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime( args );

// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
}
}
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using System;
using Avalonia;

namespace KOTORModSync.GUI
{
internal static class Program
{
// Initialization code. Don't use any Avalonia, third-party APIs or any
// SynchronizationContext-reliant code before AppMain is called: things aren't initialized
// yet and stuff might break.
[STAThread]
public static void Main( string[] args ) => BuildAvaloniaApp()
.StartWithClassicDesktopLifetime( args );

// Avalonia configuration, don't remove; also used by visual designer.
public static AppBuilder BuildAvaloniaApp()
=> AppBuilder.Configure<App>()
.UsePlatformDetect()
.LogToTrace();
}
}
18 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Get locals and their values from an Exception object.
i miss python's locals()
35 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Get locals and their values from an Exception object.
What do you recommend? Idk how to read dump files, but would that solve my problem?
35 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Get locals and their values from an Exception object.
A lot of answers recommend either PostSharp, IntelliTrace, Minidumps, or some sort of reflection.
35 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Get locals and their values from an Exception object.
Thank you for the analysis. I think I'm understanding the problem a bit better now
35 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Get locals and their values from an Exception object.
it's not like I can even send them manually either. Take this example:
try
{
int x = 4;
throw;
}
catch (Exception ex)
{
LogException(ex, new[] {x});
}
try
{
int x = 4;
throw;
}
catch (Exception ex)
{
LogException(ex, new[] {x});
}
Wouldn't work because x is in a different scope
35 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Get locals and their values from an Exception object.
basically I created an app and added a boatload of LogException calls. Users keep sending me their logs but the stacktrace I'm logging is beyond useless as it doesn't have any locals. Yes I know it fails at this line in method x, but it doesn't help me unless I know what the value is. Been trying to update my code to just verbosely log all locals I need, but I'm 3 hours into that project and I'm not even a quarter of the way done. So I'm out of ideas if this get-locals-from-stacktrace idea isn't possible.
35 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Get locals and their values from an Exception object.
35 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Get locals and their values from an Exception object.
this 7 year old answer claims to be able to do it using PostSharp:
35 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Get locals and their values from an Exception object.
the saving is instantaneous so it should be the same as pausing?
35 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Get locals and their values from an Exception object.
why does pausing execution matter when the stacktrace obj is already saved to a var?
35 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Get locals and their values from an Exception object.
You mention the vs debugger pauses execution before the stack unwinds. I'm still a bit confused. Stack information is already saved to the StackTrace object in my LogException. Are you implying execution is never halted while the exception instance is created? That makes no sense for a single-threaded app. Even so there should be a way to do it the same way visual studio does it if that's the only possibility. I've seen people claim it's possible on stackoverflow but their example code is just too difficult for me to understand or their use case is too far from mine to be useable.
35 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Get locals and their values from an Exception object.
If that's the case, how does the visual studio debugger correctly tell me the locals when it catches the exceptions?
35 replies
CC#
Created by Wizard on 6/19/2023 in #help
❔ Get locals and their values from an Exception object.
how so?
35 replies