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
Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

crashdome posted:

I don't mean to be a jerk but, you didn't read my post fully or you actually didn't try it. What I proposed needed to be done, cannot be done.

My apologies, I focused in too hard on the "base window" part of things. GrumpyDoctor posted what I would have recommended (subscribing in the constructor), though since you mentioned you have a base ViewModel I would probably change it to something like:

C# code:
this.OnClosing += (_, __) =>
{
    var base = this.DataContext as BaseViewModel;
    if (base != null)
        base.CloseCommand.Execute(null);
}
In general, though, for cleaning up repetitive XAML I think the most common solution is to use a ControlTemplate or UserControl. This works great when the XAML you're replacing is a collection of UI elements, but obviously not so well when binding to events on the Window.

Adbot
ADBOT LOVES YOU

Adhemar
Jan 21, 2004

Kellner, da ist ein scheussliches Biest in meiner Suppe.
Yeah I also assumed the event subscription in constructor was an implicit impetus for wanting the base class, and it was more of a syntactical question of how to do the inheritance. :shrug:

I do suggest using a proper method rather than a lambda to handle the event, so you can also unsubscribe.

Adhemar fucked around with this message at 05:50 on Mar 19, 2015

crashdome
Jun 28, 2011
No problem. And that's a good point. I'll do proper checking of type, make sure proper method is called, and handle the events appropriately. Thanks everyone for the help.

Ultimately, I have a ViewModelBase and a derived class called EditorViewModelBase which further adds some normally boilerplate to handle fully cleaning up the ViewModel instance (Unregistering it from Service Locator) for garbage collection and also notify the application that certain lists have been edited and need to be refreshed on anything currently visible (like a selection dropdown/combobox). Best place to handle it was Closing event. When I had 4 editors it was nothing to maintain... I'm looking at close to a dozen now and climbing. It's tedious XAML work. All of them have the same buttons usually (New,Delete,Edit,Save,Cancel) which was easy through ControlTemplates as someone suggested but the Closing event.... ugh.

e: Oh, and my Main application window and my generic dialog ViewModels also use the Closing event. So basically anything NOT a User Control :)

crashdome fucked around with this message at 07:04 on Mar 19, 2015

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost
Xamarin announced a bunch of things at dotnetConf, including a preview verison of Xamarin.Forms for WinRT, and updates for Android Wear/Apple Watchkit/Microsoft Band.

Also if you're in an OSS project, you can now apply to get a free Xamarin license to port your stuff over. It's about time, seeing that there would be little incentive for most people to buy a license to port their free OSS project over. Note that I have no idea of what will actually get accepted. All I know is that it needs to be "established", meaning you can't just throw something up on Github and apply. Also note that I did not come up with that web form. I don't know who made it, but man is it ugly :v:.

Drastic Actions fucked around with this message at 18:30 on Mar 19, 2015

Mr Shiny Pants
Nov 12, 2012
That looks cool. Has anyone used the VS plugin for Xamarin? I am actually pretty interested in it, but you need an subscription. I just wanted to test it out and create an Windows Store app.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy
I think they have a 30 day trial. I use the VS plugin for iOS development and it generally works pretty well. It used to be a lot buggier 6-12 months ago, but I find it's pretty stable now.

Drastic Actions
Apr 7, 2009

FUCK YOU!
GET PUMPED!
Nap Ghost

Mr Shiny Pants posted:

That looks cool. Has anyone used the VS plugin for Xamarin? I am actually pretty interested in it, but you need an subscription. I just wanted to test it out and create an Windows Store app.

For iOS it can be a pain, but gets better with each new release. At the very least, it's more reliable for me so I don't have to keep reconnecting the build tool. Also having Resharper in VS helps tons too (and it's also compatible with Xamarin, including Forms XAML support). Android support has always been fine for me.

You can try it out for 30 days, but the VS plugin only works on Business accounts and up. And that's a lot of money. For the indie license you can usually haggle the sales team and get a discount, but you only get to use Xamarin Studio. Which is not bad (especially after you turn on all the code complete/folding options) but... yeah, despite what my coworkers say, it's no Visual Studio.

Mr Shiny Pants
Nov 12, 2012

Drastic Actions posted:

For iOS it can be a pain, but gets better with each new release. At the very least, it's more reliable for me so I don't have to keep reconnecting the build tool. Also having Resharper in VS helps tons too (and it's also compatible with Xamarin, including Forms XAML support). Android support has always been fine for me.

You can try it out for 30 days, but the VS plugin only works on Business accounts and up. And that's a lot of money. For the indie license you can usually haggle the sales team and get a discount, but you only get to use Xamarin Studio. Which is not bad (especially after you turn on all the code complete/folding options) but... yeah, despite what my coworkers say, it's no Visual Studio.

Ok, so a quick POC for Android using VS is out of the question for personal use. That's a shame.

I'll see about Xamarin studio, I have it installed but like you said, it is no VS.

mastersord
Feb 15, 2001

Gold Card Putty Fan Club
Member Since 2017!
Soiled Meat

crashdome posted:

Oh man, I remembered this from way back and I had to google a little but, I think I found the solution. I simply remembered that it was configurable options of the OpenFileDialog control and this person seems to have documented them:
http://www.codeproject.com/Articles/44914/Select-file-or-folder-from-the-same-dialog

Apologies if it doesn't work the way you intended.

This actually helped me with one of my projects where the user has to select a directory to scan and we wanted the ability to type a path instead of always navigating to the folder. Thanx!

Mr Shiny Pants
Nov 12, 2012
I have a problem getting the Standard Styles in my WinRT app.

I like the way the buttons from MS look and would like to use the defaults styles. These seem to defined in generic.xaml and my template reference them.

If I want to use them myself the xaml editor can't find the static resource.

Anybody know what is going on?

TheEffect
Aug 12, 2013
Can I use File.Copy to copy directories, or should I be looking at something else? I noticed it says the destination source can't be a directory, but I can work past that,

Maybe a better way to ask this is- my application lets users select either files or directories and the plan is to then copy said selected files/directories to user-specified locations. Is File.Copy what I should be using?

TheEffect fucked around with this message at 23:58 on Mar 19, 2015

Essential
Aug 14, 2003

TheEffect posted:

Can I use File.Copy to copy directories, or should I be looking at something else? I noticed it says the destination source can't be a directory, but I can work past that,

Maybe a better way to ask this is- my application lets users select either files or directories and the plan is to then copy said selected files/directories to user-specified locations. Is File.Copy what I should be using?

You can use the Directory class to enumerate the files in a directory (and create the desination directory) and then yes, File.Copy them to the destination. There is also a FileSystem class that has a CopyDirectory method: https://msdn.microsoft.com/en-us/library/ms127957%28v=vs.110%29.aspx Never used it myself but may be a more direct route.

The FileSystem method might include all subfolders and files, so you'll want to check that.

TheEffect
Aug 12, 2013
The FileSystem method is exactly what I needed. Thank you sir!

Mr Shiny Pants
Nov 12, 2012
So is MVVM kinda crap or what?
I am a little frustrated. :)

So my data has a couple of collections that represent a hierarchical data scheme. So in the beginning I just had a view model and no model because it is just a small app. Now for serializing my data I use json.net and want to serialize my viewmodel to disk. For persistence but also for suspend/resume of a tablet.
The problem is all the extra attributes on the viewmodel that don't need to be in the json file.

So first round:

I've annotated my classes with [datacontract ] and [datamember] this gets me much better control of my json serializing. The problem is that my data has a class hierachy in an ObservableCollection. Normal deserializing breaks. Everything is the baseclass.

Second round:

Create a json setting that includes type information. This works except for ObservableCollections. I get an assembly load error. So now I am thinking of copying the data to a class specifically for serializing/deserializing. Creating a list and load the Observables in there etc. etc.

Now this is beginning to look like a model......
So now I am thinking of building a model but reading some more about it, wow. How to keep lists -> ObservableCollections in sync? I can build Proxy classes, implement InotifyProperty changed, wrap my models and bind the attributes directly etc. etc.
MVVM is 2006 -2007 right? Why is this so hard in 2014?

Mr Shiny Pants fucked around with this message at 20:26 on Mar 20, 2015

epswing
Nov 4, 2003

Soiled Meat
Hark! An error in the logs!

quote:

EntityException: An exception has been raised that is likely due to a transient failure. If you are connecting to a SQL Azure database consider using SqlAzureExecutionStrategy.

EntityCommandExecutionException: An error occurred while executing the command definition. See the inner exception for details.

SqlException: A transport-level error has occurred when receiving results from the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)

Win32Exception: An existing connection was forcibly closed by the remote host

Apparently once in a while Azure Websites inexplicably drop connections to Azure SQL Servers. This happens often enough that they've written a BandaidThisHugeProblem class (cleverly named SqlAzureExecutionStrategy) to retry the connection if it drops.

Here's how to use it:

http://entityframework.codeplex.com/wikipage?title=Connection%20Resiliency%20Spec

Simple, enough, just add this to the same assembly as your DbContext:
C# code:
public class MyConfiguration : DbConfiguration
{
    public MyConfiguration()
    {
        SetExecutionStrategy("System.Data.SqlClient", () => new SqlAzureExecutionStrategy());
    }

}
Oh wait a minute, if you were thinking of writing a robust application by making use of transactions, guess what! SqlAzureExecutionStrategy doesn't allow you to create transactions (because between dropping and retrying a connection, who knows what's happened!)

But wait, here's a workaround https://msdn.microsoft.com/en-US/data/dn307226

C# code:
public static bool SuspendExecutionStrategy 
{ 
    get { return (bool?)CallContext.LogicalGetData("SuspendExecutionStrategy") ?? false; } 
    set { CallContext.LogicalSetData("SuspendExecutionStrategy", value); } 
} 
So now I get to wrap my transactions like so
C# code:
MyConfiguration.SuspendExecutionStrategy = true;
// transactional code goes here
MyConfiguration.SuspendExecutionStrategy = false;
When will the madness end?
OR
Why is it this hard to write a reasonably robust application?
OR
Why don't they just figure out what's wrong with the connections between Azure Websites and Azure SQL Servers?
</rant>

epswing fucked around with this message at 20:35 on Mar 20, 2015

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Mr Shiny Pants posted:

So is MVVM kinda crap or what?
I am a little frustrated. :)

I think you're conflating the ideas of your ViewModel and your Model. The data you want to serialize is your Model, not your ViewModel. The ViewModel exists solely as a representation of the Model for use in your UI.

Your Model should contain all of your relevant logic, and it should be decoupled enough from the View and ViewModel that you could reference it in a console app and interact with it there.

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

epalm posted:

Hark! An error in the logs!


Apparently once in a while Azure Websites inexplicably drop connections to Azure SQL Servers. This happens often enough that they've written a BandaidThisHugeProblem class (cleverly named SqlAzureExecutionStrategy) to retry the connection if it drops.

...

Why don't they just figure out what's wrong with the connections between Azure Websites and Azure SQL Servers?

We've run into this exact issue a number of times. The problem isn't really inexplicable, just hard to solve. Azure SQL instances aren't tied to a specific VM and they can and will be re-shuffled around as necessary for load balancing. This interrupts your database connection.

We saw that we were doing a bunch of stuff to get Azure happy with transactions, so we ended up making our own wrapper around Transaction that implements IDisposable. That would probably also work for you, and you could set SuspendExecutionStrategy = true in the constructor and false in the Dispose implementation.

Mr Shiny Pants
Nov 12, 2012

Bognar posted:

I think you're conflating the ideas of your ViewModel and your Model. The data you want to serialize is your Model, not your ViewModel. The ViewModel exists solely as a representation of the Model for use in your UI.

The model is the one want to serialize, but it's a small app so a viewmodel was good enough at first. Now I am looking for a class to serialize so I drop all the viewmodel properties I don't need.

Your Model should contain all of your relevant logic, and it should be decoupled enough from the View and ViewModel that you could reference it in a console app and interact with it there.

I think I understand it ok enough, so how do I keep my viewmodel and model in sync if something changes due to the gui?

Let's say my model and view are:
code:
class person
{
	string name;
	List emailaddresses;
}

class personView
{
	string name;
	ObservableCollection emailaddresses;
}

Now my GUI fires a command to update the person's email address? Which list do I update and how do I keep them synced?

Even for a single attribute:
Do I wrap them?
code:

class person
{
	string name;
	List emailaddresses;
}

class personView
{
	originalModel Person;
	string name get return Person.Name; set Person.Name  = value;
									   INotifyPropertyChanged();
	ObservableCollection emailaddresses;
}

I can see this working for attributes but not for collections.
It's an honest question. InotifyPropertyChanged on all my Model attributes?

Mr Shiny Pants fucked around with this message at 20:36 on Mar 20, 2015

epswing
Nov 4, 2003

Soiled Meat

Bognar posted:

We've run into this exact issue a number of times. The problem isn't really inexplicable, just hard to solve. Azure SQL instances aren't tied to a specific VM and they can and will be re-shuffled around as necessary for load balancing. This interrupts your database connection.

It was inexplicable to me, until now. If that's really the case, good lord almighty, noon on Saturday is not a great time for a service interruption, which we're generally told about weeks in advance.

epswing
Nov 4, 2003

Soiled Meat

Mr Shiny Pants posted:

Now my GUI fires a command to update the person's email address? Which list do I update and how do I keep them synced?

Sync as necessary. Sometimes you need to get data into the Model right away, other times it's fine for the change to sit in the ViewModel until the user clicks Save or equivalent.

New Yorp New Yorp
Jul 18, 2003

Only in Kenya.
Pillbug

Mr Shiny Pants posted:

It's an honest question. InotifyPropertyChanged on all my Model attributes?

It depends. You only really need INPC to be implemented if the viewmodel is going to be manipulating the model during the lifetime of the view. If the model is only being changed via view interactions, you can do a one-way databinding.

Easy answer: Just make a base class that implements INPC and derive models from it.

Mr Shiny Pants
Nov 12, 2012

Ithaqua posted:

It depends. You only really need INPC to be implemented if the viewmodel is going to be manipulating the model during the lifetime of the view. If the model is only being changed via view interactions, you can do a one-way databinding.

Easy answer: Just make a base class that implements INPC and derive models from it.


epalm posted:

Sync as necessary. Sometimes you need to get data into the Model right away, other times it's fine for the change to sit in the ViewModel until the user clicks Save or equivalent.

I can see why they invented Automapper. :)

Bognar
Aug 4, 2011

I am the queen of France
Hot Rope Guy

Mr Shiny Pants posted:

Now my GUI fires a command to update the person's email address? Which list do I update and how do I keep them synced?

Usually I just do a full Refresh on my ViewModel when I expect data will change. If that causes performance problems I change it, but it so rarely does. If there's global data that changes (e.g. multiple views need to update) then I'll create a custom event that all interested ViewModels can subscribe to.

In your example, the command to update the email address would update it on the Model alone, then trigger the ViewModel to be refreshed. The ViewModel would inspect the Model, and update its properties based off the Model. Every ViewModel should know how to build itself from the Model it represents.

This is just the way that I do it, but it makes things really easy to reason about. Some UI interaction changes the Model, the ViewModel is rebuilt based off the Model, the Views update from the ViewModel's PropertyChanged events firing.

GoodCleanFun
Jan 28, 2004

Mr Shiny Pants posted:

I think I understand it ok enough, so how do I keep my viewmodel and model in sync if something changes due to the gui?

Let's say my model and view are:
code:
class person
{
	string name;
	List emailaddresses;
}

class personView
{
	string name;
	ObservableCollection emailaddresses;
}

Now my GUI fires a command to update the person's email address? Which list do I update and how do I keep them synced?
Your properties can have getters returning your models properties. You then update your models emails addresses when you get that command.

Mr Shiny Pants posted:

I can see this working for attributes but not for collections.
It's an honest question. InotifyPropertyChanged on all my Model attributes?
I'd recommend implemented INotifyPropertyChanged on your viewModel only and as mentioned in a baseViewModel class that you always inherit from. Use IDataErrorInfo to do your validation and that can also update your model. Then do separate validation on your model using the same interface. UI validation in viewModel and business validation in model.

Mr Shiny Pants
Nov 12, 2012

GoodCleanFun posted:

Your properties can have getters returning your models properties. You then update your models emails addresses when you get that command.

So I wrap my model properties within my viewmodel properties right?

So if I need to instantiate a new listitem in my model and also my viewmodel I would instantiate a new model item class, wrap it in the viewmodel item class and then add the model item class to it's list and the wrapped class in the viewmodel collection to keep them in sync.

Thanks for the help.

GoodCleanFun
Jan 28, 2004

Mr Shiny Pants posted:

So I wrap my model properties within my viewmodel properties right?

So if I need to instantiate a new listitem in my model and also my viewmodel I would instantiate a new model item class, wrap it in the viewmodel item class and then add the model item class to it's list and the wrapped class in the viewmodel collection to keep them in sync.

Thanks for the help.

Yes exactly.

Sort of sounds like you are mixing two ideas. In the example mentioned I would just add the email addy to the model's list and then trigger OnPropertyChanged on my ObservableCollection to show that.

You can certainly bind to an ObservableCollection of viewModels (I think that's what you are getting at) instead of just returning the models List, but that would be if you had a reason for each item to be it's own viewModel. In that case, you could simply add a new viewModel to the ObservableCollection of viewModels. That viewModel would instantiate a new model in which it's own properties would provide access to it's model.

Mr Shiny Pants
Nov 12, 2012

GoodCleanFun posted:

Yes exactly.

Sort of sounds like you are mixing two ideas. In the example mentioned I would just add the email addy to the model's list and then trigger OnPropertyChanged on my ObservableCollection to show that.

You can certainly bind to an ObservableCollection of viewModels (I think that's what you are getting at) instead of just returning the models List, but that would be if you had a reason for each item to be it's own viewModel. In that case, you could simply add a new viewModel to the ObservableCollection of viewModels. That viewModel would instantiate a new model in which it's own properties would provide access to it's model.

I don't have observable collections in my model. Just a list.

So now I have some logic in my viewmodel that puts a new item in my model list and puts the appropriate view model in an observable collection.

This way they are in sync, my remove methods are a bit more work but it seems ok.

ljw1004
Jan 18, 2005

rum

epalm posted:

Apparently once in a while Azure Websites inexplicably drop connections to Azure SQL Servers. This happens often enough that they've written a BandaidThisHugeProblem class (cleverly named SqlAzureExecutionStrategy) to retry the connection if it drops.
...
Oh wait a minute, if you were thinking of writing a robust application by making use of transactions, guess what! SqlAzureExecutionStrategy doesn't allow you to create transactions (because between dropping and retrying a connection, who knows what's happened!)
...
When will the madness end?
OR
Why is it this hard to write a reasonably robust application?
OR
Why don't they just figure out what's wrong with the connections between Azure Websites and Azure SQL Servers?
</rant>

All that seems such a bad idea. But I think your question "why is it hard to write a reasonably robust application" is misguided. Every single distributed interaction has three possibilities:

[1] it might succeed and you know it (e.g. 200)
[2] it might fail and you know it (e.g. 404)
[3] it might succeed/fail but you don't know which (e.g. ConnectionLost or Timeout)

All that an automatic-retry strategy does is alter the probability distribution of the three outcomes (making the first two slightly more likely and the third slightly less likely) at the cost of increasing the latency of [3], and also increasing your code complexity.

Is it worth doing automatic retry? -- only if you have statistical evidence that your retry strategy will significantly reduce the probability of [3], enough so that the increased latency of [3] doesn't matter, and only if you have statistical evidence that the extra code complexity is worth it because it noticeably improves user satisfaction.

But make no mistake: you still have to handle case [3].

I too have observed transient Azure SQL errors but only very rarely, not enough to make any solid statistical summary out of it. I've searched high and low for solid statistics on failure rates in Azure SQL databases but without success. In the absence of such evidence, I think it's just a bad idea to throw more code into your application (code that will almost never be tested! and code that handles already-rare cases!) Especially since it's an already-rare case, and your time is better spent adding other more noticeable user value.

I think the answer's straightforward. If you have a user-facing website or client app that connects to the AzureSQL database, then your website/app should fail fast and give the user the opportunity to retry. That's because users end up far wiser than our code about retry strategies, and they always appreciate "fail-fast". And if you have a non-user-facing batch processing job, then just schedule it to be run again at the next scheduled time. I think that "automatic retry" is an anti-pattern.

ljw1004 fucked around with this message at 13:37 on Mar 22, 2015

TheEffect
Aug 12, 2013
I'm trying to create a tray icon for my little home brewed application. Based on the code I have below, can anyone help me with the following-

1) The icon will stay after the program has quit until you hover over it. This can create multiple "ghost" icons. How do I prevent this?
2) A lot of the time click on the menu item, even though its clearly highlighted, won't do anything at all. What's the deal with that?
3) Each time the context menu opens up a taskbar icon is opened as well. How do I stop this?!?!
4) I have code that closes the context window after the mouse hovers away from it, but I'd rather it be so the user has to click to make it close. I can't find any examples that have worked for me thus far.

Here's the code-

code:
    Private Sub trayIcon_MouseDoubleClick(sender As Object, e As MouseEventArgs) Handles trayIcon.Click
        contextMenuNFC.AutoClose = True
        If e.Button = Windows.Forms.MouseButtons.Right Then
            contextMenuNFC.Show()
        End If
    End Sub

    Private Sub ContextMenuNFC_Opening(sender As Object, e As System.ComponentModel.CancelEventArgs) Handles contextMenuNFC.Opening
        contextMenuNFC.Show(Cursor.Position)
        contextMenuNFC.Left = contextMenuNFC.Left + 1
        contextMenuNFC.Top = contextMenuNFC.Top + 1
    End Sub

    Private Sub ContextMenuNFC_MouseLeave(ByVal sender As Object, ByVal e As System.EventArgs) Handles contextMenuNFC.MouseLeave
        contextMenuNFC.Close()
    End Sub

    Private Sub ToolStripMenuItemHelp_MouseUp(sender As Object, e As MouseEventArgs) Handles ToolStripMenuItemHelp.MouseUp
        Process.Start("notepad.exe", resourcesDir + "\Documentation\" & "ReadMe.txt")
    End Sub

    Private Sub ToolStripMenuItemQuit_MouseUp(sender As Object, e As MouseEventArgs) Handles ToolStripMenuItemQuit.MouseUp
        Me.Close()
    End Sub
Essentially what I'm asking is how do I make this way less crappy than it is?

TheEffect fucked around with this message at 07:43 on Mar 23, 2015

Mr Shiny Pants
Nov 12, 2012
Well, the retard of the day award goes to me.

I was having problems getting my combobox to bind to a field in my model. Everything I tried the stupid SelectedItem would not show the value of my model.

Turns out the default width of the control was larger than the space I had given it in my template, so the value was there but it got cut off.

This took me a couple of hours to figure out............... Didn't help that the values are only two characters.......

raminasi
Jan 25, 2005

a last drink with no ice
I am having an infuriating WPF problem: a custom UserControl I've made is failing to load with "The component [my component] does not have a resource identified by the URI [URI which definitely points to a real thing]." How do I know the URI is good? Because it works sometimes, just not all the time (as in, I can restart the application and it will work. Maybe.) But it's been getting worse, and now it basically never works. What the hell is going on? Googling this suggests restarting Visual Studio (didn't help), manually cleaning my project (used to help, now doesn't), switching off the client profile (never targeted it), and manually creating objects in the code behind (not really applicable here, I think). Apparently some people only have this problem at design time, but it's becoming a real run-time problem for me.

edit: I decompiled my assembly, and there's no .baml corresponding to the missing component. So why the hell isn't it in there?

raminasi fucked around with this message at 15:52 on Mar 23, 2015

epswing
Nov 4, 2003

Soiled Meat

GrumpyDoctor posted:

I am having an infuriating WPF problem: a custom UserControl I've made is failing to load with "The component [my component] does not have a resource identified by the URI"

Can you create a test project that exhibits the problem?

When WPF does things that are totally weird, I start with a fresh project and include ONLY the necessary parts. At best, I can narrow down exactly what's causing the strange behavior (and start to ask why). As worst, I have a sample solution I can show folks here / StackOverflow / Microsoft.

raminasi
Jan 25, 2005

a last drink with no ice

epalm posted:

Can you create a test project that exhibits the problem?

When WPF does things that are totally weird, I start with a fresh project and include ONLY the necessary parts. At best, I can narrow down exactly what's causing the strange behavior (and start to ask why). As worst, I have a sample solution I can show folks here / StackOverflow / Microsoft.

The problem isn't consistent. Sometimes it happens, and sometimes it doesn't. It's just been getting more and more frequent.

e: I have successfully solved my problem, for the moment, by commenting out the body of the custom control, rebuilding, uncommenting it, and rebuilding again. The Team Explorer reports no differences between the "before" and "after" code. :yum:

raminasi fucked around with this message at 16:20 on Mar 23, 2015

Dietrich
Sep 11, 2001

So my client has a solution with 121 projects in it, and through branching and merging the .sln file has developed some issues. Are there any tools out there that will analyze a .sln file and find problems?

The specific error we're getting is "Error parsing the nested project section in solution file."

Mongolian Queef
May 6, 2004

TheEffect posted:

1) The icon will stay after the program has quit until you hover over it. This can create multiple "ghost" icons. How do I prevent this?

Remember to call Dispose on the icon when your application is exiting.

Calidus
Oct 31, 2011

Stand back I'm going to try science!
I know this might be pure convention, is it proper in .NET MVC and in MVC design in general to have a view that just consists of other views? I have 3 partials views which I want to display on a single page, do I make a "wrapper" view and just call each of the partials, or do I promote on of the partials to a full view. On one hand is kinda seems like useless junk but on the other I can see it being nice.

wwb
Aug 17, 2004

Dietrich posted:

So my client has a solution with 121 projects in it, and through branching and merging the .sln file has developed some issues. Are there any tools out there that will analyze a .sln file and find problems?

The specific error we're getting is "Error parsing the nested project section in solution file."

I'm not aware of specific tools but one place to start might be trying to msbuild the solution file in verbose mode and see what it trips on.

Looking at the sln file might also work -- they aren't that wacky, sometimes merge artifacts are very obvious. Blame can also help.

epswing
Nov 4, 2003

Soiled Meat

ljw1004 posted:

I too have observed transient Azure SQL errors but only very rarely, not enough to make any solid statistical summary out of it. I've searched high and low for solid statistics on failure rates in Azure SQL databases but without success. In the absence of such evidence, I think it's just a bad idea to throw more code into your application (code that will almost never be tested! and code that handles already-rare cases!) Especially since it's an already-rare case, and your time is better spent adding other more noticeable user value.

Well it's happened three four times in five days:

March 19th at 12:19 EST
March 23rd at 19:25 EST
March 23rd at 22:58 EST
March 24th at 10:46 EST

The EntityException stacktrace looks like this: http://pastebin.com/raw.php?i=ZX3M5dwz

My site is still in beta, no real traffic yet. Less than 500 requests per day. Doesn't seem rare at all :confused:

Edit: Sorry if it seems like I'm complaining to you personally, ljw1004. I know it's not your fault :)

I think I'm just mad that this is an issue I have to deal with at all. I know everything is virtualized but both site and database are physically in the same datacenter (East US). I'm coming from eApps and Linode and DigitalOcean and the application code served through the web server dropping the connection to a database in the same datacenter is just Not A Thing I've had to deal with before.

I guess I'll go ahead and apply my own bandaid overtop Microsoft's bandaid :rolleyes:

Bognar posted:

We saw that we were doing a bunch of stuff to get Azure happy with transactions, so we ended up making our own wrapper around Transaction that implements IDisposable. That would probably also work for you, and you could set SuspendExecutionStrategy = true in the constructor and false in the Dispose implementation.

Mind if I steal this from you? Or, if I do it myself by setting SuspendExecutionStrategy to true/false in the constructor/dispose, is that all or is there more to it that you've stumbled across?

epswing fucked around with this message at 15:55 on Mar 24, 2015

22 Eargesplitten
Oct 10, 2010



I read the OP, I see Skeet and Richter recommended for books. I'm used to Java and C++, with somewhere between an undergrad sophomore and junior level of understanding. So I don't need to have the difference between a parent class and an interface explained to me. But I still need something aimed at a relatively low level. Which of the two would you recommend (or others)?

Adbot
ADBOT LOVES YOU

Mr Shiny Pants
Nov 12, 2012

22 Eargesplitten posted:

I read the OP, I see Skeet and Richter recommended for books. I'm used to Java and C++, with somewhere between an undergrad sophomore and junior level of understanding. So I don't need to have the difference between a parent class and an interface explained to me. But I still need something aimed at a relatively low level. Which of the two would you recommend (or others)?

I liked this: http://www.amazon.com/Learning-C-3-0-Jesse-Liberty/dp/0596521065

It is old now, but I found it pretty good. If you can get it cheap, why not.

It does not have the async stuff, but for C# itself can still be relevant.

E: Seems like there is a version 4 also. Might want to check that.

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