It'd be helpful to know your stack, but i have encountered lots of wpf-related and json-related package resolution issues with the same packages in net48 and net8. Sometimes the resolution takes an absurd amount of time, not sure why. I'd recommend adding this to your IExternalApplication:
internal class App : IExternalApplication {
public Result OnStartup(UIControlledApplication app) {
// Set up assembly resolver for Wpf.Ui and other dependencies
AppDomain.CurrentDomain.AssemblyResolve += OnAssemblyResolve;
// ...
}
private static Assembly OnAssemblyResolve(object sender, ResolveEventArgs args) {
Debug.WriteLine($"Assembly Resolution Requested: {args.Name}");
// Get the assembly name being requested
var assemblyName = new AssemblyName(args.Name);
// Get the directory where this add-in's DLL is located
var addinPath = typeof(App).Assembly.Location;
var addinDirectory = Path.GetDirectoryName(addinPath);
if (addinDirectory is null) return null;
// Construct the path to the requested assembly
var assemblyPath = Path.Combine(addinDirectory, $"{assemblyName.Name}.dll");
// Load and return the assembly if it exists in our add-in directory
if (File.Exists(assemblyPath)) {
Debug.WriteLine($"Loading assembly from: {assemblyPath}");
return Assembly.LoadFrom(assemblyPath);
}
Debug.WriteLine($"Assembly not found in add-in directory: {assemblyPath}");
return null;
}
Take this with a grain of salt, but it seems to me that if a package is failing to resolve, then revit performs its own internal resolution process everytime the package is needed, which causes some major overhead. In my env, it also seems like wpf-ui never resolves on its own, thus why i had to add this OnAssemblyResolve in the first place