[CSHARP-3693] Improve native assembly loading behavior Created: 28/May/21  Updated: 28/Jul/22  Resolved: 28/Jul/22

Status: Closed
Project: C# Driver
Component/s: None
Affects Version/s: None
Fix Version/s: None

Type: Improvement Priority: Minor - P4
Reporter: Dmitry Lukyanov (Inactive) Assignee: Unassigned
Resolution: Won't Do Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
is related to CSHARP-3427 Can't make use of compression when ap... Closed

 Description   

In the scope of CSHARP-3427, we noticed that our `RelativeLibraryLocatorBase` behavior will fail if consumer application uses some special symbols in his path.
This issue is related to `Uri` behavior, for example in the scope of CSHARP-3427 we fixed handling of spaces, but we didn't fix handling of # in the file path.
Possible solutions:
1. Use Fragment field, the solution is implemented here.
2. Use code like this:

 public virtual string GetLibraryBasePath()
        {
#if NETSTANDARD1_5
            var assembly = GetLibraryBaseAssembly();
            var absolutePath = assembly.Location;
#else
            var absolutePath = AppDomain.CurrentDomain.BaseDirectory;
#endif
            return Path.GetDirectoryName(absolutePath);
        }

pay attention that as it was mentioned here it's not recommended to use such approach for web applications.
So any of the above ways should be carefully checked on all supported platforms (web, desktop, mobile), TFs(.net framework, set of .net cores), OSs and we should be able to correctly work with this logic in our driver tests with/without shadow copying



 Comments   
Comment by Adelin Mbida Owona [ 28/Jul/22 ]

Won't do as a result of https://jira.mongodb.org/browse/CSHARP-4271

Comment by Jeffrey Yemin [ 01/Jun/21 ]

Not too high priority because # is not a common character to include in a file system path.

Generated at Wed Feb 07 21:46:01 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.