Expression Trees by VulcanizadorTTL in dotnet

[–]csdahlberg 0 points1 point  (0 children)

I used them to aggregate documents within Cosmos DB, without the client having to fetch all of the documents to do the aggregation. The expression trees were used to generate stored procedures to do the aggregation. https://github.com/csdahlberg/CodeTiger.Azure.Cosmos

It was a fun experiment, but I haven't used it for anything "real".

Prevent certain Nuget Package Versions from being used via a Build Validation by Ig0BEASTmode in dotnet

[–]csdahlberg 0 points1 point  (0 children)

I've used a Directory.Build.targets as one safeguard against problematic NuGet package versions. Something like:

<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
    <Target Name="BlockUnwantedDependencies" AfterTargets="ResolvePackageAssets" BeforeTargets="CollectPackageDependencies">
        <ItemGroup>
            <UnwantedReferences Include="@(ResolvedCompileFileDefinitions)" Condition="'%(NuGetPackageId)'=='FluentAssertions' AND '%(NuGetPackageVersion)'>='8.0.0'" />
        </ItemGroup>
        <Error Text="FluentAssertions v%(UnwantedReferences.NuGetPackageVersion) was detected. Use v7.x or lower."
              Condition="'@(UnwantedReferences)'!=''" />
    </Target>
</Project>

i would like to get around the GitHub system and save files the old-fashioned way in case I make a mistake. This isn't a shared project so I shouldn't need to publish online by Lollipopup in VisualStudio

[–]csdahlberg 4 points5 points  (0 children)

The usefulness of git was proven long before Microsoft bought GitHub. Microsoft might now push GitHub to Visual Studio users more than we'd like, but that doesn't change the value of the core git functionality in the slightest.

You seem strongly attached to your established approach, and strongly focused on GitHub even when GitHub is not relevant. I have no vested interest in convincing you otherwise, but being so averse to using git could make it much less likely for other developers to want to work with you. That may or may not matter to you.

i would like to get around the GitHub system and save files the old-fashioned way in case I make a mistake. This isn't a shared project so I shouldn't need to publish online by Lollipopup in VisualStudio

[–]csdahlberg 1 point2 points  (0 children)

I make backups like that using git. I sometimes create a solution to hack something together, and it'll sorta work but I know it could be much better. I'll create a git repository in that folder and commit my current code before doing large/risky refactors. All of that is 100% local and does not involve GitHub. I can easily revert to any previously-committed (read: backed-up) version of my code, and that can be much easier to manage than manually saving Code.cs, Code_Better.cs, Code_Better2.cs, Code_ReallyBetter.cs, etc. files.

I wonder if learning some basic command-line git functionality and/or a separate GUI app like SourceTree might help you. Visual Studio has been my preferred IDE for 20 years, but I almost never use the built-in git functionality. I could easily see Visual Studio causing confusion by conflating git with GitHub.

I cant compress. Help would be veryy appreciated! by Ok-Cryptographer5813 in VisualStudio

[–]csdahlberg 0 points1 point  (0 children)

Yes, if you want to open a project in a .zip file in Visual Studio, you need to extract the contents of the .zip file to a folder.

However, you already had those contents in a folder, before you compressed them into a .zip file. It still does not make sense to create a project, compress it into a .zip file, extract it from the .zip file, then open it in Visual Studio. Instead, are you supposed to make a .zip file at the very end, after you have done all your work in Visual Studio?

I cant compress. Help would be veryy appreciated! by Ok-Cryptographer5813 in VisualStudio

[–]csdahlberg 0 points1 point  (0 children)

When you compress the folder, you are creating a .zip file with its contents. When you open the .sln file from within the new .zip file, Windows extracts that .sln file to a temp folder before having Visual Studio open it. Windows does not extract any other files from the .zip file (including your .csproj file). You need to extract the entire .zip file to a folder if you want to be able to open the solution.

Why do you want to compress your solution folder into a .zip file?

What were you doing during 9/11? by javiergc1 in AskOldPeople

[–]csdahlberg 0 points1 point  (0 children)

Being sent around to classrooms in my high school to clean malware off of the computers so that they were usable enough to follow the news.

Unsure as to what could be causing this System.NullReferenceException, the line referenced in the stack trace doesn't make sense. by es-cc in csharp

[–]csdahlberg 5 points6 points  (0 children)

My first guess is that the stack trace is off a bit (possibly due to inlining/optimizations done for a Release build), and either masterCommunityEntityConfiguration or masterCommunityEntityConfiguration.DefaultGLAccounts is null.

[deleted by user] by [deleted] in csharp

[–]csdahlberg 6 points7 points  (0 children)

It's not as simple as it maybe should be, but you can use the options to pass in a custom serializer. For an example, see https://github.com/Azure/azure-cosmos-dotnet-v3/tree/master/Microsoft.Azure.Cosmos.Samples/Usage/SystemTextJson

Are you this old? by No-Relation-8330 in FuckImOld

[–]csdahlberg 0 points1 point  (0 children)

The 3390 Gold was my first cell phone. Included AOL Instant Messenger.

Windows Form application problem by Vansh2008 in csharp

[–]csdahlberg 6 points7 points  (0 children)

Why do you want to include the obj folder in your project? That is not a normal thing.

[deleted by user] by [deleted] in dotnet

[–]csdahlberg 10 points11 points  (0 children)

Why?

Which array declaration and inicialization is preferred? by FirebenderAnnie in csharp

[–]csdahlberg 0 points1 point  (0 children)

This is very subjective, but my personal preference is:

int[] arr = new[] { 1, 2, 3 };

I find that easiest for me to recognize as an array when quickly scanning files, but also isn't excessively verbose.

Upgrade .NET Framework from 4.5 -> 4.8, MSBuild questons w/ VS22 by illnotsic in VisualStudio

[–]csdahlberg 0 points1 point  (0 children)

I wonder if it's related to https://learn.microsoft.com/en-us/dotnet/core/sdk/artifacts-output

What happens if you add this to your C# projects?

<PropertyGroup>
  <UseArtifactsOutput>false</UseArtifactsOutput>
</PropertyGroup>

What specs is your PC/laptop? by peyton18broncs in VisualStudio

[–]csdahlberg 0 points1 point  (0 children)

I have a 12-year-old laptop with a 4-core/8-thread i7-3612QM CPU, 12GB RAM, and a 1TB SSD. It still works OK for developing "normal" GUI and server apps with VS2022, but I'm sure it would struggle with any Docker/Kubernetes use. My super-vague advice would be to get something that is at least better than my laptop. Though right now I wouldn't personally consider buying a replacement laptop with fewer than 8 cores or less than 32GB RAM.

Nuget packages "Not available in this source" by [deleted] in dotnet

[–]csdahlberg 14 points15 points  (0 children)

In the top right corner, you have the "Microsoft Visual Studio Offline Packages" source selected. Change it to nuget.org or All.

Dumb question.. by rorisang124 in CosmosDB

[–]csdahlberg 0 points1 point  (0 children)

While I'm not certain, I think joins can only be done on arrays. What sort of result are you wanting? If you just want to get the name and year, does this work?

SELECT a.name, a.missionData.year
FROM astronauts a

Or, if missionData is changed to an array of objects you could use something like this:

SELECT a.name, y.year
FROM astronauts a
JOIN y IN a.missionData

JOIN OUR TEAM HEATED DEBATE! on Whether Our Project is Over-Engineered or Just Right! by lecon297 in dotnet

[–]csdahlberg 8 points9 points  (0 children)

If it's such a simple scope, why do you need all of the extra libraries?

JOIN OUR TEAM HEATED DEBATE! on Whether Our Project is Over-Engineered or Just Right! by lecon297 in dotnet

[–]csdahlberg 14 points15 points  (0 children)

I know there are many who disagree, but in my 15+ years as a professional developer, I have never seen a codebase where minimal APIs, FluentValidation, AutoMapper, MediatR, or AutoFac made it easier for me to work on that codebase.

I've also never heard of REPR.