Skip to content

Commit 1ae6382

Browse files
refactor: use typeof(Program).Assembly to get currently executing assembly
This PR refactors how we obtain the currently executing assembly path, replacing the use of Assembly.GetExecutingAssembly() with typeof(Program).Assembly for improved clarity and performance. - Consider using `typeof(T).Assembly` to get currently executing assembly: The original code used Assembly.GetExecutingAssembly().Location, which relies on reflection and can be less direct. The change replaces this with `typeof(Program).Assembly.Location`, leveraging compile-time type metadata for clearer intent and potential performance gains. > This Autofix was generated by AI. Please review the change before merging.
1 parent 5206024 commit 1ae6382

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

CallbackHandler/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public static IHostBuilder CreateHostBuilder(string[] args)
3232
{
3333
//At this stage, we only need our hosting file for ip and ports
3434

35-
FileInfo fi = new(System.Reflection.Assembly.GetExecutingAssembly().Location);
35+
FileInfo fi = new(typeof(Program).Assembly.Location);
3636

3737
IConfigurationRoot config = new ConfigurationBuilder().SetBasePath(fi.Directory.FullName)
3838
.AddJsonFile("hosting.json", optional: true)

0 commit comments

Comments
 (0)