Skip to content

Commit

Permalink
Merge pull request chromelyapps#370 from xplicit/fix-warnings
Browse files Browse the repository at this point in the history
Fix remaining warnings in solution
  • Loading branch information
mattkol authored May 12, 2022
2 parents 1a09d46 + c24dd68 commit 68a3b30
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 11 deletions.
5 changes: 5 additions & 0 deletions src/Chromely.Core/AppBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,11 @@ public override void Run()
{
var appName = Assembly.GetEntryAssembly()?.GetName().Name;
var windowController = _serviceProvider.GetService<ChromelyWindowController>();
if (windowController is null)
{
throw new Exception("ChromelyWindowController is not registered.");
}

try
{
Logger.Instance.Log.LogInformation("Running application:{appName}.", appName);
Expand Down
6 changes: 3 additions & 3 deletions src/Chromely.Core/ChromelyApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ public virtual void RegisterChromelyControllerAssembly(IServiceCollection servic
return logger;
}

var appName = Assembly.GetEntryAssembly()?.GetName().Name;
var appName = Assembly.GetEntryAssembly()?.GetName().Name!;
var loggerFactory = serviceProvider.GetService<ILoggerFactory>();
if (loggerFactory is not null)
{
Expand All @@ -244,7 +244,7 @@ public virtual void RegisterChromelyControllerAssembly(IServiceCollection servic
}

/// <summary>
/// Using local resource handling requires files to be relative to the
/// Using local resource handling requires files to be relative to the
/// Expected working directory
/// For example, if the app is launched via the taskbar the working directory gets changed to
/// C:\Windows\system32
Expand All @@ -264,7 +264,7 @@ protected static void EnsureExpectedWorkingDirectory()
}

/// <summary>
///
///
/// </summary>
/// <param name="config"></param>
/// <exception cref="Exception"></exception>
Expand Down
2 changes: 1 addition & 1 deletion src/Chromely.Core/ChromelyHandlersResolver.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

namespace Chromely.Core;

public delegate IEnumerable<object> ChromelyHandlersResolver(Type serviceType);
public delegate IEnumerable<object?> ChromelyHandlersResolver(Type serviceType);

2 changes: 1 addition & 1 deletion src/Chromely.Core/Logging/SimpleLogger.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public SimpleLogger(string? fullFilePath = null, bool logToConsole = false, int
_maxSizeInKiloBytes = 1000 * maxFileSizeBeforeLogRotation;
}

public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception exception, Func<TState, Exception, string> formatter)
public void Log<TState>(LogLevel logLevel, EventId eventId, TState state, Exception? exception, Func<TState, Exception?, string> formatter)
{
if (!IsEnabled(logLevel))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ public class DefaultAssemblyResourceSchemeHandler : CefResourceHandler
/// Initializes a new instance of <see cref="DefaultAssemblyResourceSchemeHandler"/>.
/// </summary>
/// <param name="config">Instance of <see cref="IChromelyConfiguration"/>.</param>
/// <param name="chromelyErrorHandler"><Instance of <see cref="IChromelyErrorHandler"/>.</param>
/// <param name="chromelyErrorHandler">Instance of <see cref="IChromelyErrorHandler"/>.</param>
public DefaultAssemblyResourceSchemeHandler(IChromelyConfiguration config, IChromelyErrorHandler chromelyErrorHandler)
{
_config = config;
Expand Down Expand Up @@ -87,8 +87,8 @@ protected override void GetResponseHeaders(CefResponse response, out long respon
}
}

[Obsolete("ReadResponse is obsolete.")]
/// <inheritdoc/>
[Obsolete("ReadResponse is obsolete.")]
protected override bool ReadResponse(Stream response, int bytesToRead, out int bytesRead, CefCallback callback)
{
int currBytesRead = 0;
Expand Down Expand Up @@ -162,7 +162,7 @@ private bool ProcessLocalFile(string file, CefCallback callback)
{
_fileInfo = new FileInfo(file);

// Check if file exists
// Check if file exists
if (!_fileInfo.Exists)
{
_chromelyResource = _chromelyErrorHandler.HandleError(_fileInfo);
Expand Down Expand Up @@ -219,7 +219,7 @@ private bool ProcessAssmblyEmbeddedFile(string url, string file, string fileAbso
var manifestName = string.Join(".", option.DefaultNamespace, option.RootFolder, _regex.Replace(fileAbsolutePath, ".")).Replace("..", ".").Replace("..", ".");
Stream? stream = option.TargetAssembly.GetManifestResourceStream(manifestName);

// Check if file exists
// Check if file exists
if (stream is null)
{
_chromelyResource = _chromelyErrorHandler.HandleError(stream);
Expand Down
4 changes: 2 additions & 2 deletions src/Chromely/HandlerResolverHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ public static class HandlerResolverHelper
return default;
}

private static object? GetDefaultHandler(List<object> handlers, Type type)
private static object? GetDefaultHandler(List<object?> handlers, Type type)
{
if (handlers is not null && handlers.Any())
{
Expand All @@ -103,7 +103,7 @@ public static class HandlerResolverHelper
return default;
}

private static object? GetFirstCustomHandler(List<object> handlers)
private static object? GetFirstCustomHandler(List<object?> handlers)
{
if (handlers is not null && handlers.Any())
{
Expand Down

0 comments on commit 68a3b30

Please sign in to comment.