Skip to content

Commit

Permalink
Fix InvalidUriException, closes #245
Browse files Browse the repository at this point in the history
  • Loading branch information
cd21h committed Apr 30, 2021
1 parent c9f1c6e commit 8641525
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<PackageIconUrl>https://github.com/sharparchitecture/Sharp-Architecture/raw/master/Artefacts/Documentation/icon.png</PackageIconUrl>
<PackageProjectUrl>http://sharparchitecture.github.io/</PackageProjectUrl>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<PackageReleaseNotes>https://github.com/sharparchitecture/Sharp-Architecture/releases/tag/6.0.0</PackageReleaseNotes>
<PackageReleaseNotes>https://github.com/sharparchitecture/Sharp-Architecture/releases/tag/6.1.1</PackageReleaseNotes>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>True</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
Expand Down
2 changes: 2 additions & 0 deletions SharpArch.AutoLoad.DotSettings
Original file line number Diff line number Diff line change
Expand Up @@ -371,6 +371,7 @@ FluentAssertions.AssertionExtensions.Should($EXPR$).NotBeNull()&#xD;
<s:Boolean x:Key="/Default/Environment/Editor/QuickInfo/EnableQuickInfo/@EntryValue">True</s:Boolean>

<s:Int64 x:Key="/Default/Environment/Hierarchy/Build/SolutionBuilderNext/ParallelProcessesCount2/@EntryValue">3</s:Int64>
<s:String x:Key="/Default/Environment/InlayHints/CSharpTypeNameHintsOptions/ShowTypeNameHintsForLambdaExpressionParameters/@EntryValue">Never</s:String>
<s:Boolean x:Key="/Default/Environment/MemoryUsageIndicator/IsVisible/@EntryValue">True</s:Boolean>


Expand Down Expand Up @@ -404,6 +405,7 @@ FluentAssertions.AssertionExtensions.Should($EXPR$).NotBeNull()&#xD;
<s:Boolean x:Key="/Default/Environment/PerformanceGuide/SwitchConflictResolutionMode/=TextEditor_002DTrackChanges_002D2/@EntryIndexRemoved">True</s:Boolean>
<s:String x:Key="/Default/Environment/PerformanceGuide/SwitchConflictResolutionMode/=XAML_0020Designer/@EntryIndexedValue"></s:String>
<s:Boolean x:Key="/Default/Environment/PerformanceGuide/SwitchConflictResolutionMode/=XAML_0020Designer/@EntryIndexRemoved">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EFeature_002EServices_002ECSharp_002ETypeNameHints_002ECSharpTypeNameHintsOptionsMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpAttributeForSingleLineMethodUpgrade/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpKeepExistingMigration/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/Environment/SettingsMigration/IsMigratorApplied/=JetBrains_002EReSharper_002EPsi_002ECSharp_002ECodeStyle_002ECSharpPlaceEmbeddedOnSameLineMigration/@EntryIndexedValue">True</s:Boolean>
Expand Down
18 changes: 10 additions & 8 deletions Src/SharpArch.Infrastructure/Caching/DependencyList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class DependencyList

private readonly IFileSystem _fileSystem;
private string _basePath;

public static DependencyList WithPathPrefix([NotNull] string basePath, IFileSystem fileSystem = null)
{
if (string.IsNullOrEmpty(basePath)) throw new ArgumentException("Value cannot be null or empty.", nameof(basePath));
Expand Down Expand Up @@ -126,13 +126,15 @@ private string GetCodeBasePath()
public static string GetAssemblyCodeBasePath([NotNull] Assembly assembly)
{
if (assembly == null) throw new ArgumentNullException(nameof(assembly));

string path = null;
#if NET5_0
var uri = new UriBuilder(assembly.Location);
#else
path = assembly.Location;
#else
var uri = new UriBuilder(assembly.CodeBase);
#endif
var uriPath = Uri.UnescapeDataString(uri.Path);
return Path.GetDirectoryName(uriPath);
path = Uri.UnescapeDataString(uri.Path);
#endif
return Path.GetDirectoryName(path);
}

/// <summary>
Expand All @@ -157,8 +159,8 @@ private string FindFile(string path)
if (_fileSystem.FileExists(codePath)) return codePath;

// try with .dll extension added
var dllPath = path.IndexOf(".dll", StringComparison.InvariantCultureIgnoreCase) == -1
? path + ".dll"
var dllPath = path.IndexOf(".dll", StringComparison.InvariantCultureIgnoreCase) == -1
? path + ".dll"
: path;
if (_fileSystem.FileExists(dllPath)) return dllPath;

Expand Down

0 comments on commit 8641525

Please sign in to comment.