.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal
Post New Web Links

Bug in System.Random [ .Net Framework 4 ]

Posted By:      Posted Date: September 18, 2010    Points: 0   Category :ASP.Net
Hi all, try this code below:var rand = new Random(); while (rand.Next(minValue: 0, maxValue: 5) < 5) { /* do something */ } // causes block forever // this line is never called Is it a bug???

View Complete Post

More Related Resource Links

Mutant Power: Create A Simple Mutation Testing System With The .NET Framework


With mutation testing, the system under test is changed to create a faulty version called a mutant. Here James McCaffrey explains how to do this in .NET.

James McCaffrey

MSDN Magazine April 2006

System.InvalidOperationException: Internal .Net Framework Data Provider error 12.



I have created an application in which there are few forms. Each form has fields which are linked to a backend table/tables. My application is supposed to be accessed by multiple users concurrently. I ran a test where I created a class file in windows application and i ran a for loop in it to call the url of my application. I wanted to test the effect of firing around 200 queries to my query engine.

The test code is :

namespace MachineGun


static class Program


/// <summary>

/// The main entry point for the application.

/// </summary>


Random errors with the clr.dll 4.0.30319.1 after update to .NET Framework 4.0



After updating to .NET Framework 4.0 we have got some random crashes in our production environmnent.

We get a error in clr.dll but having problem to finding the root error. Do you have some tips and tricks?

The event logg looks like this:


Event Type: Error

Event Source: .NET Runtime 4.0 Error Reporting

Event Category: None

Event ID: 1000

Date: 10/8/2010

Time: 12:45:08 AM

User: N/A

Computer: [The Computer]


Faulting application [TheApplication.exe], version, stamp 4c934361, faulting module clr.dll, version 4.0.30319.1, stamp 4ba1d9ef, debug? 0, fault address 0x00003e54.


For more information, see Help and Support Center at http://go.microsoft.com/fwlink/events.asp.


0000: 41 00 70 00 70 00 6c 00   A.p.p.l.

0008: 69 00 63 00 61 00 74 00   i.c.a.t.

0010: 69 00 6f 00 6e 00 20 00   i.o.n. .

0018: 46 00 61 00 69 00 6c 00   F.a.i.l.

0020: 75 00 72 00 65 00 20 00   u.r.e

I can't find System.Xaml in framework 3.5



I install vs2010 first in my system , and i used vs2010 to build one solution create by vs 2008 which was build and run very well, but there are some error. and days  later, i install vs 2008, try to rebuilt it using vs 2008, but it warms that System.Xaml was missing, I can only find a image in the folder of framework 4.0, and can't find one in the folder 3.5. I try to add reference path of 4.0 to projects, but just got more warns and the solution can be built through.

How can solve this issue?



Do I need to keep multiple versions of the .NET Framework installed in my system?


I realize that this may sound like a bit of a dumb question, but here goes anyway...

 Several months ago, I downloaded and installed the Visual Basic trial thinking that that was the program that I needed.  As it turns out I have decided farm this part of my project out to a professional, rather than spending countless hours frustrated with attempting to do it myself.  At the time that I installed Visual Basic I was asked to .NET Framework 2.0  I have since installed two updates, version 3.0 & 3.5.  These programs are quite memory intensive and take up a great deal of hard drive space!  I am currently running WinXP on my Intel-based MacBookPro under Bootcamp.  Unfortunately, the way that the original Bootcamp beta version partitioned my hard drive, it only allows for 32 GB of my hard disk to be allocated to running WinXP This includes any & all applications, documents, etc... that you would by definition have on your computer!  As it stands currently, the .NET Framework applications are occupying 0.5 gigabytes of my hard drive.

Do I need to keep version 2.0 as well as versions 3.0 and 3.5?  Also, since I had no longer using Visual Basic, do I even need to keep the .NET framework on my system at all?

Thank you so much for your help!!!


system.web missing from compact framework

Any ideas how I can use this framework? for windows phone 7

Why is the "System" Process opening and keeping the port open for my .NET remoting framework applica


I'm using Remoting in a .NET 3.5 framework application of mine (running on windows 2008 r2). I'm opening port 8086 with the following code

BinaryServerFormatterSinkProvider serverProv = new BinaryServerFormatterSinkProvider();
      serverProv.TypeFilterLevel = System.Runtime.Serialization.Formatters.TypeFilterLevel.Full;

      BinaryClientFormatterSinkProvider clientProv = new BinaryClientFormatterSinkProvider();
      IDictionary props = new Hashtable();

        props["port"] = 8086
        TcpChannel channel = new TcpChannel(props, clientProv, serverProv);
        ChannelServices.RegisterChannel(channel, false);
          typeof(Remote), "Remote", WellKnownObjectMode.Singleton);
      catch (Exception ex)
        logger.Error("Failed to intialize service remoting: ", ex);

For some reason, when i restart my windows service that has the above code running, it throws an exception saying that "Only one usage of each socket address (protocol/network address/port) is normally permitted". Digging into this a little deaper it turns out that "System" process is holding on to my port and it won't let it go. Even if i kill my process, the "System" process still owns the port.


Odd Behavior in System.Reflection.Emit APIs (.NET Framework 3.5 SP1)

I've noticed an issue during generation of a dynamic assembly to a secondary app domain. The code I'm using to start the assembly looks fairly typical, but it somehow allows the dynamic assembly to be loaded twice into the targeted app domain.

string assemblyName = "MyAssembly";
string moduleName = "MyAssembly.dll";
string typeName = "MyType";
AssemblyName assemblyFullName = new AssemblyName(assemblyName);
AssemblyBuilder assemblyBuilder = AppDomain.CurrentDomain.DefineDynamicAssembly(assemblyFullName, AssemblyBuilderAccess.Run);
ModuleBuilder module = assemblyBuilder.DefineDynamicModule(moduleName);
Upon further inspection, I used code to print the list of assemblies actually loaded into the current app domain (that was how I first noticed the issue above). Also, I inspected the condition of the domain using the AssemblyLoad event, and it confirmed that the assembly was loaded twice. Using that approach, I was able to step into the event handler for each load of the dynamic assembly on the AssemblyBuilder and ModuleBuilder lin

Multiple database support with Entity Framework

One of the features introduced in Entity Framework is being database independent. Which mean each database provider can support Entity Framework by implementing its provider.

This feature allows you build applications independent from the underplaying database provider. In this post I'm going to show how to build an application that support multiple databases using same conceptual model made by Entity Framework.

Creating a Generic Entity Framework 4.0 Repository

With .NET 4.0 right around the corner, I thought it would be cool to download Visual Studio 2010 beta 2 and start playing around with the next release of Entity Framework.

The initial release of Entity Framework came with a great deal of criticism. To make matters worse, there was a large uproar when it was rumored that Microsoft would be abandoning LINQ to SQL, in favor of Entity Framework. This was because, at the time, many developers felt Entity Framework was an inferior technology to LINQ to SQL. To set things right, Microsoft proactively moved forward with improving Entity Framework, in time for the 4.0 release of the .NET Framework. This is good news because my initial impressions, so far, have been nothing but positive.

ASP.NET 4.0 Dynamic Data and Many to Many Entity Framework Entities

I did not play much with Dynamic Data controls in VS2008 and just made a cool discovery in VS2010 Beta 2. This may not even be new, but as I'm sitting 30,000+ feet over the Atlantic ocean, I don't have access to VS2008 at the moment to check.

System Development Life Cycle

The Systems Development Life Cycle (SDLC) is a conceptual model used in project management that describes the stages involved in an information system development project from an initial feasibility study through maintenance of the completed application. Various SDLC methodologies have been developed to guide the processes involved including the waterfall model (the original SDLC method), rapid application development (RAD), joint application development (JAD), the fountain model and the spiral model. Mostly, several models are combined into some sort of hybrid methodology

The Agile System Development Life Cycle (SDLC)

The goal of this article is to describe the agile system development life cycle (SDLC), putting it in context from what you may have heard about within the agile community and more importantly within the context of your overall IT efforts.

Performance Tests: Precise Run Time Measurements with System.Diagnostics.Stopwatch

Everybody who does performance optimization stumbles sooner or later over the Stopwatch class in the System.Diagnostics namespace. And everybody has noticed that the measurements of the same function on the same computer can differ 25% -30% in run time. This article shows how single threaded test programs must be designed to get an accuracy of 0.1% - 0.2% out of the Stopwatch class. With this accuracy, algorithms can be tested and compared.

Generate Random Numbers

SQL Server has a built-in function that generates a random number, the RAND() mathematical function. The RAND math function returns a random float value from 0 through 1.

Entity Framework 4 Tips for WinForms Development

I've been recently working on a smart client (WinForms) application backed by Entitiy Framework 4 (EF4) on Visual Studio 2010. In this blog post I will try to give you some tips regarding some limitations and points to be careful about EF4.

Bar Code Scanners with the .NET Compact Framework

Summary: Learn how to make your applications use bar code scanners in a generic way-ndependent of the specific bar code scanners that are used on different devices. Using the design patterns Façade and Factory, the implementation not only supports multiple bar code scanners, but it also makes it easy to add support for other bar code scanners. After a brief discussion about bar code scanners and the bar code scanner pattern, a download code sample, written in C#, demonstrates the use of the pattern and technologies.
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  Silverlight  Others  All   

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend