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
Hughmoris
Apr 21, 2007
Let's go to the abyss!
*Ignore this terrible snipe.

Hughmoris fucked around with this message at 21:44 on Apr 5, 2020

Adbot
ADBOT LOVES YOU

friendbot2000
May 1, 2011

https://stackoverflow.com/questions/61063114/how-do-i-find-the-attributes-of-the-chrome-security-certificate-window-for-autom

I posted this on Stackoverflow, but may as well post it here since we are all working from home because of COVID. I am making use of my glorious "WFH until the end of days" time transitioning the automated tests to work with well...everything. I ran into a problem with the Chrome Certificate Select security window not working with AutoIT or anything. I need some help trying to identify the name of this goddamn security window so I can bypass it or finding a way to interact with it at all. The goal here is to get to the Cancel Button or get an ESC keypress to go through programmatically so the window moves onto the dev environment. Why the dev environment needs to have the CAC Card dialogue show up at all is beyond me.

I tried a bunch of things like creating a Chromewrapper class that uses the Runtime.InteropServices lib to spam this thing with SendMessege, but nothing works because as far as I can tell because once Selenium webdriver hits that "I Accept The Terms" button and the Cert window pops up, all code just hangs. The Debugger can't step into anything. It just treats the rest of the code like it doesn't exist.

They also won't give me a soft cert to use for this so I am kinda just....stuck on how to proceed here. In IE we just used AutoIT to send "ESC" or a series of TABs then Enter, to nav to the Cancel Button, but as far as I can tell this window just doesn't exist and nothing can inspect it or see it(for security reasons I am sure.)

Can anyone help me out here?

Cuntpunch
Oct 3, 2003

A monkey in a long line of kings

friendbot2000 posted:

https://stackoverflow.com/questions/61063114/how-do-i-find-the-attributes-of-the-chrome-security-certificate-window-for-autom

I posted this on Stackoverflow, but may as well post it here since we are all working from home because of COVID. I am making use of my glorious "WFH until the end of days" time transitioning the automated tests to work with well...everything. I ran into a problem with the Chrome Certificate Select security window not working with AutoIT or anything. I need some help trying to identify the name of this goddamn security window so I can bypass it or finding a way to interact with it at all. The goal here is to get to the Cancel Button or get an ESC keypress to go through programmatically so the window moves onto the dev environment. Why the dev environment needs to have the CAC Card dialogue show up at all is beyond me.

I tried a bunch of things like creating a Chromewrapper class that uses the Runtime.InteropServices lib to spam this thing with SendMessege, but nothing works because as far as I can tell because once Selenium webdriver hits that "I Accept The Terms" button and the Cert window pops up, all code just hangs. The Debugger can't step into anything. It just treats the rest of the code like it doesn't exist.

They also won't give me a soft cert to use for this so I am kinda just....stuck on how to proceed here. In IE we just used AutoIT to send "ESC" or a series of TABs then Enter, to nav to the Cancel Button, but as far as I can tell this window just doesn't exist and nothing can inspect it or see it(for security reasons I am sure.)

Can anyone help me out here?

https://blogs.sap.com/2014/01/30/avoid-certification-selection-popup-in-chrome/

Seems relevant?

Bruegels Fuckbooks
Sep 14, 2004

Now, listen - I know the two of you are very different from each other in a lot of ways, but you have to understand that as far as Grandpa's concerned, you're both pieces of shit! Yeah. I can prove it mathematically.

friendbot2000 posted:

https://stackoverflow.com/questions/61063114/how-do-i-find-the-attributes-of-the-chrome-security-certificate-window-for-autom

I posted this on Stackoverflow, but may as well post it here since we are all working from home because of COVID. I am making use of my glorious "WFH until the end of days" time transitioning the automated tests to work with well...everything. I ran into a problem with the Chrome Certificate Select security window not working with AutoIT or anything. I need some help trying to identify the name of this goddamn security window so I can bypass it or finding a way to interact with it at all. The goal here is to get to the Cancel Button or get an ESC keypress to go through programmatically so the window moves onto the dev environment. Why the dev environment needs to have the CAC Card dialogue show up at all is beyond me.

I tried a bunch of things like creating a Chromewrapper class that uses the Runtime.InteropServices lib to spam this thing with SendMessege, but nothing works because as far as I can tell because once Selenium webdriver hits that "I Accept The Terms" button and the Cert window pops up, all code just hangs. The Debugger can't step into anything. It just treats the rest of the code like it doesn't exist.

They also won't give me a soft cert to use for this so I am kinda just....stuck on how to proceed here. In IE we just used AutoIT to send "ESC" or a series of TABs then Enter, to nav to the Cancel Button, but as far as I can tell this window just doesn't exist and nothing can inspect it or see it(for security reasons I am sure.)

Can anyone help me out here?

If you run fiddler you can configure it to ignore certificate errors / reply with a specific certificate without prompting. Fiddler's actually pretty useful to have running when doing automated test stuff anyway.

friendbot2000
May 1, 2011


Hmmm...I read that post before in my search and its not quite the solution because it involves selecting a specific certificate and they won't shell out for a soft cert for me just yet. In order to get past the dialogue, I have to hit cancel on the "Select Certificate" box to get to the bypass "backdoor" we created...for reasons unknown. I will hold the decision to implement CAC Card functionality to be "more like production" on internal dev/test environments against the dude who implemented it till the day I die.

I did find something interesting here though: https://github.com/SeleniumHQ/selenium/issues/5408

Here someone points out that Selenium hasn't finished the Navigate().GoToUrl(...) action yet, which is true because it's stuck in limbo at the auth tier. That is why no code after the action that makes the cert box appear executes. That checks out because that loading icon on the browser tab runs in perpetuity until you close the tab. It doesn't solve my problem, but it's a possible clue? I am just not sure what to do with the said clue. Like, in IE you have the same scenario with the same loading tab, yet you can interact with the Security Cert Popup with AutoIT, why it doesn't work that way in Chrome is what's confusing to me.

friendbot2000 fucked around with this message at 02:57 on Apr 7, 2020

Jen heir rick
Aug 4, 2004
when a woman says something's not funny, you better not laugh your ass off
Why don’t you just import the certificate you’re using into the system certificate store? Chrome should then trust it by default.

Alternatively, I think there’s a way to launch chrome in an insecure mode. Google tells me —allow-running-insecure-content. You could try that.

Jen heir rick fucked around with this message at 03:52 on Apr 7, 2020

Cuntpunch
Oct 3, 2003

A monkey in a long line of kings

Jen heir rick posted:

Why don’t you just import the certificate you’re using into the system certificate store? Chrome should then trust it by default.

Alternatively, I think there’s a way to launch chrome in an insecure mode. Google tells me —allow-running-insecure-content. You could try that.

The issue isn't insecure host certs, it's that he's testing a site which uses client certs for auth, and so the browser wants to know *which* of your local certs you are going to use to auth.

Hughmoris
Apr 21, 2007
Let's go to the abyss!
If I don't have admin rights for a Windows 10 machine, what are my options for learning C#?

I have a lot of downtime currently at my job. I have vscode installed but I can't install the dotnet sdk and trying to manually compile my cs file using csc.exe is failing as well.

Macichne Leainig
Jul 26, 2012

by VG

Hughmoris posted:

If I don't have admin rights for a Windows 10 machine, what are my options for learning C#?

I have a lot of downtime currently at my job. I have vscode installed but I can't install the dotnet sdk and trying to manually compile my cs file using csc.exe is failing as well.

Some cloud solution probably. At my old job when Accenture bought us out they came in with super draconian PC monitoring software and we couldn't even run Visual Studio for weeks. Nobody figured out a workaround, it was a fun few weeks.

insta
Jan 28, 2009

Hughmoris posted:

If I don't have admin rights for a Windows 10 machine, what are my options for learning C#?

I have a lot of downtime currently at my job. I have vscode installed but I can't install the dotnet sdk and trying to manually compile my cs file using csc.exe is failing as well.

A second machine :/

Ola
Jul 19, 2004

Hughmoris posted:

If I don't have admin rights for a Windows 10 machine, what are my options for learning C#?

I have a lot of downtime currently at my job. I have vscode installed but I can't install the dotnet sdk and trying to manually compile my cs file using csc.exe is failing as well.

https://dotnetfiddle.net/

friendbot2000
May 1, 2011

friendbot2000 posted:

https://stackoverflow.com/questions/61063114/how-do-i-find-the-attributes-of-the-chrome-security-certificate-window-for-autom

I posted this on Stackoverflow, but may as well post it here since we are all working from home because of COVID. I am making use of my glorious "WFH until the end of days" time transitioning the automated tests to work with well...everything. I ran into a problem with the Chrome Certificate Select security window not working with AutoIT or anything. I need some help trying to identify the name of this goddamn security window so I can bypass it or finding a way to interact with it at all. The goal here is to get to the Cancel Button or get an ESC keypress to go through programmatically so the window moves onto the dev environment. Why the dev environment needs to have the CAC Card dialogue show up at all is beyond me.

I tried a bunch of things like creating a Chromewrapper class that uses the Runtime.InteropServices lib to spam this thing with SendMessege, but nothing works because as far as I can tell because once Selenium webdriver hits that "I Accept The Terms" button and the Cert window pops up, all code just hangs. The Debugger can't step into anything. It just treats the rest of the code like it doesn't exist.

They also won't give me a soft cert to use for this so I am kinda just....stuck on how to proceed here. In IE we just used AutoIT to send "ESC" or a series of TABs then Enter, to nav to the Cancel Button, but as far as I can tell this window just doesn't exist and nothing can inspect it or see it(for security reasons I am sure.)

Can anyone help me out here?

So I decided to say "gently caress it" and do some weird as environment hacky poo poo to solve the problem I am having with the "Select a Cert" window I mentioned above. I quoted my post for context.

So my goal now is to try to programmatically insert a cookie into Chrome that says I have already clicked the "Cancel Button" on the Select a Cert Window shown here:

https://imgur.com/5lRnPa0

As mentioned above, clicking the Cancel Button redirects the browser to a backdoor where developers and testers can login and bypass the Auth Tier for the application and sign in without test user ids etc. I need a cookie that remembers I have already done that and keeps it in the browser in perpetuity. The trouble is...I am not sure its possible to do that and I haven't really messed with cookie generation before. Does anyone have any suggestions or advice?

friendbot2000 fucked around with this message at 16:28 on Apr 9, 2020

Macichne Leainig
Jul 26, 2012

by VG
Can you access LocalStorage? That might be easier than messing with cookies, which are usually set with a Set-Cookie HTTP header from the web server.

Otherwise, when whatever web server loads in the backdoor, you may just want to send the set-cookie header. Just set Max-Age to some fuckoff huge value if you want it to persist forever.

Macichne Leainig fucked around with this message at 16:34 on Apr 9, 2020

NoDamage
Dec 2, 2000
Imagine my surprise in finding out ASP.NET Core does not have a built-in file logger. What do people normally do for error logging in production? (Deploying on Ubuntu in case it makes a difference.)

Hughmoris
Apr 21, 2007
Let's go to the abyss!

Protocol7 posted:

Some cloud solution probably. At my old job when Accenture bought us out they came in with super draconian PC monitoring software and we couldn't even run Visual Studio for weeks. Nobody figured out a workaround, it was a fun few weeks.


Thanks. I don't think this will be an issue going forward since I got furloughed today. :suicide:

EssOEss
Oct 23, 2006
128-bit approved

NoDamage posted:

Imagine my surprise in finding out ASP.NET Core does not have a built-in file logger. What do people normally do for error logging in production? (Deploying on Ubuntu in case it makes a difference.)

NLog seems to be the most popular one, and it hooks right into ASP.NET Core logging infrastructure to suck all the ASP.NET Core logs into itself. I have been using NLog for 5+ years and have no complaints - works great, I will keep using it for the foreseeable future.

NihilCredo
Jun 6, 2011

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

NoDamage posted:

Imagine my surprise in finding out ASP.NET Core does not have a built-in file logger. What do people normally do for error logging in production? (Deploying on Ubuntu in case it makes a difference.)

Serilog has a great API, produces structured logs, has a dedicated ASP.NET middleware, and will write to anything and the kitchen sink. I totally recommend that.

The only warning I should give is don't forget to import the Serilog.Sinks.Async package and use it to wrap any logging sink that doesn't explicitly say it's already asynchronous. E.g. the console sink is synchronous so it was bottlenecking my service when I returned large object arrays, until I realized it and wrapped it in Async.

JawKnee
Mar 24, 2007





You'll take the ride to leave this town along that yellow line
My work also uses serilog and it's great. You can pair it with something like Seq, or have it write to whatever else

Chrungka
Jan 27, 2015
In company, we mostly use SumoLogic with our own implementation of ILogger / ILoggerProvider. I don't remember why, considering there is one available on NuGet.org. There are also couple of 3rd party implementations of file logger available. You can check if any one fits your needs. e.g. this one: https://www.nuget.org/packages/NetEscapades.Extensions.Logging.RollingFile/

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

NihilCredo posted:

Serilog has a great API, produces structured logs, has a dedicated ASP.NET middleware, and will write to anything and the kitchen sink. I totally recommend that.

The only warning I should give is don't forget to import the Serilog.Sinks.Async package and use it to wrap any logging sink that doesn't explicitly say it's already asynchronous. E.g. the console sink is synchronous so it was bottlenecking my service when I returned large object arrays, until I realized it and wrapped it in Async.

SeriLog works great in my experience. It's great that you can have it write logs directly to app insights, too.

namlosh
Feb 11, 2014

I name this haircut "The Sad Rhino".
Did log4net fall out of favor? That’s what we use, but we just write to disk and the windows event log.

That said, we’re a bank and generate a LOT of logs. Like our little group generates many GB of logs a day using the RollingFileAppender which then has to be archived for like 5 years or something for audit

insta
Jan 28, 2009
I still use l4n, but behind my own ILogger interface. It's worked well enough so far for me.

Roid666
Jul 18, 2010
My company also uses log4net.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



New Yorp New Yorp posted:

SeriLog works great in my experience. It's great that you can have it write logs directly to app insights, too.

NLog has an AI target as well.

LongSack
Jan 17, 2003

Anyone using gRPC on Azure Service Fabric? I’m currently working on a demo project which implements a Microservices architecture on ASF. I’m working my through Haishi Bai’s Programming Microsoft Azure Service Fabric (Second Edition) which was published in 2018.

In the second chapter, we work with stateless services (which technically don’t have to be stateless, they just don’t use ASF reliable collections). We implement a simple calculator service, and use several different inter-service communication methods. First remoting, then WCF, and finally a custom service using gRPC.

So, I install the gRPC, gRPC.Tools, and Google.Protobuf packages, as instructed. I create a Calculator.proto file. The next step is to generate the classes using protoc.exe.

The book says that protoc should be in a directory under the packages directory. It’s not. In fact, there’s nothing gRPC related in packages. The nuget docs for the gRPC.Tools package says that this version integrates into MSBuild, so all I should need to do is build the solution and the generated files should be somewhere under the bin/Debug/[platform] directory. They’re not.

Any clue as to how I can compile my proto file into the required classes? TIA

EssOEss
Oct 23, 2006
128-bit approved
The way that ad-hoc binaries and tools are delivered using NuGet has changed at least 2 times over the past 5 years. Possibly the guide you use works under old assumptions. In ye olden times, it just worked. Then Microsoft hosed it up and binaries were in %home%\.nuget\something\something. Now in more recent versions they are again more reasonable places. Let's see where it went... right now I can find it under myproject\packages\Grpc.Tools.2.27.0\tools\windows_x64\protoc.exe

This is for a .NET Core project, though. If you are not using .NET Core then it might be that it is still in %home%\.nuget\whatever - possibly the 2nd change that unfucked it only applies to .NET Core.

I have never seen any integration with the build process, though. I just manually run a script to compile all my .proto files on build or manually. Here's my script:

code:
$ErrorActionPreference = "Stop"

# This must match Grpc.Tools NuGet package version. Update it when you update the package.
$grpcToolsVersion = "2.27.0"

# Generates C# code for our gRPC APIs in all projects that have ".proto" files in them.
# We run this on every automated build to ensure that we never work with out of date code.

$solutionRoot = Split-Path -Parent $PSScriptRoot

# Use different binary paths for Windows and Linux
if ($IsWindows -or $ENV:OS) {
    $protoc = Join-Path $env:USERPROFILE ".nuget/packages/Grpc.Tools/$grpcToolsVersion/tools/windows_x64/protoc.exe"
    $grpcPluginPath = Join-Path $env:USERPROFILE ".nuget/packages/Grpc.Tools/$grpcToolsVersion/tools/windows_x64/grpc_csharp_plugin.exe"
} else {
    $protoc = Join-Path $env:HOME ".nuget/packages/grpc.tools/$grpcToolsVersion/tools/linux_x64/protoc"
    $grpcPluginPath = Join-Path $env:HOME ".nuget/packages/grpc.tools/$grpcToolsVersion/tools/linux_x64/grpc_csharp_plugin"
}

# Some common .proto files are in here, included by other .proto files.
$common = Join-Path $solutionRoot "Common"

# Anything that has a .proto file in it, we work on.
$projects = Get-ChildItem $solutionRoot -Directory |
	? { (Get-ChildItem $_.FullName -Filter "*.proto").Length -ne 0 }

foreach ($project in $projects) {
    Write-Host "Generating code for $project"

    $protofiles = Get-ChildItem $project.FullName -Filter "*.proto"

    $args = @(
        "-I=`"$common`""
        "-I=`"$($project.FullName)`""
        "--csharp_out=`"$($project.FullName)`""
        "--grpc_out=`"$($project.FullName)`""
        "--plugin=protoc-gen-grpc=`"$grpcPluginPath`""
    )

    foreach ($protofile in $protofiles) {
        $args += $protofile.FullName
    }

    & $protoc $args

    if ($LASTEXITCODE -ne 0) {
        Write-Error "Code generation failed with code $LASTEXITCODE. Command was: $protoc $args"
    }
}

Write-Host "Code generation completed."
And yes, I also just realized that my script still takes the binaries from %home% despite them being copied into the packages folder in the latest version. I suppose that might be the most compatible option?

EssOEss fucked around with this message at 05:14 on Apr 20, 2020

Boz0r
Sep 7, 2006
The Rocketship in action.
I have a method that does a bunch of null guard checks at runtime that throw exceptions, and it takes up a lot of space and makes the code harder to read. I've thought about making some sort of NullGuard() helper method that takes a list of arguments, but then I won't have their names for the exception messages. Any ideas for this? I don't know if I can use the new Non-nullable references in C# 8, but I'd prefer not having to teach the rest of the team.

SAVE-LISP-AND-DIE
Nov 4, 2010

Boz0r posted:

I have a method that does a bunch of null guard checks at runtime that throw exceptions, and it takes up a lot of space and makes the code harder to read. I've thought about making some sort of NullGuard() helper method that takes a list of arguments, but then I won't have their names for the exception messages. Any ideas for this? I don't know if I can use the new Non-nullable references in C# 8, but I'd prefer not having to teach the rest of the team.

I can only think of 2 options: passing nameof(fooInput) into NullGuard with "fooInput" (as a named tuple?) or using reflection to grab attributes, [DisplayName] and so on.

If you look at the .NET team's own code they seem to just suck it up and put conditional calls that throw ArgumentNullException at the top of their methods.

SAVE-LISP-AND-DIE fucked around with this message at 11:11 on Apr 20, 2020

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



Anyone know of a handy tool/script that'll tell me what NuGet package depends on a specific package? Something is bringing in NLog.Config and I don't see it in any of our project files, so I assume it's in the dep tree of some package we depend on and I want to know who to pester on GitHub.

NihilCredo
Jun 6, 2011

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

Munkeymon posted:

Anyone know of a handy tool/script that'll tell me what NuGet package depends on a specific package? Something is bringing in NLog.Config and I don't see it in any of our project files, so I assume it's in the dep tree of some package we depend on and I want to know who to pester on GitHub.

I know I keep sounding like a broken record but Paket has exactly this feature:



Of course you probably don't want to adopt Paket just for this one-off question, but you may try committing your changes, running paket convert-from-nuget locally, asking whatever paket why questions you have, and then git resetting.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



NihilCredo posted:

I know I keep sounding like a broken record but Paket has exactly this feature:



Of course you probably don't want to adopt Paket just for this one-off question, but you may try committing your changes, running paket convert-from-nuget locally, asking whatever paket why questions you have, and then git resetting.

Yeah, that's worth a shot. Also just love that it's called why :allears:

quote:

NLog.Config - 4.7 is a direct (paket.dependencies) and top-level dependency.

Maybe I did the conversion wrong* because that's not even the version that NuGet was restoring. Welp, that's an hour I'm not getting back.

*ended up carpet-bombing the paket.dependencies directory with >= because fixing every version and waiting for it to find the next conflict was getting tedious and I really just wanted to Make It Go

Munkeymon fucked around with this message at 16:12 on Apr 20, 2020

LongSack
Jan 17, 2003

EssOEss posted:

...words...

Thanks! Found them under the %home%.nuget directory.

NihilCredo
Jun 6, 2011

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

Munkeymon posted:

Yeah, that's worth a shot. Also just love that it's called why :allears:


Maybe I did the conversion wrong* because that's not even the version that NuGet was restoring. Welp, that's an hour I'm not getting back.

*ended up carpet-bombing the paket.dependencies directory with >= because fixing every version and waiting for it to find the next conflict was getting tedious and I really just wanted to Make It Go

If that is all it says, that should mean that:
  1. NLog.Config was declared in your project files somewhere - paket found it during the conversion, and it isn't going to guess that from the output DLLs, and
  2. that no other dependency has NLog.Config as an implicit dependency. Otherwise it would appear in a dependency chain, even if it's redundantly declared as an explicit dependency (which was the best practice before NuGet supported lockfiles, i.e. until last year or so).
To show what I mean, try these two sequence of commands

code:
# Declare Moq as an explicit dep, which calls in Castle.Core
dotnet new console
dotnet add package moq
paket convert-from-nuget

# paket.dependencies will now only contain Moq
paket why castle.core

# output:
NuGet castle.core - 4.4 is a transitive dependency.
It is part of following dependency chains:

-> Moq - 4.13.1
  -> castle.core - 4.4
code:
# Declare both packages as explicit deps (redundant)
dotnet new console
dotnet add package moq
dotnet add package castle.core
paket convert-from-nuget

# paket.dependencies will now contain both Moq and Castle.Core
paket why castle.core

# output:
NuGet castle.core - 4.4 is a direct (paket.dependencies) dependency.
It is part of following dependency chains:

-> Moq - 4.13.1
  -> castle.core - 4.4
What happens (before the paket conversion) if you just run git grep NLog.Config on your repo?

NihilCredo fucked around with this message at 17:40 on Apr 20, 2020

Mr Shiny Pants
Nov 12, 2012
I am working on some services that run on Docker, for authentication we use the Azure AD and I have our reverse proxy setup to authenticate all requests to our hosted services. My question is, and my Google skills are failing me, is there a way to have NGINX forward the Oauth reponse to our backend so that I have a UserPrincipal inside ASP.Net?

Is this even possible/smart? The idea of having the reverse proxy doing the authentication was appealing to us because it also terminates the SSL connections.

CapnAndy
Feb 27, 2004

Some teeth long for ripping, gleaming wet from black dog gums. So you keep your eyes closed at the end. You don't want to see such a mouth up close. before the bite, before its oblivion in the goring of your soft parts, the speckled lips will curl back in a whinny of excitement. You just know it.
I asked this in General Programming because I thought it was too minor for this thread, but nobody answered, so I guess the .NET specificity of it put people off? So trying it here:

I do not know much about nuget; I have some nuget packages another guy did and I've been able to piggyback off his work enough to keep them updated. But now I have a problem I can't figure out. The .nuspec file has code like this:
code:
<Target Name="Compile" AfterTargets="Compile">
	<Exec Condition="Exists('$(ProjectDir)obj\$(ConfigurationName)\$(TargetFileName)')" 
	Command="&quot;$(SolutionDir)packages\$(PackageDir)\program.exe do stuff" />
</Target>
Which has been fine until now because we've only used it for .NET Framework stuff. But when I installed it on a .NET Core project, it failed with File Not Found errors, because nuget doesn't install to SolutionDir\packages\PackageDir, it installs to UserDir\.nuget\packages\PackageDir.

Is there a solution to this besides just making two nuget solutions, one for Framework and one for Core? Some way to detect framework and execute a command with the appropriate location string?

Also, since nobody gave me any better solutions I've been working on a separate nuget for Core, but as it turns out I have no idea how to target UserDir in that command language -- %USERPROFILE% doesn't work. Anyone know how to do that? I just want to put this stupid bug to bed, it's got to be a solved problem, there are plenty of NuGet packages targeting Core.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



NihilCredo posted:

What happens (before the paket conversion) if you just run git grep NLog.Config on your repo?

It finds all of the NLog.Config sections of our .config files and nothing else. That ran a lot faster than just grepping the directory, too, so thanks for suggesting that specifically.

It's probably because of some interaction with updating from legacy framework stuff and my laziness updating paket.dependencies. Disabling NLog.Config in our MyGet account and seeing what complains off-hours might get me the answer with less waiting :v:

EssOEss
Oct 23, 2006
128-bit approved

CapnAndy posted:

Also, since nobody gave me any better solutions I've been working on a separate nuget for Core, but as it turns out I have no idea how to target UserDir in that command language -- %USERPROFILE% doesn't work.

This is in the csproj file? I would expect $(UserProfile) to work if I remember my MSBuild right.

CapnAndy
Feb 27, 2004

Some teeth long for ripping, gleaming wet from black dog gums. So you keep your eyes closed at the end. You don't want to see such a mouth up close. before the bite, before its oblivion in the goring of your soft parts, the speckled lips will curl back in a whinny of excitement. You just know it.

EssOEss posted:

This is in the csproj file? I would expect $(UserProfile) to work if I remember my MSBuild right.
This is in the .targets file, which to my -- super, super limited and all self-taught from reading this existing thing -- knowledge, is basically a bunch of macros?

edit: but it looks like $(UserProfile) is working!

CapnAndy fucked around with this message at 23:52 on Apr 22, 2020

Mr Shiny Pants
Nov 12, 2012

Mr Shiny Pants posted:

I am working on some services that run on Docker, for authentication we use the Azure AD and I have our reverse proxy setup to authenticate all requests to our hosted services. My question is, and my Google skills are failing me, is there a way to have NGINX forward the Oauth reponse to our backend so that I have a UserPrincipal inside ASP.Net?

Is this even possible/smart? The idea of having the reverse proxy doing the authentication was appealing to us because it also terminates the SSL connections.

So I got this working today.

In ASP ( Giraffe ) I configured a JwtBearer challenge and after some fiddling with Nginx it sets the required headers and now I have Claims inside my application with authentication being done by the reverse-proxy.

Mr Shiny Pants fucked around with this message at 17:02 on Apr 26, 2020

Adbot
ADBOT LOVES YOU

GI_Clutch
Aug 22, 2000

by Fluffdaddy
Dinosaur Gum
Anyone familiar with using the MVP pattern with winforms? I'm converting an old app for the hell of it (WPF/MVVM, I know, but that's another story). So far, things have been going well. My UI and business logic are separated, and I'm able to write unit tests using Moq to mock the view. The first challenge I've come across is how to properly create an instance of another view (in this case, an about form).

The approach I've taken is giving IMainView a method that returns an IAboutView. MainForm implements this by returning a new instance of AboutForm. So, when the user triggers the event that the MainPresenter is listening for, the presenter asks its associated view to create an IAboutView, passes it to a presenter, and then tells it to display.

Is this approach valid? It doesn't feel too bad, as my presenters only reference interfaces, not any specific implementations. Relevant snippets below.

code:
public interface IMainView
{
    IAboutView GetAboutView();
}

public partial class MainForm : Form, IMainView
{
    public IAboutView GetAboutView()
    {
        return new AboutForm();
    }
}

public class MainPresenter
{
    public void DisplayAbout(object sender, EventArgs e)
    {
        var aboutView = _view.GetAboutView();
        var aboutPresenter = new AboutPresenter(aboutView);
        aboutPresenter.Display();
    }
}

GI_Clutch fucked around with this message at 21:04 on Apr 26, 2020

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