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
ljw1004
Jan 18, 2005

rum

Drastic Actions posted:

So I tried deploying some of my apps to the Xbox with the new Xbox UWP dev stuff, but I can't get SQLite to load

I read about SQLite now being included in Windows itself.
http://engineering.microsoft.com/2015/10/29/sqlite-in-windows-10/
I haven't yet had a go with it myself. But do I understand that SQLite.dll files are actually part of the OS? so you don't need to deploy them app-locally?

(I wonder if in your case it's picking up the wrong DLL?)

Adbot
ADBOT LOVES YOU

ljw1004
Jan 18, 2005

rum

Bognar posted:

They implemented primary constructors for C# 6 and it was included in multiple beta releases of Roslyn, but they ultimately didn't ship it.

We cut primary constructors from C#6 because there was a good bet they'd conflict with the "records" and "pattern-matching" feature we already knew we wanted...

The "language feature status doc" for C#7 is here
https://github.com/dotnet/roslyn/blob/master/docs/Language%20Feature%20Status.md
https://github.com/dotnet/roslyn/pull/undefined

"Binary literals, digit separators, local functions, ref returns" are marked as "finishing" and they're obviously the most likely. Of the rest, I'd personally wager money on Tuples making it into C#7; records+pattern-matching seem to be too close to call; and I doubt the rest. Take my personal opinion here (like any software engineering estimates) with a pinch of salt!

Gul Banana
Nov 28, 2003

there seems to be some disagreement about whether that list is a good overview: https://github.com/dotnet/roslyn/pull/10233

Gul Banana
Nov 28, 2003

although I feel a bit guilty about linking that because it's clearly a whither-the-sausage thing...

xgalaxy
Jan 27, 2004
i write code

Gul Banana posted:

although I feel a bit guilty about linking that because it's clearly a whither-the-sausage thing...

Hahah. Wow that guy just completely went against the wishes of everyone there and merged the commit anyway.

ninjeff
Jan 19, 2004

xgalaxy posted:

Hahah. Wow that guy just completely went against the wishes of everyone there and merged the commit anyway.

There was only one other person there!

Inverness
Feb 4, 2009

Fully configurable personal assistant.
I'm keeping an eye on how the new code generator extensions for the compiler are progressing.

My main worry is that they're going to be limited by only allowing you to add new translation units during compilation for partial classes using the new 'replace' and 'original' syntax. AddTranslationUnit() is the only method offered and there is no setter for the Compilation property.

I see no reason why it should prevent you from replacing the Compilation instance entirely so existing syntax trees, references, or resources can be edited.

ljw1004
Jan 18, 2005

rum

Inverness posted:

I see no reason why it should prevent you from replacing the Compilation instance entirely so existing syntax trees, references, or resources can be edited.

I implemented exactly what you describe a couple of years ago. The way I did it was just with msbuild trickery, so it offers up one set of files for a within-IDE build and a different set of files for a produce-the-EXE build. And it invoked a Roslyn-based tool for the latter.

The main reason it doesn't work nicely is this: how to get intellisense (and other edit-time smarts) for the code you're writing plus the code that's auto-generated?


If the generator has replaced the compilation instance entirely, there's no inherent connection between the stuff in your editor-buffer and what goes into the final compilation. That's why Matt Warren's idea of "supercedes" keyword was so genius - it restores the connection.

Inverness
Feb 4, 2009

Fully configurable personal assistant.

ljw1004 posted:

I implemented exactly what you describe a couple of years ago. The way I did it was just with msbuild trickery, so it offers up one set of files for a within-IDE build and a different set of files for a produce-the-EXE build. And it invoked a Roslyn-based tool for the latter.

The main reason it doesn't work nicely is this: how to get intellisense (and other edit-time smarts) for the code you're writing plus the code that's auto-generated?


If the generator has replaced the compilation instance entirely, there's no inherent connection between the stuff in your editor-buffer and what goes into the final compilation. That's why Matt Warren's idea of "supercedes" keyword was so genius - it restores the connection.
While that is true, there are cases where you don't care about getting intellisense about changes that will be made at compile time, such as binding code for AOP.

One of the cases cited on GitHub was adding resources or references to the Compilation instance. You can't do that as things are now.

I think it would be a shame to add such a great feature yet not go the extra distance by simply giving the option of replacing the Compilation if the change you want to make isn't satisfied by the current scenario.

Factor Mystic
Mar 20, 2006

Baby's First Post-Apocalyptic Fiction

Inverness posted:

I'm keeping an eye on how the new code generator extensions for the compiler are progressing.

My main worry is that they're going to be limited by only allowing you to add new translation units during compilation for partial classes using the new 'replace' and 'original' syntax. AddTranslationUnit() is the only method offered and there is no setter for the Compilation property.

I see no reason why it should prevent you from replacing the Compilation instance entirely so existing syntax trees, references, or resources can be edited.

I realllllly don't like replace & original but I can't verbalize why clearly. Probably because it'll end up being used for more than machine generated code & it's too large an indirection to instantly grok.

Gul Banana
Nov 28, 2003

seems like extending the feature would be backwards compatible, though, if it turns out to be a good idea

raminasi
Jan 25, 2005

a last drink with no ice
What's the best .NET web scraping library? HTML Agility Pack?

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

GrumpyDoctor posted:

What's the best .NET web scraping library? HTML Agility Pack?

Unless something's changed in the past couple of years, yeah that's the one.

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost
It's one of the better parsing libraries on any platform. It's what I use for parsing the forums for my apps.

Uziel
Jun 28, 2004

Ask me about losing 200lbs, and becoming the Viking God of W&W.
I'm writing a custom model binder for MVC (so that I can bind a bunch of ajax posted data to a list of objects). (essentially following this http://www.dotnetcurry.com/ShowArticle.aspx?ID=584 except that I can't just pull a match from a database, this is data that's all client side)

I'm like...99% there I think, but I'm drawing a blank here.

I have a string array, and an example of one of the items in the array is:

quote:

"MapId=2&Number=150&EncryptionId=3&TypeId=1&Tag=4F56&SourceId=10001&SourceName=TVCHANNEL&ProviderId=1&ProviderName=CITYNAME&EncryptionName=Full Encryption&Management=1&Device=CMC&P2p=IPADDRESS&Mcast=IPADDREESS&Udp=4705&InPn=807&OutPn=807&QamManagement=IPADDRESS&Ess=SSH54&Qam=1&GigE=3&PortNumber=29&Port=4E&OutTsid=29&Eia=51&Frequency=387000"

I need to convert that to a C# class that has those same properties. My initial hunch split on the & and then manually map it but is there an easier/faster way?

Uziel fucked around with this message at 17:01 on Apr 7, 2016

crashdome
Jun 28, 2011
You could be splitting on the '&' and then splitting on the '=' and hoping nothing blows up. I think it would be like letting a drag car go racing down the track without a driver and hoping it stays straight. Using a RegEx matching routine will give you safer results you can verify before passing it into an object. It would definitely not be faster though.

Uziel
Jun 28, 2004

Ask me about losing 200lbs, and becoming the Viking God of W&W.
I was able to do this:

code:
NameValueCollection valuePairs = HttpUtility.ParseQueryString(postData);
return GetFromQueryString<uChannel>(valuePairs);

  private static T GetFromQueryString<T>(NameValueCollection queryString) where T : new()
        {
            var obj = new T();
            var properties = typeof(T).GetProperties(); // to get all properties from Class(Object)  
            foreach (var property in properties)
            {
                var valueAsString = queryString[property.Name];
                object value = Parse(property.PropertyType, valueAsString); // parse data types  

                if (value == null)
                    continue;

                property.SetValue(obj, value, null); //set values to properties.  
            }
            return obj;
        }

        private static object Parse(Type dataType, string valueToConvert)
        {
            TypeConverter obj = TypeDescriptor.GetConverter(dataType);
            object value = obj.ConvertFromString(null, CultureInfo.InvariantCulture, valueToConvert);
            return value;
        }

Malcolm XML
Aug 8, 2009

I always knew it would end like this.

Uziel posted:

I'm writing a custom model binder for MVC (so that I can bind a bunch of ajax posted data to a list of objects). (essentially following this http://www.dotnetcurry.com/ShowArticle.aspx?ID=584 except that I can't just pull a match from a database, this is data that's all client side)

I'm like...99% there I think, but I'm drawing a blank here.

I have a string array, and an example of one of the items in the array is:


I need to convert that to a C# class that has those same properties. My initial hunch split on the & and then manually map it but is there an easier/faster way?

HttpUtility.ParseQueryString

Why are you dealing with a raw qs? Shouldn't that be already mapped to a method by something? (Asp.net does this via model binders )

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Uziel posted:

I need to convert that to a C# class that has those same properties. My initial hunch split on the & and then manually map it but is there an easier/faster way?

Do you have control over the POST operation? Can you just post JSON instead?

EDIT: Actually, what are you doing? If you generated the form from a list in MVC, it will post back to MVC in the form of a list. It looks something like entity[0].Id=1&entity[0].Name=foo&entity[1].Id=2&entity[1].Name=bar.

Bognar fucked around with this message at 21:16 on Apr 7, 2016

chippy
Aug 16, 2006

OK I DON'T GET IT
Yeah I've got to say that doesn't sound like something you would need to write a custom model binder for.

Binding a view to a list can be a pain because you need to use a for loop with an index to iterate over your mode rather than a foreach, but after that the binder should handle it properly as long as your controller action takes a list as a parameter.

Or, if you want to use a foreach you can do it with this: https://www.nuget.org/packages/BeginCollectionItem/ - this is also really useful if you don't know how long the list is going to be - I use it for places where I want to allow people to add an arbitrary number of list items. You can use AJAX to just return a partial with the editing view for a single item.

e: Like this: http://stackoverflow.com/questions/15375800/model-binding-to-a-list-mvc-4

chippy fucked around with this message at 09:10 on Apr 8, 2016

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal
Hey so with TFS (hosted if that matters) I'm starting to get into branching.

I currently have 3 branches:
Main
X Feature development branch
Release branch

Release branch was branched from X Feature development branch, and I gutted it to get it working with the .net native compilation for a store deployment (loving screwed us, our 3rd party libraries weren't even ready for .net native and we were in the middle of a deploy). If I add more changes to the feature development branch, with views that aren't in the release branch but are in X branch, will it push those view changes to the release branch?

Basically I want to work on some views for feature development branch, and push those views to the release branch, but release branch currently has them deleted. Any way to do this while preserving history and not copy and pasting files? Would it be best just to rebranch X to another release, and regut sans the view deletions afterwards?

e just realized that this should maybe go in the source control thread. Open to input in here if anyone has it though.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Knyteguy posted:

Hey so with TFS (hosted if that matters) I'm starting to get into branching.

I currently have 3 branches:
Main
X Feature development branch
Release branch

Release branch was branched from X Feature development branch, and I gutted it to get it working with the .net native compilation for a store deployment (loving screwed us, our 3rd party libraries weren't even ready for .net native and we were in the middle of a deploy). If I add more changes to the feature development branch, with views that aren't in the release branch but are in X branch, will it push those view changes to the release branch?

Basically I want to work on some views for feature development branch, and push those views to the release branch, but release branch currently has them deleted. Any way to do this while preserving history and not copy and pasting files? Would it be best just to rebranch X to another release, and regut sans the view deletions afterwards?

e just realized that this should maybe go in the source control thread. Open to input in here if anyone has it though.

If you're using TFVC, branches are hierarchal. You can reparent the branches or perform a baseless merge.

Uziel
Jun 28, 2004

Ask me about losing 200lbs, and becoming the Viking God of W&W.

chippy posted:

Yeah I've got to say that doesn't sound like something you would need to write a custom model binder for.

Binding a view to a list can be a pain because you need to use a for loop with an index to iterate over your mode rather than a foreach, but after that the binder should handle it properly as long as your controller action takes a list as a parameter.

Or, if you want to use a foreach you can do it with this: https://www.nuget.org/packages/BeginCollectionItem/ - this is also really useful if you don't know how long the list is going to be - I use it for places where I want to allow people to add an arbitrary number of list items. You can use AJAX to just return a partial with the editing view for a single item.

e: Like this: http://stackoverflow.com/questions/15375800/model-binding-to-a-list-mvc-4

I'll take a look at these thanks.

I'm working on something that allows users to edit multiple rows on the client (including find/replace, etc). Before they requested a "save all client changes to db" feature (as opposed to row by row that they initially wanted), I didn't need to worry about model binding to a list, so I'm aware of how to do that from scratch using the consecutive IDs. I'm overdue on this project and my management is loving awful at setting priorities other than "everything is the first priority, including these 3 new projects that are starting today", so it was faster to figure out custom model binding than redo my javascript. I'll know better for the next project. =)

epswing
Nov 4, 2003

Soiled Meat
https://twitter.com/azurestatus

quote:

Only confirmed followers have access to @azurestatus's Tweets and complete profile. Click the "Follow" button to send a follow request.

Why on earth would I need to be a "confirmed follower" to see Azure's status? I'd rather be pushed tweets than constantly F5ing https://azure.microsoft.com/en-us/status/

epswing
Nov 4, 2003

Soiled Meat
"The Email field is not a valid e-mail address."

Sometimes my users are intermittently seeing this error, with what look like perfectly valid email addresses. When I type their email addresses, I get no error. I've had some of them send me screenshots.




Here are a couple examples of the HTML behind the Email fields:

code:
<input class="form-control valid" data-val="true" 
data-val-email="The Email field is not a valid e-mail address." data-val-required="The Email field is required." 
id="Email" name="Email" type="text" value="" aria-required="true" aria-invalid="false" aria-describedby="Email-error">
code:
<input class="form-control" data-val="true" 
data-val-email="The Email field is not a valid e-mail address." data-val-required="The Email field is required." 
id="Client_Email" name="Client.Email" type="text" value="">
The model property is being decorated with [EmailAddress] which is part of the System.ComponentModel.DataAnnotations namespace.

What's going on here? I'm having a hard time googling for this because all the Q&A sites just provide information on how to validate email addresses. I'm using MVC 5.2.2

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

epalm posted:

"The Email field is not a valid e-mail address."

Sometimes my users are intermittently seeing this error, with what look like perfectly valid email addresses. When I type their email addresses, I get no error. I've had some of them send me screenshots.




Here are a couple examples of the HTML behind the Email fields:

code:
<input class="form-control valid" data-val="true" 
data-val-email="The Email field is not a valid e-mail address." data-val-required="The Email field is required." 
id="Email" name="Email" type="text" value="" aria-required="true" aria-invalid="false" aria-describedby="Email-error">
code:
<input class="form-control" data-val="true" 
data-val-email="The Email field is not a valid e-mail address." data-val-required="The Email field is required." 
id="Client_Email" name="Client.Email" type="text" value="">
The model property is being decorated with [EmailAddress] which is part of the System.ComponentModel.DataAnnotations namespace.

What's going on here? I'm having a hard time googling for this because all the Q&A sites just provide information on how to validate email addresses. I'm using MVC 5.2.2

Is it triggering on a leading/trailing space or something silly like that? Or a tab?

epswing
Nov 4, 2003

Soiled Meat

Ithaqua posted:

Is it triggering on a leading/trailing space or something silly like that? Or a tab?

Goddammit.


vvv leading space >_<

epswing fucked around with this message at 03:23 on Apr 11, 2016

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

epalm posted:

Goddammit.

Which was it? :)

epswing
Nov 4, 2003

Soiled Meat
Hey WPF wizards! When I get a program crash, and the stacktrace contains only microsoft code, how would I go about finding the cause?

It looks like a DatePicker was left-mouse clicked, and was trying to toggle a pop-up (I'm guessing the calendar widget)? There are lots of DatePickers in this application. I don't even know which one caused the crash.

http://pastebin.com/raw/5STZHYLZ

epswing fucked around with this message at 22:15 on Apr 11, 2016

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

epalm posted:

Hey WPF wizards! When I get a program crash, and the stacktrace contains only microsoft code, how would I go about finding the cause?

It looks like a DatePicker was left-mouse clicked, and was trying to toggle a pop-up (I'm guessing the calendar widget)? There are lots of DatePickers in this application. I don't even know which one caused the crash.

http://pastebin.com/raw/5STZHYLZ

Elsewhere on the internet, someone said they updated to .NET 4.5 and got a better stack-trace when they encountered this bug. If you can trigger the bug, I'd suggest going that route (if you're not already on 4.5).

I suspect the real error is being hidden by the dispatcher executing a delegate. That delegate is probably some code attached in an event handler attached to a DatePicker somewhere. I'd look for any events on DatePickers that happen to modify anything in the view hierarchy.

Pixelboy
Sep 13, 2005

Now, I know what you're thinking...

epalm posted:

Hey WPF wizards! When I get a program crash, and the stacktrace contains only microsoft code, how would I go about finding the cause?

It looks like a DatePicker was left-mouse clicked, and was trying to toggle a pop-up (I'm guessing the calendar widget)? There are lots of DatePickers in this application. I don't even know which one caused the crash.

http://pastebin.com/raw/5STZHYLZ

You could use Windbg to figure this out, if you spend the time to learn WIndbg.

Do you at least have the Microsoft symbols getting loaded?

Knyteguy
Jul 6, 2005

YES to love
NO to shirts


Toilet Rascal

Ithaqua posted:

If you're using TFVC, branches are hierarchal. You can reparent the branches or perform a baseless merge.

Thanks. My source control knowledge is a little limited beyond checkouts/checkins/rollbacks. I'm just getting into branching.


XML deserialization question: Given the following serialized xml, does anyone know why I'm getting the error below?
XML code:
<?xml version="1.0"?>
<LinesReqResp User="user">
    <ResponseCode Msg="Request Successful">1</ResponseCode>
    <Item ItemId="item" ItemDesc="desc" SalesUnit="CS" Warehouse="LB" LastQty="0" AvgMoQty="0.00" YtdQty="0" QtyOnHand="226" SalesPrice="54.13" LastPrice="54.13" 
CostType="Sales cost" Cost="54.13" ThumbnailUrl="imageurl" PriceMethod="Variable contract" ItemStatus="Stocked" MinQty="1" MultQty="1" ItemGroup="stuff" ItemClass="some 
stuff" DateLastSale="" />
    <Item ItemId="item2" ItemDesc="itemdesc2" SalesUnit="CS" Warehouse="LB" LastQty="0" AvgMoQty="0.00" YtdQty="0" QtyOnHand="0" SalesPrice="58.92" LastPrice="58.92" 
CostType="Sales cost" Cost="58.92" ThumbnailUrl="imageurl" PriceMethod="Variable contract" ItemStatus="Discontinue" MinQty="1" MultQty="1" ItemGroup="some stuff" 
ItemClass="stuff" DateLastSale="2012/8/17" />
</LinesReqResp>
Error in line 1 position 29. Expecting element 'LinesReqResp' from namespace 'http://schemas.datacontract.org/2004/07/companyname.Models'.. Encountered 'Element' with name 'LinesReqResp', namespace ''.

Serializer:
C# code:
    public static class Serializer
    {
        public static byte[] Serialize<T>(T obj)
        {
            MemoryStream stream = new MemoryStream();
            DataContractSerializer dcs = new DataContractSerializer(typeof(T));
            dcs.WriteObject(stream, obj);
            return stream.ToArray();
        }

        public static T Deserialize<T>(byte[] buffer)
        {
            MemoryStream stream = new MemoryStream(buffer);
            DataContractSerializer dcs = new DataContractSerializer(typeof(T));
            return (T)dcs.ReadObject(stream);
        }
    }
Model setup:
C# code:
    [DataContract]
    public partial class LinesReqResp
    {
        [DataMember]
        public ReqResponseCode ResponseCode { get; set; }

        [DataMember(Name = "Item")]
        public OrderLine[] Items { get; set; }

        [DataMember]
        public string User { get; set; }
    }
Call:
C# code:
    var serverXml = doc.GetXml();
    var deserializedXml = Serializer.Deserialize<LinesReqResp>(Encoding.UTF8.GetBytes(serverXml));
Is that enough detail? We were using XmlSerializer before, but that's deprecated when you use .net native compilation with UWP apps. I don't care about perfect code in this instance, I just need this to work. We're way beyond deadline. Thanks if anyone knows what's going on.

Knyteguy fucked around with this message at 17:14 on Apr 12, 2016

Inverness
Feb 4, 2009

Fully configurable personal assistant.

Knyteguy posted:

...

Is that enough detail? We were using XmlSerializer before, but that's deprecated when you use .net native compilation with UWP apps. I don't care about perfect code in this instance, I just need this to work. We're way beyond deadline. Thanks if anyone knows what's going on.
You're not specifying the XML namespace that your elements seem to be defined in.

Based on the error message, the root element should look like:
XML code:
<LinesReqResp User="user" xmlns="http://schemas.datacontract.org/2004/07/companyname.Models">
    ...
</LinesReqResp>

EssOEss
Oct 23, 2006
128-bit approved
Alternatively, if the XML is actually correct, just tell the serializer not to expect a namespace there. This should do it:

code:
[DataContract(Namespace = "")]

Mister Duck
Oct 10, 2006
Fuck the goose

epalm posted:

Hey WPF wizards! When I get a program crash, and the stacktrace contains only microsoft code, how would I go about finding the cause?

It looks like a DatePicker was left-mouse clicked, and was trying to toggle a pop-up (I'm guessing the calendar widget)? There are lots of DatePickers in this application. I don't even know which one caused the crash.

http://pastebin.com/raw/5STZHYLZ

Are any of these DatePickers inside a virtualizing control?

EDIT: To clarify there is a current WPF bug where a DatePicker inside of a virtualizing control will cause this issue due to trying to recycle the DatePicker during virtualization and attempting to set a new Parent for the Calendar in the DatePicker when it already has a parent from the last use of it.

If this is the case for your app, try one of the following:

1) Disable recycling: VirtualizingStackPanel.VirtualizationMode="Standard" in the virtualizing control's XAML
2) Explicitly set the style on the DatePicker that is encapsulated by the virtualizing control.

1) Stops the re-use by the container but obviously incurs a perf hit. 2) Allows WPF to re-use the control template and also avoids the situation where WPF recycles that bit of the DatePicker.

No guarantee this is the same issue that you are seeing, but it's very similar to a bug I have seen come through and that was the resolution (no fix in WPF as of right now).

Mister Duck fucked around with this message at 20:42 on Apr 12, 2016

beuges
Jul 4, 2005
fluffy bunny butterfly broomstick
I have a system that needs to be able to load multiple versions of the same assembly at the same time. It's working perfectly well by creating a separate appdomain for each version of the assembly, but it's extremely slow. I've improved things a bit by using LoaderOptimization.MultiDomain in the AppDomainSetup, and running NGen on everything, which seems to have cut the overhead by about half, but it looks like most of the processing time is still spent in appdomain overhead.
Is there another way to host multiple versions of the same assembly in the same process other than using appdomains? Or are there any other ways to speed up appdomain creation and cross app domain calls?

raminasi
Jan 25, 2005

a last drink with no ice

beuges posted:

I have a system that needs to be able to load multiple versions of the same assembly at the same time. It's working perfectly well by creating a separate appdomain for each version of the assembly, but it's extremely slow. I've improved things a bit by using LoaderOptimization.MultiDomain in the AppDomainSetup, and running NGen on everything, which seems to have cut the overhead by about half, but it looks like most of the processing time is still spent in appdomain overhead.
Is there another way to host multiple versions of the same assembly in the same process other than using appdomains? Or are there any other ways to speed up appdomain creation and cross app domain calls?

I have this exact same issue, and I haven't gotten around to even trying to AppDomain approach, so I'm curious if you find anything.

Mister Duck
Oct 10, 2006
Fuck the goose

GrumpyDoctor posted:

I have this exact same issue, and I haven't gotten around to even trying to AppDomain approach, so I'm curious if you find anything.

Assembly.LoadFile will load separately based on paths into a single AppDomain. That can do very bad things, but it's the only way I know of loading the same assembly into a single domain.

Of course if you are talking win32 or straight COM loading, you can do SxS assembly stuff but I don't think the same works for pure managed assemblies (though you can make a C# assembly COM visible but I never tried SxS with them).

Check out this MSDN page.

dougdrums
Feb 25, 2005
CLIENT REQUESTED ELECTRONIC FUNDING RECEIPT (FUNDS NOW)
I'm not sure what the consequences of this would be, but is it possible to load the program into a byte array and 'manually' set the version in the clr header, then load it with Assembly.Load()? I've done this a few times but only out of some other curiosity and not with the version.

edit: Actually, Assembly.Load(byte[]) will load assemblies of the same version. Maybe you can use some careful reflection? (i.e. MethodInfo.Invoke() or Assembly.CreateInstance()) I'm not sure specifically what you need to do with them though.

dougdrums fucked around with this message at 22:27 on Apr 14, 2016

Adbot
ADBOT LOVES YOU

beuges
Jul 4, 2005
fluffy bunny butterfly broomstick
I'll take a look at Assembly.LoadFile but I'm not certain that will help in this case because it looks like it only loads that particular assembly, and not all the references as well, and some of the references will likely have the same names as others already loaded, but differ internally.
What I'm writing is a transaction processing engine, where each transaction's logic sits in a separate plugin assembly, or more likely, set of assemblies. The complication is that the engine must support multiple versions of the same transaction being made available to different clients. So, I have an assembly called QueryFoo which in turn references a bunch of other assemblies. I'm storing each version of each plugin package (i.e. the QueryFoo.dll + all referenced assemblies) in its own version-numbered folder, then loading the appropriate assembly into its own app domain, so that I can have different versions loaded at the same time.
What I may end up doing is moving all the app domains into a separate service, and figuring out a way to pass requests directly into a specific appdomain in that service to avoid the cost of creating the app domain and marshalling data into/out of it in the transaction processor itself.

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