Coder Social home page Coder Social logo

Comments (9)

niemyjski avatar niemyjski commented on June 10, 2024

Can you please provide detailed steps that can reproduce this? I've tried both a sample console app as well as unit test and am unable to reproduce this issue. The only thing I could think would be some concurrency issue writing to the file at the same time. But the file should be completely overwritten and behind a lock.

        public virtual void CanRoundTripSettingsWithUpdates() {
            var settings = new SettingsDictionary {
                ["MySetting"] = "ABCDE"
            };

            var storage = GetStorage();
            storage.SaveObject("test.json", settings);

            settings["MySetting"] = "AB";
            storage.SaveObject("test.json", settings);

            var savedSettings = storage.GetObject<SettingsDictionary>("test.json");
            Assert.Single(savedSettings);
        }
{"MySetting":"AB"}

from exceptionless.net.

pv11 avatar pv11 commented on June 10, 2024

The problem is observable like this:

  • create a new console program (in this case I'm using .Net framework 4.5.2)
  • add the appropriate Exceptionless library
  • write the following code and execute (change the apiKey; change "c:\temp" to other folder if needed ):
        static void Main(string[] args)
        {
            const string apiKey = "TLFsO5wRvyoMDiF3SSJOgkskCNhTHw**********";
            const string useFolder = @"c:\temp";

            var serverSettingsFile = Path.Combine(useFolder, apiKey.Substring(0,8), "server-settings.json");

            ExceptionlessClient.Default.Configuration.UseFolderStorage(useFolder);
            ExceptionlessClient.Default.Configuration.UseFileLogger(Path.Combine(useFolder, $"Exceptionless.log"));

            ExceptionlessClient.Default.Startup(apiKey);

            while (true)
            {
                Console.WriteLine("Change Client Configuration Settings and watch the result here (you might need to wait up to 2 minutes...)");

                System.Threading.Thread.Sleep(5000);

                if (File.Exists(serverSettingsFile))
                {
                    Console.WriteLine($"Current settings (at {DateTime.Now:u}):");
                    Console.ForegroundColor = ConsoleColor.Cyan;
                    Console.WriteLine(File.ReadAllText(serverSettingsFile));
                    Console.ResetColor();
                }
            }
        }

console result

from exceptionless.net.

niemyjski avatar niemyjski commented on June 10, 2024

Does this happen if you don't use a temp folder? I just tried it and I couldn't reproduce

image

from exceptionless.net.

pv11 avatar pv11 commented on June 10, 2024

Apparently the problem occurs only when using a custom folder to settings storage, i. e.:
ExceptionlessClient.Default.Configuration.UseFolderStorage("c:\\myfolder");

It looks OK when using:
ExceptionlessClient.Default.Configuration.UseIsolatedStorage();

(one can confirm by opening the file "C:\ProgramData\IsolatedStorage\xxx\AssemFiles\TLFsO5wR\server-settings.json" )

from exceptionless.net.

niemyjski avatar niemyjski commented on June 10, 2024

What operating system are you using? I'm on Windows 11 and I also tried it with UseFolderStorage("store") and it worked

from exceptionless.net.

pv11 avatar pv11 commented on June 10, 2024

I'm using Windows 10 Pro.

However, I downloaded the entire code from this repository and tested by referencing directly the VIsual Studio project into my test console (instead in referencing the complied assemblies), and that way it worked OK.

So the mistery remains.

from exceptionless.net.

niemyjski avatar niemyjski commented on June 10, 2024

I've been able to reproduce using the nuget package and not source. I'll try and track this down

from exceptionless.net.

niemyjski avatar niemyjski commented on June 10, 2024

I need to get better about pushing more frequent releases. I just noticed after tracking this down that this was actually fixed in this pr quite some time ago: #247 I'm pushing a new release in a few minutes.

from exceptionless.net.

niemyjski avatar niemyjski commented on June 10, 2024

https://github.com/exceptionless/Exceptionless.Net/releases/tag/v4.7.0

from exceptionless.net.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.