c#,.net,gacRelated issues-Collection of common programming errors


  • Robbie Dee
    c# inheritance
    Knowing that C# doesn’t support multiple inheritance, is it considered bad form to write a utility base class?Some initial thoughts:I could create an interface and a concretion, but then the implementation isn’t portable Should the developer need to extend the class in say, a decorator pattern, they could implement this new class and inherit the base class in their new classEDIT:N.B. I’m not talking about vanilla inheritance here e.g. poodle<–dog<–mammal<–animalMore this sort of thin

  • p.s.w.g
    c# coding-style coding-standards teamwork
    I have one one software system which allows developers to specify an ID or name to create NodeReferences. Both work fine, but ID’s are not guaranteed to be the same across different environments. I’ve tried in documentation and in conversations to stress that ID’s should not be hard coded (since they will break when deployed to a different environments), but some developers are still using them. This works only in dev environment:var level = LevelReference.ById(20); var node = NodeReference.ByNa

  • Andrei
    c# .net git debugging
    When our application doesn’t work the way we expect it to (e.g. throws exceptions etc.), I usually insert a lot of debug code at certain points in the application in order to get a better overview of what exactly is going on, what the values for certain objects are, to better trace where this error is triggered from. Then I send a new installer to the user(s) that are having the problem and if the problem is triggered again I look at the logs and see what they say.But I don’t want all this debug

  • Ismail Gunes
    mysql c#
    I use this query for loading sql data from my pc to localhost mysql database.(version 5.0.10 working witj XAMPP)The query is as below:cmd = new MySqlCommand(“LOAD DATA LOCAL INFILE ‘” + filename + “‘ IGNORE INTO TABLE ” + tblname + ” CHARACTER SET UTF8″, conn);And I tried this also (enclosed tblname) cmd = new MySqlCommand(“LOAD DATA LOCAL INFILE ‘” + filename + “‘ INTO TABLE `” + tblname + “` CHARACTER SET UTF8”, conn);And one line of my sql data (loaded without problem by phpmyadmin) :INSERT I

  • Max Vernon
    c# oracle
    I have an Oracle server running on Windows Server. When an INSERT statement runs I receive an Oracle Ora-00603 error. The insert statement just tries to insert a BLOB into a table. I searched the error specification on Google and found that perhaps there are network connection issues. The suggested action is to log in again to Oracle Server. I followed this tip, however I still receive the same error.The error I receive is the following:ora-00603: ORACLE server session terminated by fatal error

  • MikroDel
    c# refactoring unit-testing wcf
    I have WCF Service. Its work fine and I want to have test coverage for it. Unit tests and acceptance. The problem is static class using in the code. How is it possible to avoid it?If it will be refactored to the code without static classes – I can use mocks for example Moq.I have also used Ninject as DI Framework so far.[ServiceContract]public interface IWorkingService{[OperationContract]Collection<Ergebnis> UpdateEntity(int entityID);}public class WorkingService : IWorkingService{private

  • Jamal
    c# networking socket tcp
    I’ve only been coding C# a few weeks and was just hoping for a little constructive criticism of a socket server I’ve been working on:using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Net.Sockets; using System.Net;namespace NetworkCommunication {public class TCPSocketServer : IDisposable{private int portNumber;private int connectionsLimit;private Socket connectionSocket;private List<StateObject> connectedClients = new List<StateObject>(

  • kmp
    c# .net
    I saw this question “Is this implementation of an Asynchronous TCP/UDP Server correct” and it is very similar to what I want to do but it goes about it in a different way so I am wondering if anyone would mind doing some constructive critism on my method please.I’m looking for any feedback along the lines of “when x happens your server will fall over because of y” or something like that.My intention is that the server should log out errors that happen and raise an event when it has data. I wan

  • tesicg
    c#
    The code I want to refactor look as following:public bool CheckPay(Int64 orderID) {vpc_OrderInfo = orderID;RequestParams =string.Format(“vpc_Version={0}&vpc_Command={1}&vpc_AccessCode={2}&vpc_MerchTxnRef={3}&vpc_Merchant={4}&vpc_User={5}&vpc_Password={6}”,vpc_Version, vpc_Command, vpc_AccessCode, vpc_MerchTxnRef, vpc_Merchant, vpc_User, vpc_Password);string[] response = SendRequest(vpc_VirtualPaymentClientURL, RequestParams).Split(‘&’);bool ResponseCode = false;bool e

  • Jamal
    c#
    I have two quite mutually exclusive desires – detailed logs and keeping my code clean. It appears that you can only get either of these. By “logging” I mean logging and not tracing, so AOP adepts wouldn’t appreciate it.What I want to have is real description of action my program does, why it does these actions and so forth. For instance, ‘failures’ could either be real failures like ‘fatal errors’, or absolutely normal behavior depending on context: I don’t like to check whether or not file exis

  • Chris Dunaway
    ssl windows certificates .net
    I have written an application (in C#) to communicate with one of our customers via a web service. Our customer requires us to use bi-directional SSL. The customer has sent us their certificate (in the form of a .p7b file). The client certificate was provided to me in the form of a .cer file.I’ve installed the certificates and in the program I use the HttpWebRequest class and add the client certificate to the ClientCertificates collection.When I run the program I get an exception:System.Net.We

  • Andrei
    c# .net git debugging
    When our application doesn’t work the way we expect it to (e.g. throws exceptions etc.), I usually insert a lot of debug code at certain points in the application in order to get a better overview of what exactly is going on, what the values for certain objects are, to better trace where this error is triggered from. Then I send a new installer to the user(s) that are having the problem and if the problem is triggered again I look at the logs and see what they say.But I don’t want all this debug

  • kmp
    c# .net
    I saw this question “Is this implementation of an Asynchronous TCP/UDP Server correct” and it is very similar to what I want to do but it goes about it in a different way so I am wondering if anyone would mind doing some constructive critism on my method please.I’m looking for any feedback along the lines of “when x happens your server will fall over because of y” or something like that.My intention is that the server should log out errors that happen and raise an event when it has data. I wan

  • John M
    c# .net mysql
    Using Windows Server 2003, MySQL 5.1.23, MySQL .NET Connector 6.2.2I am trying to use the MySQLBulkLoader class to read in a fixed width text file. An excerpt from that classes Load method is:string sql = BuildSqlCommand(); MySqlCommand cmd = new MySqlCommand(sql, Connection); cmd.CommandTimeout = 10 * 60;// Timeout; cmd.ExecuteNonQuery();The string created by ‘BuildSqlCommand’ is:LOAD DATA LOCAL INFILE ‘c:/M/D/ALLDATA_0.TXT’ INTO TABLE dk.tk FIELDS TERMINATED BY ” LINES TERMINATED BY ‘\n’ W

  • Daniel Rose
    .net .net-3.5 fatal-error
    Summary:I periodically get a .NET Fatal Execution Engine Error on an application which I cannot seem to debug. The dialog that comes up only offers to close the program or send information about the error to Microsoft. I’ve tried looking at the more detailed information but I don’t know how to make use of it.Error:The error is visible in Event Viewer under Applications and is as follows:.NET Runtime version 2.0.50727.3607 -Fatal Execution Engine Error(7A09795E) (80131506)The computer running it

  • samaxI92
    c# .net obfuscation
    The class below causing –fatal error– after obfuscating with confuser(v1.9.0.0); I’m thinking its for bad/unsafe coding. I’m a beginner programmer. So it would be great if some-one point and describe the bad part(if exists) of my code. My IDE is VS-2010. Thanks. public class Check_COMgsm {public Exception ex;public List<string> ModemName;public List<string> ModemPort;public Check_COMgsm(){this.ex = null;this.ModemName = new List<string>();this.ModemPort = new List<string&g

  • Chris Moutray
    .net sql-server
    I’ve recently started receiving this error: “Internal connection fatal error” from my application. The error occurs randomly. When it happens my application is unusable for the next few minutes. After careful analysis of the error I’ve concluded that this error happens in only one method within my application. This method fires a series of simple ordinary SQL queries but it does involve multithreading however all threads should be disposed before this block of code. The error happens always on a

  • spender
    c# .net collections
    I need to maintain a roster of connected clients that are very shortlived and frequently go up and down. Due to the potential number of clients I need a collection that supports fast insert/delete. Suggestions?

  • natli
    c# .net linux mono json.net
    Running Mono 3.2.6 on Debian 7When using Newtonsoft.Json to deserialize objects in a multithreaded application, my application crashes due to ‘segmentation fault.’ I attached gdb & here’s the output:root@ns38225:/home/stress# gdb program 30380 GNU gdb (GDB) 7.4.1-debian Copyright (C) 2012 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to

  • FreelanceCoder
    c++ .net linker lnk
    This question is an exact duplicate of:C and hashlib LNK errors1 answerNote that i am using Windows Forms Applications with the .NET Here is my code:#pragma once #include <cstdlib> #include <Windows.h> #include <string.h> #include <stdlib.h> #include <algorithm> #include <stdio.h> #include <string> #include <cstring> #include <iostream> #include <vcclr.h> #include <hashlibpp.h>namespace Launcher {using namespace System;using names

  • raklos
    c# visual-studio gac
    is there a best way to deploy to the GAC?is dragging the dll to the GAC sufficient?

  • Mitch Wheat
    .net visual-studio-2008 gac
    Duplicate of: Getting assemblies to show in the .NET tab of Add ReferenceSo, I’m using Visual C# 2008 Express Edition and I’ve just been on a bit of a detour as I found out that my assumption that the .NET tab of the ‘Add Reference’ dialog lists the contents of the GAC was incorrect. This was a bit of a problem for me as the assembly that I wanted to reference from my project was only available in the GAC. (It was Microsoft.XNA.Framework v2.0 obtained from the XNA 2.0 redistributalbe and as far

  • Bo Persson
    c# .net gac .net-assembly
    using System; using System.Collections.Generic; using System.Text; using Shapes;namespace ShapeUser {public class ShapeUser{public static void Main() {Circle c = new Circle(1.0F);Console.WriteLine(“Area of Circle(1.0) is {0}”, c.Area());Console.ReadKey(); // press a key to exit program}} }This program is using Shapes assembly which is in the GAC. If there is only one assembly, its fine. But, the GAC may contain other assemblies with the same name (but different version and key).So, how to tell t

  • Peter Mortensen
    .net .net-4.0 gac
    %windir%\Microsoft.NET\assembly\ is the new GAC. Does it mean now we have to manage two GACs, one for .NET 2.0-3.5 applications and the other for .NET 4.0 applications?The question is, why?

  • jcollum
    c# .net gac
    How can i get the location of the GAC directory using C#?Exist an entry in the Windows Registry?UPDATEI need the location because, i want to enumerate and analyze the assemblies located in the GAC.Bye.

  • Rob Mensching
    dll wix gac
    i’m trying to install dlls to GAC, I get this error:The assembly is not strongly named or is not signed with the minimal key length.Code below. How do I get around this?<Product Id=”4C76EAE3-148A-4597-A994-0178693C5B25″ Name=”MySolutionInstaller” Language=”1033″ Version=”1.0.0.0″ Manufacturer=”Me” UpgradeCode=”a5e6cbeb-18be-4f7e-9ab5-f1adb1d947eb”><Package InstallerVersion=”200″ Compressed=”yes” InstallScope=”perMachine” /><MajorUpgrade DowngradeErrorMessage=”A newer version of [P

  • robert.oh.
    frameworks gac app-config
    I’m trying to deploy some sort of framework and therefore need to register some assemblies in the GAC.The interesting part is: These GAC assemblies should only be used by the framework developer, the client apps should not use these GAC assemblies but the ones in their local directories (the GAC assemblies could be of a different version, most likely higher).I’ve already found and tried the app.config setting but it seems to be ignored by the client app (latest .NET runtime installed is 3.5).An

  • starblue
    asp.net assemblies web-parts gac
    Actually my objective is;Create asp.net web service (namespace ws, class Service1) Create dll from web service Install this dll to GAC Create ASP.NET web application Don’t add a reference for this dll in the GAC Create Web User Control without any code behind the file Write code inside the Web User Control to use the Web Service created above (without giving reference to application)The question is;Can the web application searchs assembly inside GAC even if the assembly wasn’t referenced to the

  • Martin
    c# assemblies reference gac activereports
    I have a project where I simultaneously must use reports built in ActiveReports 2 and ActiveReports 6. Overall, it works ok, but some of the helper assemblies use the same name. For instance, to be able to export to PDF, both versions use an assembly called ActiveReports.PdfExport.dll. The corresponding assemblies are different, of course.Note that I don’t access the ActiveReports.PdfExport.dll directly – this is handled by the ActiveReports runtime.I can’t find a way to include both of them

  • Nathan Baulch
    .net winforms dll clickonce gac
    How do I do it? Is there any reason I shouldn’t? I have a winform ClickOnce App that has about 13mbs in DLLs that are not mine so I would have no need/ability to update them at any regular intervals. DevExpress(3), Microsoft ReportViewer, Microsoft SQL Replication. Microsoft SQL SMO.Without them being included in my ClickOnce App my whole program comes in at about 1.5mbs and with our remote sites having limited vpn connectivity I really need to get it down there. I can’t send 15mbs across our

Web site is in building