Menu
Cutty
  • Chryslers
  • Lutherie
  • YLSNED
  • About
Cutty

Category: You Learn Something New Every Day

Proof that you do actually learn something new every day.

Serializing List<Dictionary<string, object>> not working in dotnet core 8.0

Posted on August 22, 2024August 22, 2024 by Iain 'Cutty' Carlin

My previously working code (dotnet 6.0) that was serialising a complex object, stopped producing Json output at the API controller. The object(s) are defined as:

    public class ReportResultsDTO
    {
        public string ReportTitle { get; set; }
        public List<ReportResultDTO> Results { get; set; } = [];
    }

    public class ReportResultDTO
    {
        public string Title { get; set; }
        public List<Dictionary<string, object>> Data;
    }

Turns out that because System.Net.Text is now used by default (rather than Newtonsoft.Json) it doesn’t handle converting List<Dictionary<string, objectto Json. I tried converting it to a Json string first and outputting that, but the returned string was full of \” characters to escape the string(s).…

+

HTTP Error 500.30 ASP.NET Core app failed to start

Posted on August 21, 2024 by Iain 'Cutty' Carlin

Windows event log had this error message:

Application '/LM/W3SVC/7/ROOT' with physical root 'C:\inetpub\wwwroot\scwebgroup.com' hit unexpected managed exception, exception code = '0xe0434352'. Please check the stderr logs for more information.

Go this error message in a dotnet core project. App would run fine in IIS Express and Kestrel but not on IIS proper. After trying many of the suggested solutions on the web, I discovered the issue was being caused by the entry:

<environmentVariable name="APIDISCOVERY_FILEPATH" value="D:\VersaDev.SRS.IdentityServer\VersaDev.SRS.IdentityServer\obj\Debug\net6.0\ApiEndpoints.json" /

in the web.config file. Turns out the failure was down to updating the app to net8.0 which caused a conflict wit this line. Commented out the line and the problem went away.…

+

Entity Framework Migrations and Case Sensitivity in MariaDb

Posted on August 20, 2024 by Iain 'Cutty' Carlin

I did a ‘database first’ reverse engineering of an existing database to create a model for Entity Framework.

I then tried to use that model to create a migration and subsequent new database on a MariaDB instance running under Windows.

I kept getting an error message “Table ‘__efmigrationshistory’ already exists” whenever I ran “dotnet ef database update”. I suspected the issue was to do with case sensitivity of the table name(s).

Things I tried to resolve the issue:

  • Manually rename the table in the database to lower case.
  • Change the lower_case_table_names setting to 2 in my.ini (location is set in the windows service settings.
…
+

Constrained image resizing in OneNote – one of these things is not like the other!!

Posted on September 19, 2022September 19, 2022 by Iain 'Cutty' Carlin

To constrain the image resizing to the same ratio in OneNote, you just drag the corners of the image. On just about every other application (Adobe, Visio, Word etc.) you hold down the shift key when dragging to constrain the ratio.

I could live with this in OneNote, EXCEPT that, when you hold down the shift key in OneNote it actually does the reverse and does a free resize….another Microsoft non-standard…..…

+

Xamarin debugging Android from Virtual Box

Posted on March 22, 2021 by Iain 'Cutty' Carlin

Background/Environment

Virtuality

I like to develop inside a Virtual Machine. The advantages of this are:

  • The environment is portable, so I can move it between machines;
  • I can backup and/or snapshot machines so can recover quickly in the event of some failure or error;
  • I can set up different machines for different workflows (e.g. one for API dev, one for Mobile dev etc.)
  • I can replace my physical device without going through the pain of rebuilding my development environment, and;
  • I can use any OS on my physical device

I use VirtualBox to host my guest machines – I’ve tried Microsoft Hyper-V, but for whatever reason it just lacks the performance and flexibility that I’ve found with VirtualBox.

…
+

SqLite Auto-increment fields in Entity Framework

Posted on December 11, 2019December 11, 2019 by Iain 'Cutty' Carlin

By default, Scaffolding a table with an auto-increment field adds:

.ValueGeneratedNever();

To the field in the Model Builder. This will cause an automatic value NOT to be generated. This needs to be removed.

Also, we need to add:

        [DatabaseGenerated(DatabaseGeneratedOption.Identity)]
        public int? TemplateId { get; set; }

To the item – and ensure it is a nullable int. https://docs.microsoft.com/en-us/ef/core/modeling/generated-properties …

+

Interface the virtual abstract

Posted on November 29, 2019December 1, 2019 by Iain 'Cutty' Carlin

I’ve researched this several times now and keep forgetting the results. So, putting it here to record it for next time. What is the difference and usage for c# interfaces, virtual and abstract classes and methods? And where do you use them?

Interface

An interface specifies a contract.

  • Interfaces contain only declarations of the members in the class but cannot contain implementation details.
  • Interfaces do not have constructors
  • All methods in an interface MUST be implemented by the class
  • It only contains public access modifier because everything in the interface is public.
  • A child class can inherit from multiple interfaces (multiple inheritance)
  • [Note that properties in C# are in effect a method, so you can specify a property in an interface, but the property needs to be implemented by the derived class].
…
+

Configuring SSIS on SQL 2017

Posted on February 14, 2018December 1, 2019 by Iain 'Cutty' Carlin

Not as easy as you would think, once installed, the service wouldn’t start, then I couldn’t log on (Access Denied) then I couldn’t connect remotely.

  • Install and Configure DCOM: https://docs.microsoft.com/en-us/sql/integration-services/service/integration-services-service-ssis-service
  • Configure Firewall to allow RPC: http://slavasql.blogspot.com.au/2016/07/ssis-rpc-server-is-unavailable-error.html
  • Create SSIS Catalog: https://technet.microsoft.com/en-us/library/gg471509(v=sql.110).aspx
  • Run SSIS Package with Powershell: https://docs.microsoft.com/en-us/sql/integration-services/ssis-quickstart-run-powershell

 …

+

SSIS Toolbox missing in Visual Studio 2017

Posted on November 2, 2017 by Iain 'Cutty' Carlin

I have installed the Data-Tier Application Framework and SQL Server Data Tools for VS 2017 . I created a solution then returned to it a week later and the SSIS toolbox had disappeared.

I opened the toolbox window using View -> Toolbox but it was empty.

To get the SSIS toolbox back, right-click on the SSIS design surface in the project and select SSIS Toolbox – hey presto! it reappears.

 …

+

SharePoint Calendar – Offset and length were out of bounds….

Posted on September 19, 2016September 23, 2016 by Iain 'Cutty' Carlin

When swapping from the Day view to Week view of a SharePoint calendar, we were getting the following error message: “Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection”.

Tried setting the Information Management Policy Settings to 2 months (was 3) to archive list down to less items (It had about 4800 records, got it down to 4200). [NB: Run Information Management Policy job first, then Expiration Policy]. Problem was not resolved.

We have 2 views of the data, filtered to a different number of items in each.…

+
  • 1
  • 2
  • 3
  • 4
  • 5
  • Next

Recent Posts

  • 2024 was the best year for our solar system
  • Books I read in 2024
  • Books I read in 2023
  • Happy New Year 2024
  • Lawson – A life in words and music

Categories

  • Chryslers (1)
  • Cutty's Blog (12)
  • Lutherie (38)
  • You Learn Something New Every Day (43)
©2025 Cutty | Powered by Superb Themes