c#,.net-3.5,dynamic,runtime,expandoobjectRelated issues-Collection of common programming errors


  • 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?

  • soshiki
    c# iphone mono monotouch monodevelop
    I have a project set up in MonoDevelop, it compiles and runs fine for the simulator but when I try to target a device I get a compile error saying:Error 1: mtouch failed with no output (1) (ChicksnVixens-MonoTouch)And this is the last bunch of stuff the build output has (paste bin: http://pastebin.com/Ea8hgaFH):Compiling to native code /Developer/MonoTouch/usr/bin/mtouch -v–nomanifest –nosign -dev”/Users/dev/Documents/Proj/cnv/MyCode/ChicksnVixens/bin/iPhone/Debug/ChicksnVixens-MonoTouch.app””

  • JL.
    c# security
    I am having a problem using the signedCMS.decode routine. See the code below. The error seems to occur when the file size is too big in this case 11MB. private static void RemoveZfoSignature(string zfoFileName) {byte[] fileContents = File.ReadAllBytes(zfoFileName);var contentInfo = new ContentInfo(fileContents);var signedCms = new SignedCms(contentInfo);// This line throws the error 100% of the timesignedCms.Decode(fileContents);signedCms.RemoveSignature(0);byte[] outfile = signedCms.ContentInfo

  • Tapas Bose
    c# asp.net nhibernate spring.net mapping-resources
    I am new in .NET. I have used Spring Framework and Hibernate before in Java, but this is my first in .NET. To develop my application I am using Spring.Northwind solution as example. The hibernate mapping is:<hibernate-mapping xmlns=”urn:nhibernate-mapping-2.2″><class name=”EMSApplication.Domain.Employee, EMSApplication.Domain” table=”ems_Employees” proxy=”EMSApplication.Domain.IEmployee, EMSApplication.Domain” lazy=”true”><id name=”Id” type=”System.Int32″><column name=”Id” n

  • 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

  • user1449783
    c# wcf .net-3.5 channel servicehost
    I’m running across this very strange behavior when using the IChannel interface. Basically what the code does is it spawns a process that loads CLR 4 (our application natively loads CLR 2 / .NET 3.5) and hosts a “ServiceContract” which will do some work and return a “DataContract” (serialize it, return it, deserialize it). Here is the code that spawns the IChannel:static Binding CreateBinding(){NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);binding.Security.

  • lampi
    c# nhibernate nhibernate-mapping
    WinForms application, NHibernate v3.3.x, .Net 4, Windows 7 (32bit), Oracle 10g backendWe are using a legacy database with an AuditTrail table where a column action type (AKTIONSCODE) controls the meaning of additional (optional) parameters (Para1-Para4)I have created a corresponding class AuditTrail;and derived sub classess like AuditTrailAsmRuleSetState and AuditTrailTestSpecSetState with the only purpose for getting some nice getters and setters for the common parameters.Inserting entries is w

  • Bronumski
    c# continuous-integration cassini-dev
    i run cassiniDev from cmdC:\CruiseControl.NET-1.5.0.6237\cassinidev.3.5.0.5.src-repack\CassiniDev\bin\Debug\CassiniDev.exe /a:D:_CCNET\proj /pm:Specific /p:3811and then start debugging and testing. How can i stop cassiniDev from CMD after i finished testing. I try with cassiniDev_console but console not working so i am using cassiniDev from console.

  • Lo Sauer
    c# .net reflection system.reflection
    Im trying to run executables from memory such as outlined in this article. I can run any .net/managed exes quite easily. But I cannot run executables such as notepad.exe or calc.exe. How can I get it so I can also run unmanaged exes?

  • Cody Gray
    c# .net windows icons file-type
    As seen in This SO question on getting icons for common file types, it’s quite possible for a windows program to get the icons for a registered file type using the C++ Shell API. These icons may or may not exist on disk – for example, we wanted to make our own custom file browser and want to display the system-associated icon with the file.Is there a native C# way to get the icons for various file types (and if so, how) or must it be done through PInvoke with shell API?And as a follow up, if th

  • user1449783
    c# wcf .net-3.5 channel servicehost
    I’m running across this very strange behavior when using the IChannel interface. Basically what the code does is it spawns a process that loads CLR 4 (our application natively loads CLR 2 / .NET 3.5) and hosts a “ServiceContract” which will do some work and return a “DataContract” (serialize it, return it, deserialize it). Here is the code that spawns the IChannel:static Binding CreateBinding(){NetNamedPipeBinding binding = new NetNamedPipeBinding(NetNamedPipeSecurityMode.None);binding.Security.

  • Ivaylo Slavov
    c# nhibernate .net-3.5 fluent-nhibernate
    I have class X that implements an interface IX. I also have a repository class dedicated for X, which uses lambda expresions as parameters:public interface IX { }public class X : IX {…. }public class XRepository : IRepository<X> {public IEnumerable<X> Filter(Func<X, bool> filterFunc){…} }I need to make the repository class work with the interface IX, therefore I add IRepository<IX> to the interfaces being implemented:public class XRepository : IRepository<X>, IR

  • Lima
    wpf .net-3.5 windows-7 login
    I have an windows application (WPF) in which we are running on each login, however when the user first logs into a new PC the application will need to do some specific tasks, but only on the users first login and never on subsequent times.Is there a way in .Net 3.5 to query wether the user has logged in before (ie some kind of login count)?Failing any native support I will create a txt file in the users registry however I wanted to know if there is a native way of achieving this first.We use red

  • AnarchistGeek
    c# web-services deployment .net-3.5 perforce
    I am using p4.net(perforce api for .net) to connect our perforce server and run some commands.I have created a web service and and created a test call(ConnectToServer), when I test this web service on local(localhost:xxxx/project/test.asmx) it works perfectly, however, when I deploy my web service to out server and call the my “connect” web method, it comes up and says Unable to connect Perforce Server.what is the difference between local and server, they both use same dlls to connect perforce,

  • Chris Conway
    .net web-services .net-3.5 .net-1.1
    I have a weird issue. I had a web service that was compiled under the 2.0 framework that was being consumed by a windows app that was compiled with the 1.1 framework. This worked just fine. Now, after upgrading the web service to the 3.5 framework, the windows app is no longer able to call it.Creating a little windows app in 3.5 as a test is able to call the web service without problems so I know it still works.Nothing has changed in the code at all, it’s just compiled as a 3.5 project instead o

  • AnneTheAgile
    c# com .net-3.5 late-binding early-binding
    We are having an intermittent/inconsistent problem whereby the Word COM reference (and other COM references as well) are not being recognized in the case of one user’s machine on some SVN working copies and sometimes only for Debug. In those failure cases, the build fails, complaining of “resolvecomreference task failed unexpectedly”. This is not unexpected, as VS2008 shows the yellow-triangle warning exclamation-point for each such item in the references list.I have read numerous articles on th

  • Joel Coehoorn
    .net wcf .net-3.5
    I have a wcf webservice on one of my testing servers. Everything worked fine until I upgraded frome framework 3.5 to 3.5 sp1. the wcf web service stoped working and returns the error:”Failed to invoke the service. Theservice may be offline orinaccessible. Refer to the stack tracefor details.””The remote server returned anunexpected response: (502) Proxy Error( The specified network name is nolonger available. ).Server stack trace: atSystem.ServiceModel.Channels.HttpChannelUtilities.ValidateR

  • 4 revsuser279521
    c# asp.net .net-3.5 try-catch-finally
    I am creating asp.net web apps in .net 3.5 and I wanted to know when to use and when not to use Try Catch Finally blocks? In particular, a majority of my try catch’s are wrapped around executing stored procs and populating textfields or gridviews? Would you use Try Catch EVERYTIME when you execute a stored proc and populated a data display control?My code block usually looks like:protected void AddNewRecord(){try{//execute stored proc// populate grid view controls or textboxes}catch (Exception e

  • Yaqub Ahmad
    json wcf .net-3.5 jsonp
    We have implemented the sample http://msdn.microsoft.com/en-us/library/cc716898%28loband%29.aspx. WCF service should now return JSONP. This sample also has a Test page for the client side. When we run the client web page from visual studio we can successfully get the jsonp response, however when we test the same service from jsfiddle website and some other hosted websites using js we get the unexpected semicolon issue and the callback function is not called, what could be the reason? Please note

  • Eranga
    c# linq dynamic .net-3.5
    I have a few web sites and load articles on the main page. I can set ranking on the articles to display them in different order but the ordering could be different on the various sites for the articles.The code I have to order the articles sets the same order for all sites:string officeLocation = “”;// office location could be either World, Europe, Africa, America, Asia, Pacificvar result = articles.Select(a => new{Title = a.Title,Url = a[SPBuiltInFieldId.FileRef],Byline = a[Constants.FieldNa

  • ajaylouis
    multithreading dynamic blackberry
    hi i am developing a bb 7 native APP that capable of loading image and content dynamically from url.Here is the code that i usedpackage mypackage;import net.rim.device.api.system.Bitmap;import net.rim.device.api.system.Display;import net.rim.device.api.ui.Color;import net.rim.device.api.ui.Field;import net.rim.device.api.ui.Graphics;import net.rim.device.api.ui.Manager;import net.rim.device.api.ui.UiApplication;import net.rim.device.api.ui.component.BitmapField;import net.rim.device.api.ui.compo

  • Johny Jaz
    php html web-services rest dynamic
    This question is as an extension to my previous question here: “Is this web service Restfull” to an attempt to better understand the concept of a Rest Web Service. I read almost everything there is to be read about Rest and yet i am not able to understand if a certain Web Service is Rest or not , or why its not. The way i see it , everything is and is not Rest depending on the point of view…I read in a very interesting article something that may at last make me understand what is Rest. I read

  • benjimix
    java dynamic controller compilation
    I’ve got an unusual problem (well, I think that it is unusual). I need to be able to upload an uncompiled Java source file via a web interface and have the receiving controller compile it and execute a method on that compiled class.I have come some way with it – I can upload the file, and compile it successfully. However, no matter what I try I can not load the (new) class definition and instantiate it. I keep getting java.lang.ClassNotFoundException exceptions thrown.Here is my code;String fil

  • Andras Zoltan
    c# .net dynamic
    I have a type ConfigValue that exposes a dynamic interface via an implementation of IDynamicMetaObjectProvider and custom DynamicMetaObject instance.An instance of this type can be seen, of course, as it’s native type – analogous to an XML Element – but it can also be seen as an instance of any other object type, according to the contents of the XML and what kind of object it builds (it’s a proprietary IOC built by little old me).So <value>10</value>Can be seen as a ConfigValue but a

  • Metalhead89
    java dynamic properties log4j
    I want to change the path and file name of my log4j logfile dynamically.I have read a lot of pages and nearly every tell me that I should use system properties like here: how to change the log4j log file dynamically?So my log4j.properties file looks like this:log4j.logger.JDBC_LOGGER=INFO,jdbcTests log4j.additivity.JDBC_LOGGER = falselog4j.appender.jdbcTests=org.apache.log4j.FileAppender log4j.appender.jdbcTests.File=${my.log} log4j.appender.jdbcTests.layout=org.apache.log4j.PatternLayout log4j.

  • Santosh
    sql oracle dynamic types procedure
    We have created Oracle Table type. And we have created an array of it. This is done as we dont know how many values can come which may be too much for a IN clause in sql query.–Code Snippet —–create or replace TYPE “INPUTCODE” as object (pc varchar2(100) )create or replace TYPE “INPUTCODEARR” IS TABLE OF inputcode;create or replace PROCEDURE “TEST_PROC” (testCodes IN inputcodeArr, timeHorizon IN NUMBER, p_recordset OUT SYS_REFCURSOR) AS var_sqlStmt VARCHAR2(4096); BEGIN var_sqlStmt := ‘s

  • Californicated
    c# .net c#-4.0 dynamic .net-4.0
    I am using dynamic keyword to work with an outside assembly and it works fine as far as accessing it’s methods and primitive type members are concerned. So for example my class dynamically loaded class looks like followig:public class Student {public bool IsGood { get; set; }public StudentType St { get; set; }public University University { get; set; } }I can dynamically load the object from assembly by doing something like:var assembly = Assembly.LoadFrom(“//path”);Type type = assembly.GetType(“

  • Konpon96
    c++ arrays function pointers dynamic
    In main function of my program I’ve created dynamic array with number of elements specified in variable(after calculations array is deleted):cin >> bok;double **macierz; macierz = new double *[bok]; for(int i = 0; i < bok; ++i){macierz[i] = new double[bok]; }Array macierz (matrix in Polish) is used to calculate it’s determinant with another function I’ve written:#include <iostream> #include <conio.h> #include <string> #include <math.h>double determinant(double b[

  • Rachel
    javascript dynamic combobox options
    I have a combo box with one option hard coded. I will add the remaining options dynamicallyCombo box with hard coded option:<select id=”connectionname” class=”connectionname” onchange=”display();”><option>—Select—</option></select>Javascript function to create combo box options dynamically:function showDbDlg(){var newar=new Array();try{var xhrArgs = {url: “./ReadDBDetails”,content: {MODE:”DBNAMES”}, handleAs: “text”,load: function(response) {var dbNames = response.tri

  • julian guppy
    mvc iis dynamic internet-explorer png
    I have a curious problem with IE, IIS 6.0 dynamic PNG files and I am baffled as to how to fix..Snippet from Helper (this returns the URL to the view for requesting the images from my Controller.string url = LinkBuilder.BuildUrlFromExpression(helper.ViewContext.RequestContext, helper.RouteCollection, c => c.FixHeight(ir.Filename, ir.AltText, “FFFFFF”)); url = url.Replace(“&”, “&”); sb.Append(string.Format(“<removed id=\”TheImage\” src=\”{0}\” alt=\”\” />”, url)+Environment.NewLine);Thi

  • casperOne
    android runtime andengine forceclose
    package com.embedstudios.candycat;import java.util.ArrayList;import javax.microedition.khronos.opengles.GL11;import org.anddev.andengine.engine.Engine;import org.anddev.andengine.engine.camera.CandyCamera;import org.anddev.andengine.engine.camera.hud.HUD;import org.anddev.andengine.engine.options.EngineOptions;import org.anddev.andengine.engine.options.EngineOptions.ScreenOrientation;import org.anddev.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;import org.anddev.andengine.ent

  • Juraj Olos
    android exception video runtime mediarecorder
    I have Activity with MediaRecorder which works on android 2.3.6. Now I trying it on Samsung Galaxy S2 (4.044) and mRecorder.start() give RuntimeException with all CamcorderProfiles. Its works only with 480P, but video is corrupted with lines. I tryed this solution.Camera.Parameters params = camera.getParameters(); params.setFocusMode(Camera.Parameters.FOCUS_MODE_INFINITY); params.set(“cam_mode”,1); camera.setParameters(params);But it doesn’t work. Any other solutions?Phone have flashed android,

  • Minos
    java runtime exec spaces
    Can anyone make the following run?public class ExecTest {public static void main(String[] args) {try {//Notice the multiple spaces in the argumentString[] cmd = {“explorer.exe”, “/select,\”C:\\New Folder\\file.txt\””};//btw this works//String cmd = “explorer.exe /select,\”C:\\New Folder\\file.txt\””;//and surprisingly this doesn’t work//String[] cmd = {“explorer.exe”, “/select,\”C:\\New Folder\\file.txt\””};//Update: and (as crazy as it seems) the following also worked//String[] cmd = {“exp

  • MichalB
    compiler-errors runtime native jre
    I am wokrking on my application in Eclipse IDE and suddenly I started getting such error when trying to run the app:# # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x064ed42a, pid=720, tid=5424 # # JRE version: 7.0_17-b02 # Java VM: Java HotSpot(TM) Client VM (23.7-b01 mixed mode, sharing windows-x86 ) # Problematic frame: # C [ig4icd32.dll+0x3d42a] # # Failed to write core dump. Minidumps are not enabled by default on clie

  • Stefano Ricciardi
    c# reflection properties runtime
    I am using reflection to populate the properties of an object. These properties have different types: String, Nullable(double) and Nullable(long) (don’t know how to escape the angle brackets here …). The values for these properties are coming from a dictionary of (string, object) pairs.So, for example my class has the following properties:string Description { get; set; } Nullable<long> Id { get; set; } Nullable<double> MaxPower { get; set; }(in reality there are about a dozen prop

  • Kevin Jin
    java linux bash runtime exec
    Hey guys. I’m working on a program in Java designed to be used on a Linux environment that creates a new Java process that runs another Java class, but I’m having trouble with it. I’ve finally fixed all my issues up to this. InvokingRuntime.getRuntime().exec(new String[] { “/bin/bash”, “-c”, “‘java -classpath /home/kevin/workspace/Misc/bin HelloWorld'” })in my Java program returns/bin/bash: /usr/lib/jvm/java-6-openjdk/jre/bin/java -classpath /home/kevin/workspace/Misc/bin HelloWorld: No such fil

  • mkluwe
    oop class dynamic types runtime
    Do you know programming languages where changing the class of an object at runtime is allowed (supported)?Please give a short example regarding the syntax. Give a use case, if you know any. Examples involving duck typing are welcome as well, so do not shy away from mentioning these languages.Update: I figured out that Smalltalk has changeClassTo and become. CLOS can do change-class. I found a paper suggesting to use these mechanisms to implement ‘husk objects’ that are referenced at runtime, but

  • Dynite
    c++ runtime compiler
    I am storing objects in a buffer. Now I know that I cannot make assumptions about the memory layout of the object.If I know the overall size of the object, is it acceptible to create a pointer to this memory and call functions on it?e.g. say I have the following class:[int,int,int,int,char,padding*3bytes,unsigned short int*]1) if I know this class to be of size 24 and I know the address of where it starts in memory whilst it is not safe to assume the memory layout is it acceptible to cast this

  • thinkcool
    python html runtime applescript
    I am using the following command to pass a string to python from ApplescriptString mytext contains the HTML body of an email starting with <…Applescriptdisplay dialog (do shell script “/Users/mymac/Documents/’Microsoft User Data’/’Outlook Script Menu Items’/ test.py” & mytext)Python #!/usr/bin/env pythonimport sys import stringdef main():print sys.argv[1:]if __name__ == “__main__”:main()How can I rectify this error?

  • Xavier
    javascript jquery internet-explorer runtime infinite-scroll
    I have a run time error on IE8 and IE7 and IE6 it is stating the error is in jQuery.min.js on line 31852Here is the code i have written so i believe the issue is with the infinite scroll plugin as it appends items to the document.After some further debugging it seems that the line in question is this:this.appendChild(a)From jQuery.min.js, ie is choking on this line according to the debugger tool.var $container = $(‘.section’);function getInternetExplorerVersion(){var rv = -1; // Return value ass

  • xx77aBs
    c#-4.0 asp.net-mvc-4 expandoobject
    Is it possible to convert ExpandoObject to anonymously typed object?Currently I have HtmlHelper extension that can take HTML attributes as a parameter. The problem is that my extension also needs to add some HTML attributes so I’ve use ExpandoObject to merge my attributes and attributes that user passes to the function using htmlAttributes parameter. Now I need to pass merged HTML attributes to original HtmlHelper function, and when I send ExpandoObject, nothing happens. So I guess that I need t

  • smartcaveman
    c# .net-3.5 dynamic runtime expandoobject
    How can I imitate the functionality of the ExpandoObject in a .NET 3.5 application with the least overhead? My best lead so far is to use the Lin Fu framework ( http://www.codeproject.com/KB/cs/LinFuPart2.aspx ), but I’m thinking there may be something better.To give a better idea of what I am going for here, my objective is to dynamically create the type from the parameters of a MethodInfo. So, basically I want to turn this:public class ServiceObject{public void Execute(string TransformMeInto

  • talles
    c# anonymous-types expandoobject dynamic-typing
    With dynamic we pretty much have a dynamic pointer, but not exactly a dynamic object. The true dynamic object in C# is the ExpandoObject, but that is a really unknown class for most of people. The expando allows creating and removing members at runtime, much like a hash (similar to JavaScript).Why the ExpandoObject goodness was implemented in a separate class rather than just being, let’s say, implemented as a feature of anonymous types?Maybe that wouldn’t be a good move because the lacking of t

  • Newbie

  • aravind srinivas
    c# properties dynamics expandoobject
    I want to create public object Value { get; set; }public Type Type { get; set; }public string Name { get; set; } public string “user has to give propertyname” {get;set;}at run time as per user requirement . Is it possible to do this in Csharp Using Expandos or Dynamics .I am asking that if i want to set property name in runtime linepublic string “user has to give propertyname” {get;set;} .it must be from xml r sql but i want to set property name in runtime.

  • Alex
    c# dynamic expandoobject
    I’m getting a JSON object (may contain multiple levels of JSON arrays and such) which I want to translate into an ExpandoObject.I figured out how to add simple properties to an ExpandoObject at runtime as it implements IDictionary, but how do I add nested properties (for example, something like myexpando.somelist.anotherlist.someitem) at runtime that will resolve correctly?Edit: Currently this works for simple (first level) properties well:var exo = new ExpandoObject() as IDictionary<String,

  • idlackage
    c# sql dynamic parameter-passing expandoobject
    I have some function whose prototype looks kind of like this: public void doThings(string sql, dynamic dParams);It does some kind of SQL querying with those parameters. I didn’t write it but I have to use it. It works fine when I do something like this:doThings(“select * from SomeTable where myval1=@v1 and myval2=@v2”,new{v1 = new Dapper.DbString(){Value = “yay”,IsAnsi = true,Length = 50},v2 = new Dapper.DbString(){Value = “really”,IsAnsi = true,Length = 32}});But not when I first put the dynami

  • jbtule
    c# dynamic expandoobject
    I have some code that works with ExpandoObjects populated by database calls. Invariably some of the values are nulls. When I look at the objects as an ExpandoObject, I see all the keys and values (nulls included) in the underlying dictionary. But if I try to access them through a dynamic reference, any key that has a corresponding null value does not show up in the dynamic view of the object. I get an ArgumentNullException when I try to access it via property syntax on the dynamic reference.I

  • pratap k
    c# .net dynamic expandoobject
    I have build a function:string removeFile(HttpContext context,HttpRequest r){ dynamic d = new ExpandoObject() ;d.ItemCommand = r[“itemId”].ToString();……int res = new PolicyDal().Admin_Kits_AttachFile(d); //sending here the d.on the other class/file:public int Admin_Kits_AttachFile(dynamic d){DbCommand command = _webERPDB.GetStoredProcCommand(“Admin_Kits_AttachFile”);_webERPDB.AddInParameter(command, “@ItemCommand”, DbType.String, d.ItemCommand);The following error occurs:One or more ty

  • dkackman
    c# c#-4.0 dynamic expandoobject
    I would like to dynamically add properties to a ExpandoObject at runtime. So for example to add a string property call NewProp I would like to write something likevar x = new ExpandoObject(); x.AddProperty(“NewProp”, System.String);Is this easily possible?

Web site is in building