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
Nth Doctor
Sep 7, 2010

Darkrai used Dream Eater!
It's super effective!


redleader posted:

oh yeah, we do a similar thing - hence the class with 26+ parameters in its constructor

Okay but how do you name the parameters after 26?
FooService a, BarFactory b, BazManager c... Do you go excel style with ..., ButtsRepository aa?

E: What a terrible joke for a snipe.

I had a girlfriend who took a programming class back in the day, and she would write her assignment and then go through and rename all of the variables to a, b, c,... in order of use. Because that's more "computery".

Nth Doctor fucked around with this message at 14:55 on May 31, 2020

Adbot
ADBOT LOVES YOU

EssOEss
Oct 23, 2006
128-bit approved

Boz0r posted:

Someone has started making nuget packages of the shared projects to avoid shared dependencies in projects, and I don't really see the point

The most successful philosophy I have applied here is to tie everything versioning/deployment related to "pressing the deploy button".

Is your thing A and thing B part of a same thing, always deployed together, never making sense to have running part A of a different version than part B? Then make it part of the same solution, share your code, do whatever you need and keep it together and don't even try to separate anything or use nuget.

Or do your thing A and thing B have separate lifetimes, with one person pressing button "deploy thing A version 123" on Monday and another person pressing button "deploy thing B version qqq.beef999" on Thursday? Then separate them into different projects and only let them communicate via public APIs and (optionally) nuget packages that distribute parts of the API contracts (and/or API clients).

In the end, the ways you release and tie together different pieces of software must map to the human processes. If you try to make a technical workflow that differs from the human decision workflow then you're in for pain and suffering.

Boz0r
Sep 7, 2006
The Rocketship in action.
How do I include source in my Nuget packages, so I can at least debug through them?

raminasi
Jan 25, 2005

a last drink with no ice

Boz0r posted:

How do I include source in my Nuget packages, so I can at least debug through them?

There’s a thing called Source Link but I’ve never managed to get it working when publishing. (I’ve gotten it to work when consuming packages, so someone’s gotten it to work.)

Karia
Mar 27, 2013

Self-portrait, Snake on a Plane
Oil painting, c. 1482-1484
Leonardo DaVinci (1452-1591)

Nth Doctor posted:

Okay but how do you name the parameters after 26?
FooService a, BarFactory b, BazManager c... Do you go excel style with ..., ButtsRepository aa?

E: What a terrible joke for a snipe.

I had a girlfriend who took a programming class back in the day, and she would write her assignment and then go through and rename all of the variables to a, b, c,... in order of use. Because that's more "computery".

"If you keep the variable names as short as possible, the computer can read them faster."

GoodCleanFun
Jan 28, 2004

Boz0r posted:

How do I include source in my Nuget packages, so I can at least debug through them?

Include pdb file and don't optimize in the caller.

ljw1004
Jan 18, 2005

rum

GoodCleanFun posted:

[How to include source files in nuget?]
Include pdb file and don't optimize in the caller.

Several years ago I wrote something you add in your .csproj file which tweaks your PDB so its source-link points directly to github. That way, anyone who uses your nuget package will be able to debug-step INTO it!

I'm sure everything has changed completely since I wrote it. But there might still be some useful pointers. https://github.com/ljw1004/pdb2github

Karia
Mar 27, 2013

Self-portrait, Snake on a Plane
Oil painting, c. 1482-1484
Leonardo DaVinci (1452-1591)

I've got an interface with a default implementation on a couple of methods. Is there some way I can call those default implementations from a class that implements that interface (like how with an abstract class you'd call base.DoSomething())?

Mr Shiny Pants
Nov 12, 2012

Karia posted:

I've got an interface with a default implementation on a couple of methods. Is there some way I can call those default implementations from a class that implements that interface (like how with an abstract class you'd call base.DoSomething())?

Cast it to the interface?

NiceAaron
Oct 19, 2003

Devote your hearts to the cause~

If nothing else, you can just make it a regular-rear end static method, have the default implementation call the static method, and then your specific implementation can call the static method too.

Karia
Mar 27, 2013

Self-portrait, Snake on a Plane
Oil painting, c. 1482-1484
Leonardo DaVinci (1452-1591)

Mr Shiny Pants posted:

Cast it to the interface?

Sorry, I should have specified: I want to implement the interface so that Foo.DoSomething() calls base.DoSomething() and adds additional functionality. As soon as I override the functionality, casting to the interface doesn't call the default implementation anymore.

NiceAaron posted:

If nothing else, you can just make it a regular-rear end static method, have the default implementation call the static method, and then your specific implementation can call the static method too.

This was my workaround, yeah. Somehow doesn't feel very elegant. Which is stupid, it's fairly clean and works just fine, but it could be a couple characters shorter!

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Karia posted:

Sorry, I should have specified: I want to implement the interface so that Foo.DoSomething() calls base.DoSomething() and adds additional functionality. As soon as I override the functionality, casting to the interface doesn't call the default implementation anymore.


This was my workaround, yeah. Somehow doesn't feel very elegant. Which is stupid, it's fairly clean and works just fine, but it could be a couple characters shorter!

I'd say it's time to use an abstract class instead. You're looking for abstract class behavior, not interface-with-default-implementation behavior.

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

ljw1004 posted:

Several years ago I wrote something you add in your .csproj file which tweaks your PDB so its source-link points directly to github. That way, anyone who uses your nuget package will be able to debug-step INTO it!

I'm sure everything has changed completely since I wrote it. But there might still be some useful pointers. https://github.com/ljw1004/pdb2github

Whoa

Sab669
Sep 24, 2009

Do any of you have recommendations for an ad hoc report building library for an asp / mvc web application?

My team looked at a few different ones, decided to try https://dotnetreport.com/ but after some initial evaluation it hasn't impressed us. Namely that it doesn't seem to be smart enough to restrict you from putting fields from completely unrelated tables onto a report, causing it to crash at run time.

The two biggest things we're looking for:

* Does not require an outside service to run.
* Should be smart enough to prevent the behavior I described above^

It's my coworker doing the dicking around with these tools, so perhaps she didn't configure it correctly but during her demo it looked pretty mediocre. It lets us specify relationships between tables which is good, but yea when you select a field from a table it doesn't then filter out unrelated tables.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!
Can anybody think of some generic/abstraction wizardry that can reduce some boilerplate I'm dealing with? I have to do some junk like this with the meta going on with my interpreter project with declaring class types for it in C# and making them visible to the interpreter correctly. Here's a draft of the boilerplate with an idea of what I'd like to do, but with the problems with it shown. I understand the nature of those errors but I wonder if I can dodge them through some alternative means:

code:
    public abstract class BullshitClass<TInst> : PyClass where TInst: PyObject, new()
    {
        private static BullshitClass<TInst> __instance;
        public abstract string GetPythonTypeName();

        // This singleton is given to the interpreter to reference as the class type inside the interpreter
        public static BullshitClass<TInst> Instance
        {
            get
            {
                if (__instance == null)
                {
                    // Cannot create an instance of the abstract class or interface 'BullshitClass<TInst>'
                    __instance = new BullshitClass<TInst>(null);
                }
                return __instance;
            }
        }

        // Problem with using GetPythonTypeName()
        // An object reference is required for the non-static field, method, or property 'BullshitClass<TInst>.GetPythonTypeName()'
        public BullshitClass(CodeObject __init__) :
            base(GetPythonTypeName(), __init__, new PyClass[0])
        {
            __instance = this;

            Expression<Action<PyTypeObject>> expr = instance => DefaultNew<TInst>(null);
            var methodInfo = ((MethodCallExpression)expr.Body).Method;
            __new__ = new WrappedCodeObject("__new__", methodInfo, this);
        }
    }

Red Mike
Jul 11, 2011
The two things you're trying to do have different causes and different ways of resolving them (which may not go together):

1. Instance static member: it's effectively telling you that this class itself can't be the one creating the instance, unless it does it via some sort of factory/factory method.
It makes sense if you just look at this abstract, because the question is "how does this abstract know which of its non-abstract subclasses to create?". Generally the answer is going to be "it doesn't, your singleton pattern doesn't belong in this class but in one/all of the subclasses".

That depends on what you want to happen though, how do you expect to be calling this?
If you want to do BullshitClass<Whatever>.Instance.DoThing(), then what subclass of BullshitClass<Whatever> do you expect to get used?
If you want to do MySubclass<Whatever>.Instance.DoThing() where MySubclass inherits BullshitClass, then the same pattern you have with .Instance should be in MySubclass. There's no way to reduce the boilerplate there since Instance is a static field (so no inheriting).

Generally, I think this kind of thing is a signal that you don't really want a singleton, so maybe see if you actually want one (and consider that static fields and generics don't work the way you expect; you will have one __instance value for every value of <TInst> that gets used. So not a singleton, but a "singleton" per TInst type.)

2. Using a non-static method in a static context (base constructor): there's no general solution, but this specific situation is very common. You're trying to make it so the subclasses define their own "name", or "description", or "whatever piece of data", even though you know that bit of data should be static and stateless, but there's no way to inherit statics. Your best bet is to pass the data directly at compile time. Because the base constructor is there, a subclass is forced to implement it anyway (as you were just forced to implement it) so there's no chance of the developer forgetting.

code:
public abstract class MyBaseClass
{
  public MyBaseClass(string name) 
  {
     Console.WriteLine("Called from " + name);
  }
}

public class MySubClass : MyBaseClass
{
  public MySubClass() : base("a special class") { }
}
Overall: If the reason you're trying to write this class is to reduce boilerplate, I don't think it'll help in the way you're writing it now.
I can't be sure because I don't know what the rest of your code is like, but it sounds like what you're looking for is something like a container/wrapper for Python objects that just handles the boilerplate of creation/init?
If so:

1. Don't inherit from PyClass, instead store a private field of type PyClass and make the class non-generic (just use PyObject). That inheritance is what's enforcing your constructor passing a static type name in.
2. Don't use weird singletons because it doesn't sound like you want a singleton, you just want to not have duplicates. If that's the case then you want whatever's creating this object to be a factory that stores and reuses existing instances, mixing static and generics to try to do a factory like this won't work the way you're hoping.
Not having a singleton means the class boils down to a wrapper for PyClass that handles the creation of __new__/__init__ and type name, which is the 'boilerplate' you want to reduce duplication of.
Having a factory ahead of it that handles the creation of this wrapper means you're no longer handling anything static, so no more issues with static fields or abstracts.

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Red Mike posted:


1. Don't inherit from PyClass, instead store a private field of type PyClass and make the class non-generic (just use PyObject). That inheritance is what's enforcing your constructor passing a static type name in.
2. Don't use weird singletons because it doesn't sound like you want a singleton, you just want to not have duplicates. If that's the case then you want whatever's creating this object to be a factory that stores and reuses existing instances, mixing static and generics to try to do a factory like this won't work the way you're hoping.
Not having a singleton means the class boils down to a wrapper for PyClass that handles the creation of __new__/__init__ and type name, which is the 'boilerplate' you want to reduce duplication of.
Having a factory ahead of it that handles the creation of this wrapper means you're no longer handling anything static, so no more issues with static fields or abstracts.

Yes I generally just want to make sure I don't have duplicates. Some of that is to properly support the shenanigans people might do to redefine what some of the class methods are in the interpreter, and that has to trace back to a single class.

This is about the time that I should apologize for how confusing the scenario is. I'm show a C# class for how a Python class should behave and the combination is a real brain bender.

Regarding #2 and what's going in the class: I do have some other code I have to implement in every class; __new__ and __init__ are just the particular boilerplate code for those class types. All of the extra code are for the methods that go in the object. Why are they in the class then? Every object instance gets assigned the static class methods by default but they can be overridden thanks to Python's dynamic nature. So instance.foo_method can be reassigned, and even classinstance.foo_method can be reassigned. This is what I came up with to support that bullshit.

Edit: I'll be playing around in the IDE later tonight and this weekend so I can experiment then so that's what I can actually try something.

Red Mike
Jul 11, 2011
You're using 'static' as an analogue for 'single instance' which is incorrect. You're also using inheritance to reduce the duplication of that code when the correct tool is composition.

If I'm following correctly, what you're looking for is something like this:

code:
//this class is a true static that's only meant to serve as a single
//place to put lookup/conversion logic or something like that
//even then static isn't the best choice if it can be avoided
public static class PythonTypeMappings
{
    public static string GetName(Type type)
    {
        //use whatever makes sense to generate the type name here
        //a useful pattern would be some sort of visitor/handler setup
    }
}

//this class is responsible for making sure you only have one instance of whatever type you want
//it can be static if you want a static factory, but using generics will defeat the point there (among other issues)
public class ClassFactory
{
    //this doesn't store MyClass<TInst> because that's pointless, you have the base class you really care about
    private readonly Dictionary<Type, PyClass> _types = new Dictionary<Type, PyClass>();

    //this could also just return PyClass, but still take TInst as a generic argument
    //depends if whoever calls it needs to know that it's a MyClass<TInst> or not
    public TInst GetClass<TInst>() where TInst : PyObject
    {
        var type = typeof(TInst);
        if (_types.ContainsKey(type))
        {
            return (TInst)_types[type]; //may want to run checks here
        }

        //generally this kind of mapping should come from outside ClassFactory
        //a better option than the singleton would be some sort of PythonTypeMapper that 
        //you pass into ClassFactory as you create it, as a service
        var pythonTypeName = PythonTypeMappings.GetName(type);

        //no clue where __init__ is meant to come from here, but you can pass it into GetClass<TInst>()
        var classInstance = new MyClass<TInst>(pythonTypeName, __init__);
        _types[type] = classInstance;
        return classInstance;
    }

    //this class makes no assumptions about what PyObject it's really using
    //it just cares about being a factory of MyClass/PyClass objects
}

// this class doesn't need to care about if it's the only instance of its type or not, it assumes that's the case
public class MyClass<TInst> : PyClass where TInst : PyObject
{
    public MyClass(string pythonTypeName, CodeObject __init__) : base(pythonTypeName, __init__, new PyClass[0])
    {
        //copy pasted from your code, although this might be replace-able by something like Action/Func?
        Expression<Action<PyTypeObject>> expr = instance => DefaultNew<TInst>(null);
        var methodInfo = ((MethodCallExpression)expr.Body).Method;
        __new__ = new WrappedCodeObject("__new__", methodInfo, this);
        //whatever other class setup you want

    }

    //whatever extensions on PyClass go here, they know that it's specifically about TInst
}

//ALTERNATIVELY, as a single class
public class MyClassMapper
{
    private readonly Dictionary<Type, PyClass> _mapping = new Dictionary<Type, PyClass>();

    public PyClass GetClass<TClass>(CodeObject __init__) where TClass : PyObject
    {
        if (_mapping.ContainsKey(typeof(TClass)))
        {
            return _mapping[typeof(TClass)];
        }

        var pythonTypeName = PythonTypeMappings.GetName(type);

        var class = new PyClass(pythonTypeName, __init__, new PyClass[0]);
        //copy pasted from your code, although this might be replace-able by something like Action/Func?
        //unclear what the access level is of those fields, so you may need a subclass like MyClass anyway?
        Expression<Action<PyTypeObject>> expr = instance => class.DefaultNew<TInst>(null);
        var methodInfo = ((MethodCallExpression)expr.Body).Method;
        class.__new__ = new WrappedCodeObject("__new__", methodInfo, this);
        
        //whatever other init here

        _mapping[typeof(TClass)] = class;

        return class;
    }
}
This way you have a clean split of:
1. Mapping/parsing/whatever shared logic needs to exist statically (or effectively statically)
2. A class concerned with keeping one instance of a thing per type (or per whatever conditions you set)
3. A class concerned with either subclassing or wrapping a type.

#2 and 3 can be merged together somewhat cleanly, it just depends on access modifiers and what the goal is (do you actually need a subclass/wrapper?).

Basically, I really recommend taking a step back and starting over from what you're really trying to achieve because you're already down the rabbithole of fixing something that's only really needed because of a wrong choice back up the line.

Magnetic North
Dec 15, 2008

Beware the Forest's Mushrooms
I currently work as a C# developer, but I don't do any coding in my spare time. I hope to change that, but I don't really want to add Visual Studio and poo poo to my gaming/media PC in case I somehow gently caress it up or bloat the system with other garbo. I am not sure I'll stick with it so I don't want to buy a different machine or pay for a subscription if I can avoid it. During a work meeting introducing me to Docker, it got me thinking about how one of my classes offered us a Linux VM that we installed in Virtual Box so we didn't have to try and get Antlr and poo poo running on every machine on earth. At the same point, it's currently the future, and I know Azure can spin up VMs as needed.

Does anyone have any thoughts on or experience with Visual Studio in virtual environments? The tips I'm finding are from 2014(?) so I feel I am missing some grammar to make Google help me.

mystes
May 31, 2006

Magnetic North posted:

I currently work as a C# developer, but I don't do any coding in my spare time. I hope to change that, but I don't really want to add Visual Studio and poo poo to my gaming/media PC in case I somehow gently caress it up or bloat the system with other garbo. I am not sure I'll stick with it so I don't want to buy a different machine or pay for a subscription if I can avoid it. During a work meeting introducing me to Docker, it got me thinking about how one of my classes offered us a Linux VM that we installed in Virtual Box so we didn't have to try and get Antlr and poo poo running on every machine on earth. At the same point, it's currently the future, and I know Azure can spin up VMs as needed.

Does anyone have any thoughts on or experience with Visual Studio in virtual environments? The tips I'm finding are from 2014(?) so I feel I am missing some grammar to make Google help me.
You're not going to screw up your computer by installing Visual Studio or VS Code on it and I don't see the point of going through extra trouble to use an IDE in a virtual machine.

brap
Aug 23, 2004

Grimey Drawer
It’s fine to install VS on your machine but you can also hang out with the cool kids and just use VS Code + .NET Core.

EssOEss
Oct 23, 2006
128-bit approved

Magnetic North posted:

I don't do any coding in my spare time. I hope to change that

Without knowing your motivation in detail, please don't think that this is somehow the norm. Most coders do not code in their spare time - this is perfectly normal. Your employer should be paying you to learn everything you might need to learn to advance in your coding career. I say this because sometimes there are employers that abuse programmers by making learning be something that happens during personal time. That's rear end-backwards in every way.

Of course if you just enjoy coding even after hours, have fun and enjoy :)

And yeah, feel free to install VS and/or VS code on your home PC. It's typically fairly harmless, although do note that some technologies VS might install can require Hyper-V to operate. Enabling Hyper-V will often permanently disable other virtualization software, so if you run VMs, do some reading in advance to verify compatibility.

LongSack
Jan 17, 2003

EssOEss posted:

Enabling Hyper-V will often permanently disable other virtualization software, so if you run VMs, do some reading in advance to verify compatibility.

FWIW, the latest version of VMWare Workstation Pro (15.5.5) now works with Hyper-V enabled, though you need a newer build of Windows 10 (20H1 build 19041.264).

Magnetic North
Dec 15, 2008

Beware the Forest's Mushrooms

EssOEss posted:

Without knowing your motivation in detail, please don't think that this is somehow the norm. Most coders do not code in their spare time - this is perfectly normal. Your employer should be paying you to learn everything you might need to learn to advance in your coding career. I say this because sometimes there are employers that abuse programmers by making learning be something that happens during personal time. That's rear end-backwards in every way.

I appreciate hearing this. While that is the approach I try to take (aka gently caress You Pay Me), there is that lingering puritanical doubt creeping in that makes me wonder if I should be doing more.

brap posted:

It’s fine to install VS on your machine but you can also hang out with the cool kids and just use VS Code + .NET Core.

I do want to be one of the cool kids. In all honesty, I forgot .NET Core on Linux was an option. I'll probably try that and see if I can get on with VS Code.

redleader
Aug 18, 2005

Engage according to operational parameters
vs code is great if you don't want to use an actual good ide for .net

Malcolm XML
Aug 8, 2009

I always knew it would end like this.
rider is extremely cool, and good

brap
Aug 23, 2004

Grimey Drawer
VS Code is certainly worse for a lot of .NET workloads, however it lacks some of the baggage and architectural flaws of VS and that makes it more pleasant to use in some scenarios. Now that VS Codespaces are a thing, hopefully Microsoft will invest more in improving the quality of the .NET tooling in VS Code.

redleader
Aug 18, 2005

Engage according to operational parameters

Malcolm XML posted:

rider is extremely cool, and good

rider's decompile-and-go-to-definition blew my fuckin mind and i am legitimately jealous

Rocko Bonaparte
Mar 12, 2002

Every day is Friday!

Red Mike posted:

//copy pasted from your code, although this might be replace-able by something like Action/Func?
Expression<Action<PyTypeObject>> expr = instance => DefaultNew<TInst>(null);
var methodInfo = ((MethodCallExpression)expr.Body).Method;
__new__ = new WrappedCodeObject("__new__", methodInfo, this);
//whatever other class setup you want

I'm still looking over what I can do to change the entire approach in the larger post. For one, I am seeing how I am currently looking up these static instances since I've lost track of it.

But about this particular mess: I'm trying to remember what made me wind up doing this. I think I was trying to make a compile-time binding to DefaultNew instead of trying to get it dynamically using GetMethod(). There's a few places where I gave up and used GetMethod() because the signatures were async and I couldn't use an expression tree for them. It ultimately hasn't turned out to be so bad; it's a simple one-liner versus this code salad. It's just I get kicked in the dick if I type the method binding wrong and I'm very good at making that particular kind of typo.

Edit: I might as well append on to here about my recall on the whole static Instance thing. The main place where I'm using that Instance is every time I create an instance of the actual object type. That's the TInst generic argument in my example. Every instance of an Pythonlike object needs to have an association with its class. If you are a Python person, you can see that as the __class__ dunder in any instance of an object. That becomes useful for issubclass() and isinstance(). This is looking like premature optimization, but I'd prefer to avoid a dictionary lookup in every constructor if I can avoid it. On the flip side, the alternative is that boilerplate garbage that I'm liable to copy-paste then forget to properly alter for the new class.

Rocko Bonaparte fucked around with this message at 06:22 on Jun 14, 2020

brap
Aug 23, 2004

Grimey Drawer

redleader posted:

rider's decompile-and-go-to-definition blew my fuckin mind and i am legitimately jealous

VS also does this if you enable it IIRC.

Red Mike
Jul 11, 2011

Rocko Bonaparte posted:

I'm still looking over what I can do to change the entire approach in the larger post. For one, I am seeing how I am currently looking up these static instances since I've lost track of it.

But about this particular mess: I'm trying to remember what made me wind up doing this. I think I was trying to make a compile-time binding to DefaultNew instead of trying to get it dynamically using GetMethod(). There's a few places where I gave up and used GetMethod() because the signatures were async and I couldn't use an expression tree for them. It ultimately hasn't turned out to be so bad; it's a simple one-liner versus this code salad. It's just I get kicked in the dick if I type the method binding wrong and I'm very good at making that particular kind of typo.

Edit: I might as well append on to here about my recall on the whole static Instance thing. The main place where I'm using that Instance is every time I create an instance of the actual object type. That's the TInst generic argument in my example. Every instance of an Pythonlike object needs to have an association with its class. If you are a Python person, you can see that as the __class__ dunder in any instance of an object. That becomes useful for issubclass() and isinstance(). This is looking like premature optimization, but I'd prefer to avoid a dictionary lookup in every constructor if I can avoid it. On the flip side, the alternative is that boilerplate garbage that I'm liable to copy-paste then forget to properly alter for the new class.

I think you'll need to find an alternative yourself, since the problem is quite specific around the Python bits.

Regarding the dictionary lookup specifically: a dictionary lookup is effectively O(1) and constructors can't be async so you don't need locks or blocking, it's way premature optimisation. Worse, what you've come up with (GetMethod/reflection) is many orders of magnitude slower and way more difficult to predict the performance of (e.g. turn one class it ends up needing to look up into a generic class and suddenly your O(n) might become O(n log n), who knows).

Magnetic North
Dec 15, 2008

Beware the Forest's Mushrooms

brap posted:

Now that VS Codespaces are a thing, hopefully Microsoft will invest more in improving the quality of the .NET tooling in VS Code.

Now that you say that, I think it was watching a Build conference video that featured VS Codespaces that germinated this idea in my head. I should look into that too.

Munkeymon
Aug 14, 2003

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



brap posted:

VS also does this if you enable it IIRC.

I have no idea where that option lives, but I already have https://marketplace.visualstudio.com/items?itemName=SharpDevelopTeam.ILSpy installed which is kinda nice in that I can poke around in framework code without messing with the tab order in VS.

power crystals
Jun 6, 2007

Who wants a belly rub??

Unless VS added its own natively recently, that's a feature of ReSharper, not VS itself.

B-Nasty
May 25, 2005

power crystals posted:

Unless VS added its own natively recently, that's a feature of ReSharper, not VS itself.

No, it's been in there for a few years. The setting to search for in the options menu is 'Enable navigation to decompiled sources' under Text Editor-C#-Advanced. It pops up an annoying disclaimer every time, but works great (and uses ILSPY under the hood.)

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost

B-Nasty posted:

No, it's been in there for a few years. The setting to search for in the options menu is 'Enable navigation to decompiled sources' under Text Editor-C#-Advanced. It pops up an annoying disclaimer every time, but works great (and uses ILSPY under the hood.)

AFAIK you don't even need to enable it in VS, it should already be enabled by default. At least it is in VS2019.





It's also in Omnisharp/VSCode as a setting



power crystals
Jun 6, 2007

Who wants a belly rub??

B-Nasty posted:

No, it's been in there for a few years. The setting to search for in the options menu is 'Enable navigation to decompiled sources' under Text Editor-C#-Advanced. It pops up an annoying disclaimer every time, but works great (and uses ILSPY under the hood.)

Huh. The more you know. Thanks!

brap
Aug 23, 2004

Grimey Drawer
I think it might be the same underlying library providing the feature in reshaper, VS, and ILSpy.

fankey
Aug 31, 2001

Anyone have experience implementing OAuth 2.0 for a WPF ( not UWP ) desktop app. This states 3 options
  • Private URI
  • Claimed HTTPS URI
  • Loopback URI

This page from Google implies that the one to use for standard desktop apps is the loopback scheme. I'm a little concerned about this approach because I'm not sure how local firewalls/antivirus software will interact with this approach. Is there a better way to accomplish this? We do own the OAuth server so changes can theoretically done on that end as well, if it makes things easier.

Before reading the IETF Draft I was thinking about a different approach using another web server. The app would have a connection to that server and the redirect would pass the token to this server, making it available to the app. Given that this approach isn't listed I'm assuming it's a bad idea but it's not clear to me why.

Adbot
ADBOT LOVES YOU

mystes
May 31, 2006

fankey posted:

Anyone have experience implementing OAuth 2.0 for a WPF ( not UWP ) desktop app. This states 3 options
  • Private URI
  • Claimed HTTPS URI
  • Loopback URI

This page from Google implies that the one to use for standard desktop apps is the loopback scheme. I'm a little concerned about this approach because I'm not sure how local firewalls/antivirus software will interact with this approach. Is there a better way to accomplish this? We do own the OAuth server so changes can theoretically done on that end as well, if it makes things easier.

Before reading the IETF Draft I was thinking about a different approach using another web server. The app would have a connection to that server and the redirect would pass the token to this server, making it available to the app. Given that this approach isn't listed I'm assuming it's a bad idea but it's not clear to me why.
On Windows can't you just intercept the url from the events on the webview when it tries to redirect so you don't actually need it to listen for it in some manner? I haven't actually tried this though, so I could be wrong.

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