Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
thumper57
Feb 26, 2004

As a heavy Moq user, NSubstitute not having a Strict mode is making my head hurt.

Adbot
ADBOT LOVES YOU

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost
It's funny seeing stuff written about moq as if its an organization. It's one guy's (kzu) project.

For context, I worked with him at Xamarin/Microsoft. AFAIK for the timeline, many of these projects (moq, gitinfo, etc) were started as projects to solve problems at Xamarin. If you were making a tool (for CI, testing, whatever) that wasn't a part of the core project, you could open-source it. In a way, IMO, it could be thought of as "funding" OSS development (As I see it, I'm not sure how the company did); you're getting a paycheck for your general tasks, and during your workday, you could work on these tools needed for internal operations that others outside can contribute to and use for free.

kzu left Microsoft sometime last year. Now you have a ton of libraries that people depend on, but no one pays for, and you don't have a steady paycheck. What was once manageable (or could at least be justified as part of your work day) now becomes untenable. I can understand the pressure of trying to come up with a solution. This was so so so not it, and digging in further on SponsorKit is really bad. But I feel bad. Especially with the GitHub issue and seeing how many people are doing the worst possible readings into it as "evil." IMO he was trying to do the right thing but really should have stopped to ask others first before going all-in on this approach.

The other funny thing about it is, remember I said these projects (mostly) started at Xamarin? Thanks to dependabot, it tried to bump libraries like moq that now include sponsorlink. It didn't work, since the PR builds were broken thanks to the sponsorlink nag code.

It's just sad all around.

Drastic Actions fucked around with this message at 05:39 on Aug 11, 2023

TheBlackVegetable
Oct 29, 2006
Is there maybe an open source licence that says "use this for free unless it's for development in an uber corp in which case cough the gently caress up"?

Maybe GitHub Sponsors needs to be a bit more in-your-face

TheBlackVegetable fucked around with this message at 06:22 on Aug 11, 2023

mystes
May 31, 2006

TheBlackVegetable posted:

Is there maybe an open source licence that says "use this for free unless it's for development in an uber corp in which case cough the gently caress up"?
By definition no

Jabor
Jul 16, 2010

#1 Loser at SpaceChem

TheBlackVegetable posted:

Is there maybe an open source licence that says "use this for free unless it's for development in an uber corp in which case cough the gently caress up"?

if you're using the stallman definition of "open source" then no, any open source license will allow commercial use as long as they abide by the terms of the license, the best you can do is picking something like agpl that's just insanely toxic and that commercial users want to stay away from.

if you don't care about stallman or fsf weenies, then creative commons cc-nc forbids commercial use (and you can sell commercial licenses separately under whatever terms you want). so as long as the license's definition of "commercial use" matches what you expect it to be then it'll do what you want.

mystes
May 31, 2006

Stallman and the FSF don't like the term "open source" so I'm not sure they have a definition for it, but you probably mean the OSI definition. If you don't care about the OSI definition then open source doesn't really mean anything and you can just call anything where the source code is available to view "open source"

NihilCredo
Jun 6, 2011

iram omni possibili modo preme:
plus una illa te diffamabit, quam multæ virtutes commendabunt

TheBlackVegetable posted:

Is there maybe an open source licence that says "use this for free unless it's for development in an uber corp in which case cough the gently caress up"?

Maybe GitHub Sponsors needs to be a bit more in-your-face

Plenty. The new IdentityServer is licensed "open source unless you make 1M/year". MongoDB and Elasticsearch moved to "open source unless you're a cloud provider".

They're controversial licences, I think mainly from a slippery slope kind of point - it becomes a mess if every single little library you use has its own unique and arbitrary limit for "now you're big enough to pay me" buried in the licence. But I think they're still the least bad solution out there if you can't get a support contract or a day job at a sponsor.

e: literally today as I posted this, Hashicorp also switched to "open source except for cloud providers" licensing.

NihilCredo fucked around with this message at 06:50 on Aug 11, 2023

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
yea fair, i'm probably getting them confused.

my big point was that if you want "open source but without this defining property of open source licences", there's a whole world of "not technically open source by some strict definition, but the source is available for people to look at and use if they want it" which may be a better fit

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off
I don't know how these open source guys do it. I have little patience for bullshit. The first time somebody opened an issue and got snippy with me I'd be like "Ok, I'm out. Good luck with this". Or maybe I'd amend the license to ban that person in particular from using it. I'm not good with people.

Nostalgamus
Sep 28, 2010

I guess this is the most appropriate thread for MSI questions?

I have an old InstallShield installation that we have been using for years (without upgrading InstallShield, so the version is from 2005 or so). It mainly copies files, but there is also an MSI part of the install that handles Merge Modules.
Last week we were trying to install this on an Azure instance, and got a "Network location not found" error (Error 1606) - apparently for the Favorites folder in the user profile. The cause seems straightforward enough - the machine is set up for multiple regular users, with their respective OneDrive folders set as the User Profile folders. The installer requires admin privilieges, so we provide the credentials for an admin user - which does not have OneDrive configured, as that user should never need to use the machine in question.
As far as I can tell, we do not at any point attempt to add bookmarks to Internet Explorer, and to the best of my knowledge this folder has never been used for anything else. No part of the install should be referencing those folders, are they somehow required anyway?
There's also a separate - but likely related - bug where the dialog for selecting an install folder won't run when running as administrator (but works fine as a regular user).

My gut feeling is that we will need to configure User Profile folders for the admin user, either through setting up OneDrive, or reconfiguring the locations to be local drive folders for that particular user. However, I will likely have to argue with the customers IT department, and I don't think "a gut feeling" is sufficient argument.

Core questions:
Are User Profile folders mandatory, or is it possible to work around their absence?
If they are mandatory, is there any official documentation that states this?

e: Gut feeling was a good enough argument, and turned out to work.

Nostalgamus fucked around with this message at 18:45 on Aug 22, 2023

epswing
Nov 4, 2003

Soiled Meat
I am sad that the SignalR C# client library requires the Desktop Runtime and the ASP Runtime :( which requires me to bundle both with my desktop (WPF) app. I use Squirrel for deployment/installation packaging and of course it can auto-install the Desktop Runtime but not the ASP Runtime (though support to auto-install the ASP Runtime is already implemented and will be released in the next version, which might be tomorrow, or might be a year from now, who knows). And sending users to this sdk/runtime download page is a non-starter https://dotnet.microsoft.com/en-us/download/dotnet/6.0.

mystes
May 31, 2006

epswing posted:

I am sad that the SignalR C# client library requires the Desktop Runtime and the ASP Runtime :( which requires me to bundle both with my desktop (WPF) app. I use Squirrel for deployment/installation packaging and of course it can auto-install the Desktop Runtime but not the ASP Runtime (though support to auto-install the ASP Runtime is already implemented and will be released in the next version, which might be tomorrow, or might be a year from now, who knows). And sending users to this sdk/runtime download page is a non-starter https://dotnet.microsoft.com/en-us/download/dotnet/6.0.
For distributing desktop software with .net 6+ are you even supposed to rely on the runtime being installed globally?

Aren't you supposed to use the self contained mode or something?

epswing
Nov 4, 2003

Soiled Meat

mystes posted:

For distributing desktop software with .net 6+ are you even supposed to rely on the runtime being installed globally?

Aren't you supposed to use the self contained mode or something?

Yeah... that'd bring my 12mb app up to 200mb+ :barf: and to my knowledge WPF doesn't support trimming. Some of my customers are rural and have slow internet connections, large file sizes are bad.

Of course, they still have to pay the penalty of downloading the runtime(s) once, but with self-contained they'd pay with every update to the software.

I'm just not jazzed about the requirement of the ASP Runtime just because I'm using SignalR on the client side.

epswing fucked around with this message at 16:58 on Sep 1, 2023

Surprise T Rex
Apr 9, 2008

Dinosaur Gum
Forgot about this thread but it reappeared at a good time! Anyone know anything about Azure DevOps?

Trying to put a pipeline together that runs all tests, then packages up 6 individual Azure Functions App projects into artifacts, while minimising repeated work (like multiple nuget restores, and building the entire thing only once ideally if we can?)

Currently we have 6 parallel DotNetCLI@2 jobs running to build each function project that all depend on a single test step beforehand, and each does its own restore and build.

This definitely seems possible, but not sure if it’s easy, or if I’m overthinking how much this will actually affect build times?

Chasiubao
Apr 2, 2010


Add an explicit dotnet restore step, and then your build steps can pass the —no-restore flag to skip that.

Bodrick
Jan 3, 2009

In the unlikely event it gets outside, use full force to feign ignorance and pretend nothing happened.

Surprise T Rex posted:

Forgot about this thread but it reappeared at a good time! Anyone know anything about Azure DevOps?

Trying to put a pipeline together that runs all tests, then packages up 6 individual Azure Functions App projects into artifacts, while minimising repeated work (like multiple nuget restores, and building the entire thing only once ideally if we can?)

Currently we have 6 parallel DotNetCLI@2 jobs running to build each function project that all depend on a single test step beforehand, and each does its own restore and build.

This definitely seems possible, but not sure if it’s easy, or if I’m overthinking how much this will actually affect build times?

Can you have a build job/stage that restores and compiles the project and publishes it as a pipeline artifact first, then a separate test stage or set of jobs that check out that pipeline artifact first and run the tests against it? That way you keep the parallelism of the test runs but only have to compile the project once.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
We use ADO for all our builds at work. It is very flexible if you use the option to write your build script as a YAML file. Restoring only once is certainly something you can do, can't say how much it is going to affect build times or whatever.

TheBlackVegetable
Oct 29, 2006

epswing posted:

Yeah... that'd bring my 12mb app up to 200mb+ :barf: and to my knowledge WPF doesn't support trimming. Some of my customers are rural and have slow internet connections, large file sizes are bad.

Of course, they still have to pay the penalty of downloading the runtime(s) once, but with self-contained they'd pay with every update to the software.

I'm just not jazzed about the requirement of the ASP Runtime just because I'm using SignalR on the client side.

Delivering binary deltas when patching is an option if it's needed, brings the size right down to kilobytes in most cases

Magnetic North
Dec 15, 2008

Beware the Forest's Mushrooms
How do people format their documents in Visual Studio (not Visual Studio Code) nowadays? I'm on 2019 if it matters, and don't want to pay for Resharper. I can't remember what I used to use to get the automatic formatting at previous jobs because it's been ages since I set that stuff up.

LongSack
Jan 17, 2003

Magnetic North posted:

How do people format their documents in Visual Studio (not Visual Studio Code) nowadays? I'm on 2019 if it matters, and don't want to pay for Resharper. I can't remember what I used to use to get the automatic formatting at previous jobs because it's been ages since I set that stuff up.

Maybe less than you’re looking for, but all I use is Control-K-D which does things like adding spaces, aligning braces, etc., and the “code cleanup” profiles (i think using Control-K-E) which you can configure to get rid of unused usings, etc.

Edit: i think that Control-K-E also does what Control-K-D does

Magnetic North
Dec 15, 2008

Beware the Forest's Mushrooms

LongSack posted:

Maybe less than you’re looking for, but all I use is Control-K-D which does things like adding spaces, aligning braces, etc.,

This is what I was looking for, thank you.

Cold on a Cob
Feb 6, 2006

i've seen so much, i'm going blind
and i'm brain dead virtually

College Slice
You can also use “dotnet format” from the command line, both to lint your files (ie to warn you if your files aren’t formatted such as with a git prepush hook or a ci/cd step) and to actually fix them.

bobua
Mar 23, 2003
I'd trade it all for just a little more.

In EF Core 7, I have an many-to-many relationship that's scaffolded using scaffold-dbcontext, so the join table isn't materialized.


Given a list of items and a list of tags, I want to remove any tags on those items. I know I can manually materialize the join table, or write the actual sql query, but I feel like there should be an efficient way to do this that I'm missing.

with the join table I'd just do something like:
await context.BookTags.Where(x => bookIdList.Contains(x.BookId) && x.TagId == tag.Id).ExecuteDeleteAsync();

Without it, I have to do something like
var books = await context.Books.Include(x => x.Tags).Where(x => tagList.Contains(x.Tag));
foreach(var book in books)
{
//individually find and remove tags from taglist in book.Tags
}
savechanges...

Kyte
Nov 19, 2013

Never quacked for this
Couldn't you use DbContext.Set to access the DbSet and start the query? You'll till need to define the class somewhere tho.

ChocolatePancake
Feb 25, 2007
I've always materialized my join tables, but if this is the only use case you have for directly accessing/modifying that table, then I would just write the SQL query directly. Especially as it seems like a pretty simple one.

bobua
Mar 23, 2003
I'd trade it all for just a little more.

Kyte posted:

Couldn't you use DbContext.Set to access the DbSet and start the query? You'll till need to define the class somewhere tho.

Yeah, this just gets back to more custom setup and partial classes though, which is what I was hoping to avoid.

I also tried adding another column to the join table, which did cause the scaffolding to automatically materialize it, but then broke the navigation properties. I'm just gonna write the sql query, I was just hoping I was missing another method.

Kyte
Nov 19, 2013

Never quacked for this
The theoretical code you want would be something like:
code:
dbContext.Set("BookTags").Where(x => bookIdList.Contains(x["BookId"]) && x["TagId"] == tag.Id).ExecuteDeleteAsync();
// x would be a Dictionary<string, object>, so you'd need to fix up the typing
And you're practically writing the SQL manually at this point.

Heroic Yoshimitsu
Jan 15, 2008

This is probably a dumb question… can’t find a straight answer on it… can IdentityServer4 work with .Net6?

ChocolatePancake
Feb 25, 2007

Heroic Yoshimitsu posted:

This is probably a dumb question… can’t find a straight answer on it… can IdentityServer4 work with .Net6?

According to the nuget page, yes.
https://www.nuget.org/packages/IdentityServer4/4.1.2#supportedframeworks-body-tab

Heroic Yoshimitsu
Jan 15, 2008

Gotcha, I see. I'm trying to upgrade this one project from .Net Core 3.1 to .Net 6, and I'm around into some build errors related to ambiguous references in Identity now, between IdentityServer4 and Duende. I didn't 'mean' to install Duende, but I think Microsoft packs it in so-to-speak with .Net 6 ... so anyway, I was trying to figure out if IdentityServer4 can even work with .Net 6 in the first place.

biznatchio
Mar 31, 2001


Buglord
I've had some compatibility issues with Duende+RSK's SAML2p plugin on .NET 6 but I didn't invest a lot of effort into digging up a root cause on it, I just dropped the project back down to .Net Core 3.1 and resolved to figure it out Some Day™️.

susan b buffering
Nov 14, 2016

Heroic Yoshimitsu posted:

This is probably a dumb question… can’t find a straight answer on it… can IdentityServer4 work with .Net6?

Yeah, we did that upgrade earlier this year. I think .NET 6 is the end of the road if you don't want to fork it or pay for the successor though.

Magnetic North
Dec 15, 2008

Beware the Forest's Mushrooms

Heroic Yoshimitsu posted:

Gotcha, I see. I'm trying to upgrade this one project from .Net Core 3.1 to .Net 6, and I'm around into some build errors related to ambiguous references in Identity now, between IdentityServer4 and Duende. I didn't 'mean' to install Duende, but I think Microsoft packs it in so-to-speak with .Net 6 ... so anyway, I was trying to figure out if IdentityServer4 can even work with .Net 6 in the first place.

Is there a reason you can't you use the fully qualified class name?

NiceAaron
Oct 19, 2003

Devote your hearts to the cause~

I'm assuming the issue is that the fully qualified class names are ambiguous (i.e. the same namespaces are used in both assemblies), in which case one solution is to use the "extern alias" feature.

https://learn.microsoft.com/en-us/dotnet/csharp/language-reference/keywords/extern-alias
https://learn.microsoft.com/en-us/nuget/consume-packages/package-references-in-project-files#packagereference-aliases

epswing
Nov 4, 2003

Soiled Meat
I'm receiving some bytes from a socket stream and displaying them in a WPF TextBlock. Sometimes the bytes contain "non-printable" characters that aren't displayed, for example:



If I copy/paste the contents to Notepad++ and turn on "Show All Characters" I can see them:



If I wanted to display such chars like this in WPF, what should I be googling for? All manner of searches for character encodings are leading me to places that are close to but not precisely what I'm looking for.

Edit: I guess I need to loop through the bytes themselves and match each byte against a table/dict that will tell me "that's '06' in hex, so represent that as 'ACK'. But then I start thinking about multi-byte and unicode and code points and... I'm happy to go down the rabbit hole, just wondering if there's already some established way to achieve this.

epswing fucked around with this message at 17:39 on Oct 12, 2023

mystes
May 31, 2006

Just to be clear are you using a raw socket and actually trying to display tcp messages like SYN/ACK or is that unintentional?

mystes fucked around with this message at 17:29 on Oct 12, 2023

epswing
Nov 4, 2003

Soiled Meat

mystes posted:

Just to be clear are you using a raw socket and actually trying to display tcp messages like SYN/ACK or is that unintentional?

Oh, no sorry that was unintentional, I’m not trying to display the TCP handshake/conversation, just the content of the messages received, which are sometimes not normally printable characters. I’m reading bytes from a stream (could be TCP, UDP, etc) and trying to display them in a way the user can see all chars/bytes, maybe similar to the way Notepad++ does it.

epswing fucked around with this message at 18:34 on Oct 12, 2023

fankey
Aug 31, 2001

You can iterate through your bytes and replace any non-printable ( < 32 or == 127 ) with the appropriate Control Picture which will cover up to 0x7f. Above that it looks like Notepad++ is just displaying whatever ANSI ( or whatever encoding you are using ) character it maps to. In a bunch of cases it won't print anything ( the (not used) items referenced here - https://www.alanwood.net/demos/ansi.html ). In theory you could make a font that displays characters above 0x7f in their hex form similar to the Control Pictures - I contemplated that but remembered how painful it is to author fonts.

mystes
May 31, 2006

I guess it might be somewhat overkill but you could also just use a webview2 control and use html/css and replace the nonprintable characters with a number in a span element with a border... it's a LOT easier to do arbitrary formatting in html

There's probably also some way to do that in a RichTextBox if you really want to

mystes fucked around with this message at 19:47 on Oct 12, 2023

Adbot
ADBOT LOVES YOU

epswing
Nov 4, 2003

Soiled Meat

fankey posted:

You can iterate through your bytes and replace any non-printable ( < 32 or == 127 ) with the appropriate Control Picture which will cover up to 0x7f. Above that it looks like Notepad++ is just displaying whatever ANSI ( or whatever encoding you are using ) character it maps to. In a bunch of cases it won't print anything ( the (not used) items referenced here - https://www.alanwood.net/demos/ansi.html ). In theory you could make a font that displays characters above 0x7f in their hex form similar to the Control Pictures - I contemplated that but remembered how painful it is to author fonts.

Control Pictures! Never heard of these, but it looks like what I'm after, thanks.

I guess my concern would be when looping through bytes, how do I know if a given byte is a single byte like 04 that I should replace with the EOT control picture, or part of a multi-byte character that happens to contain an 04 byte? If the text is ASCII encoded, probably nothing to worry about, but if it's e.g. UTF-8 couldn't there by multi-byte chars in there?

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply