What do I need to know to compile my first little program in visual studio community using c#? There are no errors and it runs fine in debug mode, but when I export it (to either build or release, on any CPU or x6) and try to run the .exe it just hangs forever, windows explorer on that screen lagging massively forever until it waits long enough for me to be able to close it, and otherwise nothing happens. So the program is crashing horribly somehow and I can't figure out how/why because it runs fine in debug mode through the IDE.. anything I'm missing? I've googled, checked the event viewer, re-exported multiple times, but can't figure it out. The program doesn't even do anything on start, it just (presumably) loads references and then draws some buttons. No actual behaviour starts until I click a button, but I never get to that point. Sulla Faex fucked around with this message at 15:21 on Dec 5, 2015 |
|
# ? Dec 5, 2015 15:19 |
|
|
# ? May 17, 2024 07:57 |
|
redleader posted:Greybeard Erland Sommarskog goes into a hell of a lot of detail on this subject. quote:For other types of objects than the four listed above, SQL Server does not build query plans. Specifically, SQL Server does not create query plans for views and inline-table functions. Queries like: I was under the impression the distinctions he is making regarding query plans haven't been true since early versions of Sql Server, and everything gets query plans generated now. (I know that's beside the point of why you linked it, its just something that I found curious)
|
# ? Dec 5, 2015 15:33 |
|
Kekekela posted:I was under the impression the distinctions he is making regarding query plans haven't been true since early versions of Sql Server, and everything gets query plans generated now. (I know that's beside the point of why you linked it, its just something that I found curious) Yeah, I thought the same thing. A close reading of that link reveals "If your application does not use stored procedures, but submits SQL statements directly, most of what I say this chapter is still applicable", which I interpret as meaning 'this applies equally to autogenerated SQL and suchlike'. It's been a while since I've run into a slow-in-app-fast-in-SSMS query though.
|
# ? Dec 6, 2015 04:23 |
|
Sulla-Marius 88 posted:What do I need to know to compile my first little program in visual studio community using c#? Sounds funky. Should be nothing special required. Post your code maybe? Does it also hang if you do "Run without Debugging"?
|
# ? Dec 7, 2015 09:29 |
EssOEss posted:Sounds funky. Should be nothing special required. Post your code maybe? Ah poo poo, good call. Yeah it hangs if i Run without debugging. I wonder what the difference is that the IDE can't catch it in Debug mode. I'll do some Googling now and if that fails just rip out my code until I get it to a working stage again. Thanks!
|
|
# ? Dec 7, 2015 14:28 |
What would be the best way to create a web URL that has a base64 encoded string in it? I had a problem with forward slashes earlier, are there other characters I might need to worry about?
|
|
# ? Dec 7, 2015 15:52 |
|
Why can't I put Automapper mapping configurations (via Mapper.CreateMap statements) in the static constructor of the related object? To me, this seems like the most logical place to put the mapping statements: C# code:
Edit: Oh. Automapper must simply be checking to see if a mapping exists before trying to map it. Duh. epswing fucked around with this message at 15:59 on Dec 7, 2015 |
# ? Dec 7, 2015 15:55 |
Sulla-Marius 88 posted:Ah poo poo, good call. Yeah it hangs if i Run without debugging. I wonder what the difference is that the IDE can't catch it in Debug mode. I'll do some Googling now and if that fails just rip out my code until I get it to a working stage again. Thanks! I started a new Windows Form project and hit 'run without debugging' and it crashed as well. So the problem is my dev environment, not the solution. Ugh
|
|
# ? Dec 7, 2015 16:25 |
|
epalm posted:Why can't I put Automapper mapping configurations (via Mapper.CreateMap statements) in the static constructor of the related object? e: Nevermind, I read it wrong.
|
# ? Dec 7, 2015 16:25 |
|
Manslaughter posted:What would be the best way to create a web URL that has a base64 encoded string in it? I had a problem with forward slashes earlier, are there other characters I might need to worry about? Just use Uri.EscapeDataString()
|
# ? Dec 7, 2015 17:02 |
|
I'm having an InstallShield problem that I just can't crack. It's a long shot but maybe someone here has seen this before. I have InstallShield 2013 LE set to install
as well as to create a site in IIS, with a Content Source Path of "[IISROOTFOLDER]WinBatchAsp" When I run the installer, C:\inetpub\wwwroot\WinBatchAsp\bin looks like this: but when I load the site in Chrome I get quote:Could not load file or assembly 'System.Net.Http.Formatting' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040) HOWEVER, from Visual Studio (as Administrator) if I right-click -> Publish using the File System publish method, C:\inetpub\wwwroot\WinBatchAsp\bin looks like this: (note the extra folders) and after manually creating a site in IIS Manager, when I load the site in Chrome everything works as expected.
|
# ? Dec 7, 2015 17:14 |
|
epalm posted:(note the extra folders) and after manually creating a site in IIS Manager, when I load the site in Chrome everything works as expected. Ignoring the extra folders, are there any additional DLLs in the bin folder after publishing? If you delete the folders does it still work?
|
# ? Dec 7, 2015 19:05 |
|
Bognar posted:Ignoring the extra folders, are there any additional DLLs in the bin folder after publishing? If you delete the folders does it still work? Each of those language-looking folders contain:
When I delete all the folders and restart IIS, the site still works, yes. I haven't gone one by one to match them all up, but, after deleting the folders, in both cases there are 46 dlls in the bin folder. epswing fucked around with this message at 19:46 on Dec 7, 2015 |
# ? Dec 7, 2015 19:43 |
|
Manslaughter posted:What would be the best way to create a web URL that has a base64 encoded string in it? I had a problem with forward slashes earlier, are there other characters I might need to worry about? RFC 4648 and RFC 6920 (I think) define/mention the commonly used base64url encoding, which is URL-safe. It's used everywhere in JavaScript land. Replace + with - and / with _.
|
# ? Dec 7, 2015 21:56 |
|
epalm posted:Automapper mapping configurations Separate your models from how your models are mapped. https://en.wikipedia.org/wiki/Single_responsibility_principle I also recommend looking into using Automapper non-statically. Testing is a bit easier. Configure mappings via Profiles then inject in IMappingEngine instances as needed to map.
|
# ? Dec 8, 2015 03:55 |
|
epalm posted:I'm having an InstallShield problem that I just can't crack. It's a long shot but maybe someone here has seen this before. That manifest not matching error usually means that your project references version x of a library but when the library was actually loaded at runtime, it finds version y instead, and there's no explicit remapping of version x to y in the app/web.config to allow version y to be loaded. I'm guessing that install shield is including version 2 of the dll while your project references version 4, or maybe that it's not including the dll at all and using what's in the gac, and the gac doesn't have the version you're expecting. I suppose in either case, you could go to the install shield settings and explicitly select that dll with the correct version, and force it to use that one instead of either trying to guess the right one on its own or leaving it out and expecting the right one to already be in the gac.
|
# ? Dec 8, 2015 05:41 |
|
epalm posted:Why can't I put Automapper mapping configurations (via Mapper.CreateMap statements) in the static constructor of the related object? Hey, not sure if you give a poo poo, but I found this automapper style which keeps the `Mapper.CreateMap<Person, PersonDto2>();` part out of your DTO's for classes with one-to-one mappings... `AutomapperConfigTask.Execute()` gets called on startup, and handles the basic one-one CreateMap statements, so you only need to write the custom ones by implementing IHaveCustomMappings. I used to have heaps of classes implementing automappers `Profile` that got discovered on startup, but I think having the mapping inside the DTO's is a better way to go than lumping them all together, and this style seems to complement what you're already thinking of with the static methods. code:
|
# ? Dec 8, 2015 08:16 |
|
I'm stuck in deployment hell right now. I simply cannot get this ASP project installed and working in IIS. After installing, in the browser I get quote:Could not load file or assembly 'System.Net.Http.Formatting' or one of its dependencies. I've set the System.Net.Http.Formatting reference Copy Local to true/false, no difference. Following some SO advice, if I remove pre:<dependentAssembly> <assemblyIdentity name="System.Net.Http.Formatting" publicKeyToken="31bf3856ad364e35" culture="neutral" /> <bindingRedirect oldVersion="0.0.0.0-5.2.3.0" newVersion="5.2.3.0" /> </dependentAssembly> quote:Could not load file or assembly 'System.Spatial' or one of its dependencies. I don't know how to diagnose/debug these errors, so I'm just endlessly googling, flipping a setting here and there, uninstalling, reinstalling, and that's been my existence for days. Any advice? I'm using a pretty standard ASP.NET WebAPI setup, as far as I can tell, on Visual Studio 2013, .NET 4.5, MVC 5, WebAPI 2, IIS 7.5, Windows 7. epswing fucked around with this message at 16:54 on Dec 8, 2015 |
# ? Dec 8, 2015 16:50 |
|
Whenever I get this error it's often caused by the referenced assembly having the wrong version vs. what's defined in the binding redirects. Sometimes different projects in the solution are using a different version. What version is the System.Net.Http.Formatting assembly you are referencing in your projects? (can also check this by looking at the file version of the assembly file that's actually copied to the bin directory)
|
# ? Dec 8, 2015 17:14 |
|
amotea posted:What version is the System.Net.Http.Formatting assembly you are referencing in your projects? (can also check this by looking at the file version of the assembly file that's actually copied to the bin directory) I'm assuming you mean this? It's version 5.2.3.0 This is the properties window of the file that gets copied to the bin direction. The version doesn't seem to match, but I'm not sure what "version" it's referring to. epswing fucked around with this message at 18:19 on Dec 8, 2015 |
# ? Dec 8, 2015 18:17 |
|
kingcrimbud posted:Separate your models from how your models are mapped. https://en.wikipedia.org/wiki/Single_responsibility_principle What does it enable you to test? That your program still works even if you substitute in some other Automapper implementation? I think people should buckle down and write the translators. Pretty soon you will find yourself writing enough logic in a translator that if you start doing all that stuff through the Automapper API you'll be miserable in trying to debug and maintain it.
|
# ? Dec 8, 2015 18:20 |
epalm posted:I'm assuming you mean this? Are there any other projects in your solution that use it? What happens if you remove and readd the reference then rebuild?
|
|
# ? Dec 8, 2015 18:24 |
|
Manslaughter posted:Are there any other projects in your solution that use it? What happens if you remove and readd the reference then rebuild? Yes, it's referenced in the Asp project, and the Asp.Tests project. I removed both references, re-added them, rebuild, and now I get epswing fucked around with this message at 19:12 on Dec 8, 2015 |
# ? Dec 8, 2015 18:32 |
|
Has anyone created Task Scheduler jobs from code? It looks like it's possible from a command line. Another option seems to be to export as a file and then copy it into the correct folder. I need something that works from XP on up. Is there any libraries recommended? edit: found this, https://taskscheduler.codeplex.com/ That looks pretty good and is available via Nuget. Essential fucked around with this message at 19:23 on Dec 8, 2015 |
# ? Dec 8, 2015 18:59 |
|
epalm posted:I'm stuck in deployment hell right now. I simply cannot get this ASP project installed and working in IIS. Have you looked at the fusion log? http://www.hanselman.com/blog/BackToBasicsUsingFusionLogViewerToDebugObscureLoaderErrors.aspx https://msdn.microsoft.com/en-us/library/e74a18c4(v=vs.110).aspx
|
# ? Dec 8, 2015 19:08 |
|
beuges posted:Have you looked at the fusion log? No I haven't, thanks for the link. The research continues. What's killing me is the app builds and runs fine when debugging from VS via IISExpress, and runs fine when I right-click Publish to File System and create an IIS site manually. But when I install via InstallShield I get "Could not load file or assembly 'System.Net.Http.Formatting' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference".
|
# ? Dec 8, 2015 19:12 |
|
Try removing the reference to Web API and adding the Web API package from NuGet.
|
# ? Dec 8, 2015 19:38 |
|
Essential posted:Has anyone created Task Scheduler jobs from code? It looks like it's possible from a command line. Another option seems to be to export as a file and then copy it into the correct folder. It sucks. There's a com api but it's incomprehensible. Windows server 2012 has powershell cmdlets. Personally, I just export /import them when I need to have scheduled tasks exist as part of environment configuration.
|
# ? Dec 8, 2015 19:41 |
|
Bognar posted:Try removing the reference to Web API and adding the Web API package from NuGet. I understand what you mean, but I don't know exactly how to do that. Can you be more explicit? Wen you say "remove the reference to Web API", what exactly is "the reference to Web API"? There are a bunch of items in the project References list that start with "System.Net.Http". What about the ones starting with "System.Web.Http"? I have some vague impression that "http" means WebAPI and "web" means MVC. Which do I remove? What exactly do I add from nuget? A search on nuget.org for "webapi" returns 954 packages. Which do I need?
|
# ? Dec 8, 2015 19:46 |
|
epalm posted:I understand what you mean, but I don't know exactly how to do that. Can you be more explicit? Open the references folder on your web project, delete anything that starts with System.Web.Http or System.Net.Http. Then run Install-Package Microsoft.AspNet.WebApi to install this NuGet package. It's a shot in the dark, but that will at least specify all your references explicitly and maybe convince InstallShield that those are the assemblies that should be copied.
|
# ? Dec 8, 2015 19:54 |
|
Bognar posted:Open the references folder on your web project, delete anything that starts with System.Web.Http or System.Net.Http. Then run Install-Package Microsoft.AspNet.WebApi to install this NuGet package. I did exactly as you said, and got quote:PM> Install-Package Microsoft.AspNet.WebApi epswing fucked around with this message at 20:05 on Dec 8, 2015 |
# ? Dec 8, 2015 20:03 |
|
Huh, looks like it was already installed through NuGet. You would have to uninstall then reinstall to get that portion to work, but now I doubt that will help if the NuGet package was already referenced.
|
# ? Dec 8, 2015 20:24 |
|
Bognar posted:Huh, looks like it was already installed through NuGet. You would have to uninstall then reinstall to get that portion to work, but now I doubt that will help if the NuGet package was already referenced. I ran around the "Manage Nuget Packages for Solution" dialog killing anything with "API" in the name. Then ran Install-Package Microsoft.AspNet.WebApi and Install-Package Microsoft.AspNet.WebApi.Owin. Then compiled the installer, and installed it. As you suspected, same error ("[FileLoadException: Could not load file or assembly 'System.Net.Http.Formatting' or one of its dependencies. The located assembly's manifest definition does not match the assembly reference. (Exception from HRESULT: 0x80131040)]") Though the ASP project still works in IISExpress, and still works if I Publish to File System and manually create the site in IIS Manager. Edit: What a loving nightmare. I would happily throw cold hard cash at someone to fix this so I can move on with my life, but I'm stuck. If I hire a consultant (one of you) or even a developer support person from Microsoft, the answer will almost certainly be "shrug..InstallShield must be doing something weird", and if I hire a developer support person from InstallShield, the answer will almost certainly be "shrug..Visual Studio must be doing something weird". If someone here has been following my last few posts, knows what I'm after, and wants to make $150 USD /hr, PM me. epswing fucked around with this message at 21:14 on Dec 8, 2015 |
# ? Dec 8, 2015 20:30 |
|
Essential posted:Has anyone created Task Scheduler jobs from code? It looks like it's possible from a command line. Another option seems to be to export as a file and then copy it into the correct folder. FWIW we have moved most things that we triggered via scheduled tasks into the app as Quartz.NET jobs. Self contained is cool.
|
# ? Dec 8, 2015 20:45 |
|
Ithaqua posted:It sucks. There's a com api but it's incomprehensible. Windows server 2012 has powershell cmdlets. Bummer to hear that library sucks. I'll look into the export/import stuff. In case I'm heading in the wrong direction and there's a better solution, all I'm attempting to do is make sure my app is up and running. It uploads data every 15 minutes and sometimes it gets turned off for various reasons. A lot of the computers that run it never get rebooted, so run at startup never fires. I'd like a task that run's once an hour or so and if the app's not running to start it up. It really only needs to run M-F from 8am-6pm, but I don't know that I need to get that complex with the task scheduler. It can't be a Windows Service for various reasons. It's a system tray app and has to stay that way. And ideally I can set it all up automatically without anyone having to manually do anything. Also Ithaqua, I sent you a PM. If it's not something you can help with then please feel free to ignore. wwb posted:FWIW we have moved most things that we triggered via scheduled tasks into the app as Quartz.NET jobs. Self contained is cool. Cool thanks, I'll check that out as well! Now that I've explained my use case, would Quartz.net work?
|
# ? Dec 8, 2015 21:33 |
|
Thanks for clarifying the use case. Quartz.net probably isn't suitable here -- it is an internal scheduler which presumes your app is running not something that can get your app running like you need.
|
# ? Dec 8, 2015 22:58 |
|
fleshweasel posted:What does it enable you to test? That your program still works even if you substitute in some other Automapper implementation? Injecting interfaces allows for easier testing, especially when using Moq. Mock<>.Verify is a great way to ensure things are called or not called. Using static classes just makes things more difficult to test. And I agree with your second point in theory, I just haven't seen a case where the situation called for mapping between tiers/systems and Automapper was unable to do it cleanly and consistently.
|
# ? Dec 9, 2015 06:38 |
|
I'm getting a really bizarre log4net issue, I'm wondering if anyone has any ideas. Basically, when the (WPF) application loads up, it log4net loads its configuration context from the application config file correctly as expected; then at some point its configuration is switched to an entirely different applications configuration (Box Sync, in this case). Somehow Box Sync starts hijacking the log4net logs and my applications logging is getting dumped into a Box Sync log. The hell?
|
# ? Dec 9, 2015 17:47 |
|
Mr. Crow posted:I'm getting a really bizarre log4net issue, I'm wondering if anyone has any ideas. Basically, when the (WPF) application loads up, it log4net loads its configuration context from the application config file correctly as expected; then at some point its configuration is switched to an entirely different applications configuration (Box Sync, in this case). Somehow Box Sync starts hijacking the log4net logs and my applications logging is getting dumped into a Box Sync log. Some default configuration place log4net is looking and finding the Box Sync one and loading that? Dunno, sounds plausible.
|
# ? Dec 10, 2015 06:32 |
|
|
# ? May 17, 2024 07:57 |
|
I'm confused about how NuGet works and maybe someone can help me. There appears to be a discrepancy in how NuGet functions between Xamarin Studio and Visual Studio. I'm trying to add the Microsoft.CodeAnalysis nuget packages. In Xamarin Studio the only packages it adds besides the CodeAnalysis packages are System.Collections.Immutable and System.Reflection.Metadata. But in Visual Studio it is adding a ton of System.* packages that should already be installed by default (or at least I would expect them to be) such as System.Collections, System.IO, System.Linq, etc, etc. All of them tagged with 4.0.0 at the end. Can someone explain why it is doing this?
|
# ? Dec 10, 2015 21:31 |