Showing posts with label Microsoft Bugs. Show all posts
Showing posts with label Microsoft Bugs. Show all posts

Saturday, June 4, 2016

UnHandled Microsoft .Net Framework Exception occured in visual studio devenv.exe in design mode forces visual studio to close (Microsoft Bug)

In this post we are going to see a error which forces the development environment crashes and  close because of user code and makes the developers to stand in a some crucial situation.



Click Here to see bug info
https://connect.microsoft.com/VisualStudio/feedback/details/2769909/an-unhandled-microsoft-net-framework-exception-occured-in-devenv-exe-in-design-mode-of-winforms-forces-the-visual-studio-to-close














    Normally Development environment DevEnv.exe is used to develop the code which needs to run in windows Machines , ya it is Visual studio exe. The purpose of this Development environment is used to give a users a sophisticated way for development like Giving intellisense, showing performance reports, Exeception handling like capturing the errors , notifying to users in run time as well as in design time. In some cases it is fails Let we see the cases where it is failed


Example Design time errors capture in Component in Visual studio while development









     Developing a component is usually a good idea in a application, because we can add anything to the control what ever we thought, like wise developing we have to check each and every stage of that control by dragging it in to Form and see the appearance and properties.After finishing the development we will run the Form and see the visual appearance of the control in the UI.



     When i am developing a custom control , when i tried to drag and drop and see the UI, it looks good . Then later again i changes something in the  Control. Now i got an error says "Not implemented" in the  control which is placed on the form, Then i implemented that functionality, Then again the control in the UI, shows another error in design time like Null Reference, again i implemented that steps for the Control, Again it works correctly, so whenever we design a control development environment visual studio will capture the design time errors and show it in Control itself in design.








    But in this case Now the Form Freezes and closes after a certain time, again when ever i open the form which have that custom control crashes the DEvEnv.exe. I get wondered how The development can gets crashes for a user code which is in development mode, because devenv.exe will capture the design time errors and show it in UI, because then only developers can develop the thing in that development editor , that is the purpose of that editor.









     When the UI freezes , it launches a pop screen with  a message that An UnHandles Microsoft .Net Framework Exception occured in devenv.exe in design mode of winforms, Ya here i am using the Winforms as platform.







            I raised a issue to microsoft , i know that my code is buggy, because it is still under development, but how editor gets closed for used buggy code in development, if it is runtime it is acceptable because we are running in CLR, but in design editor should handle everything and shows it to users













 


  After raising the issue i got a feed back from microsoft like below, it is ideally should not crash visual studio but happening in this case, they are saying cases for unhandling the exceptions.



Click Here to see bug info
https://connect.microsoft.com/VisualStudio/feedback/details/2769909/an-unhandled-microsoft-net-framework-exception-occured-in-devenv-exe-in-design-mode-of-winforms-forces-the-visual-studio-to-close

















Note : 
We cant rely on users code to be correct while developing or in design mode, because it is under changes, so devenv.exe should capture the errors in design mode and show in control in design mode, if it is runtime or running the app we can say that we are rely on users code to be correct for stack overflow exceptions .... 




From this post you can see a Microsoft Bug which persists in visual studio , which is an unhandled exception





Saturday, December 14, 2013

Microsoft Bug - WebPage Keep on Rendering in IE but result in launching in Google Chrome

In this article we are going to see some of the different behavior that i have faced while working in ASP.NET, so i am going to share my experience based on ISSUE.

click here to see the details for bug
IE keep on Rendering the webpage

A webpage is keep on  rendering on the IE but not results in the view of the page, even if i launch the webpage in new session it result the same , but if i given the link in Google Chrome it result in Rendering the Webpage soon.

How a browser rendering the webpage is differs, Whether IE follows the visual studio code logic or based on Web standarad Rendering ? because why i have this doubt is the link is rendering correctly other browsers. How the webpage is rendering in the Google Chrome correctly with out keep on rendering .





In this article , i thought to share some problem i have faced in IE. i think it is understandable by everyone. 

Microsoft Bug - In Threading Value pass to each thread is sharing correct value is not receive on thread calling method

Hi In this article we are going to see some critical stuff in Microsoft Dot net Framework, few months back while i am testing a application. I framed a scenario in working , in that scenario i first uses the for each loop to do the work then i thought to change to for loop in C# 5.0 , The funniest thing is when you see logically both the loop are code in the same manner but the result in behavior is different and seems like Bug. so i tried in C# 4.0 version both the For each and For loop are not working in the same scenario. When i say about this to Microsoft they said like the C# compiler is designed like that from the beginning itself. they gave the work around like declare the temp variable to avoid the issue and work in expected manner. but the programmer will always concentrate on the logical thing not the work around things. The Programmer doesn't need to handle the life cycle of thread variable it should be handled by C# compiler Engine.Now let we see the Bug in detailed. 

If the C# 5.0 have a functionality of For each to work correctly then it should work same as For loop, because both are not working in C# 4.0 . so loop must work same for For and ForEach

Click the Link for Bug report details
In Threading Value pass to each thread is sharing

In Threading Value pass to each thread is sharing between the threads so correct value is not receive on thread calling method 


What is happening is we see in this in Example

static Semaphore sem = newSemaphore(3, 3);

                 static voidMain(string[] args)
                 {

                         for (int i = 0; i < 11; i++)
                         {
                                 Thread sp= new Thread(() => RunTest(i));
                                 sp.Start();
                         }
                 }

         [MethodImpl(MethodImplOptions.Synchronized)]
         static void RunTest(int f)
                 {
                         try
                         {
                                 Console.WriteLine(f.ToString());
                                 sem.WaitOne();
                                 Console.WriteLine("Thread "+ Thread.CurrentThread.ManagedThreadId);
                                 if (f % 2 == 0)
                                 {
                                            Console.WriteLine("7 sec");
                                            Thread.Sleep(7000);
                                 }
                                 else
                                 {
                                            Console.WriteLine(" 14 sec");                                                                 Thread.Sleep(14000);
                                 }
                         }
                         finally
                         {
                                 sem.Release();
                         }
                 }




Now in the above sample i am calling a Method from the thread but the method have a input parameter which is supplied from the for loop so now when a for loop executes each and every time input parameter changes , but when you print value in the called method value is repeating 


Expected output :
0,1,2,3,4,5,6,7,8,9,10

Actual Output:
0,1,2,2,2,5,6,6,6,8,10

So how to avoid this problem from Microsoft side there are saying that this C# compiler is designed like that so developers has to declare a temp variable to hold the value like below sample to avoid the error.


static Semaphore sem = new Semaphore(3, 3);

                 static void Main(string[] args)
                 {

                         for (int i = 0; i < 11; i++)
                         {
                                 int x=i; // New statement declared
                                 Thread sp= new Thread(() => RunTest(x));
                                 sp.Start();
                         }
                 }

         [MethodImpl(MethodImplOptions.Synchronized)]
         static void RunTest(int f)
                 {
                         try
                         {
                                 Console.WriteLine(f.ToString());
                                 sem.WaitOne();
                                 Console.WriteLine("Thread " + Thread.CurrentThread.ManagedThreadId);
                                 if (f % 2 == 0)
                                 {
                                            Console.WriteLine("7 sec");
                                            Thread.Sleep(7000);
                                 }
                                 else
                                 {
                                            Console.WriteLine(" 14 sec");                                                                 Thread.Sleep(14000);
                                 }
                         }
                         finally
                         {
                                 sem.Release();
                         }
                 }

Now in this one question if the C# compiler is behave like this , developers has to kept in mind that they have  to declare the temp variable while code the thread , that is not a rule specified in any OOPS concepts even there is no problem like this in Java Thread sharing a variable. But Microsoft changes the Foreach behavior in the C# 5.0 but have issue in C# 4.0 if they stated that is not a issue then why they change the Behavior of foreach in newer version below sample have issue in C# 4.0 but works  correctly in C# 5.0

In Foreach Loop

 void call(string[] args)
        {
            var runningnumbers = Enumerable.Range(1, 10);
            List<Action> procaction = newList<Action>();
            foreach (var item inrunningnumbers)
            {
                Action lambda = () =>
                {
                    var result = 2 +10 + item;
                    Console.WriteLine(result);
                };
                procaction.Add(lambda);
            }

            foreach (var work inprocaction)
            {
                work();
            }
            Console.Read();
        }




Solution

Expected output :
13
14
15
16
17
18
19
20
21
22

Actual Output:
22
22
22
22
22
22
22
22
22
22

but this problem is solved in C# 5.0 in ForEach loop,


From this article you can learn some of the basic things in C# and how to get the required output while developing from the global oops concepts.


Thursday, December 12, 2013

JQuery Bug in Attr() function replace with Prop() function

This article reveals about the some Jquery function usage and the bug present in it, and how to resolve the bug and get the solution what we need ?


I have decide to do a some Test in Jquery by a sample having a TextArea and a checkbox. when i scroll the textbox from the top  to the bottom , checkbox should be enabled and checked, It the user scrolls upwards then automatically checkbox should be disabled and unchecked. To do this we are code it in Scroll function of text area like below


HTML:


<html>
<head>

    <title></title>
    <link  rel="Stylesheet" href="StyleSheet1.css" />
    <script type="text/javascript"src="jquery-1.9.1.intellisense.js">
    </script>
    <script type="text/javascript"src="jquery-1.9.1.js">
   </script>   
   <script type="text/javascript"src="jquery-1.9.1.min.js">
    </script>


<script type="text/javascript" >

    $(document).ready(function () {

        $('#agree').attr('disabled', true);
        $('#agree').attr('checked', false);


        var scrollheight = $('#area')[0].scrollHeight;
        var innerheight = $('#area').innerHeight();

        $('#area').scroll(function() {


            var scrollposi = $(this).scrollTop();

            var remaim = scrollheight - innerheight;
            $('#feed').text(Math.ceil(remaim));
            // alert(scrollposi);
            if (remaim <= scrollposi) {

                $('#agree').attr('disabled', false);
            }
            else {

                $('#agree').attr('disabled', true);
            }

        });


    });
</script>


</head>
<body align="center">
<div id="feed">dd</div>
<textarea id="area" cols="50" rows="30">
<!-- <textarea id="terms" rows="20" cols="50"> -->
<p>YouTube was founded by Chad Hurley, Steve Chen, and Jawed Karim, who were all early employees of PayPal.[7] Hurley had studied design at Indiana University of Pennsylvania, and Chen and Karim studied computer science together at the University of Illinois at Urbana-Champaign.[8]
According to a story that has often been repeated in the media, Hurley and Chen developed the idea for YouTube during the early months of 2005, after they had experienced difficulty sharing videos that had been shot at a dinner party at Chen's apartment in San Francisco. Karim did not attend the party and denied that it had occurred, but Chen commented that the idea that YouTube was founded after a dinner party "was probably very strengthened by marketing ideas around creating a story that was very digestible".[9]
Karim said that the inspiration for YouTube came from Janet Jackson's role in the 2004 Super Bowl incident, when her breast was exposed during her performance, and from the 2004 Indian Ocean tsunami. Karim could not easily find video clips of either event online, which led to the idea of a video sharing site.[10] Hurley and Chen said that the original idea for YouTube was a video version of an online dating service, and had been influenced by the website Hot or Not.[11][12]
</p>
</textarea>
<p><input type="checkbox" id="agree"  /> : Agree</p>
</body>
</html>




Now the Bug is when you scroll down and reaches the last position of scroll checkbox is checked and when you move up the checkbox is disabled and unchecked . But when you scroll again second time to the last position of scroll the checkbox is not enabled. Because attr function is not working in JQuery version above 1.9 but working in below version it can be resolve by replace with prop functiopn


       $('#area').scroll(function () {


            var scrollposi = $(this).scrollTop();

            var remaim = scrollheight - innerheight;
            $('#feed').text(Math.ceil(remaim));
            // alert(scrollposi);
            if (remaim <= scrollposi) {

                   $('#agree').prop('checked'true);
            }
            else {

                  $('#agree').prop('checked'false);
            }

        });


              

Change in the function attr to prop makes the functionality to work correctly.This bug may be fixed in the future versions


I hope this article will make you to aware of using correct functions in JQuery.


Sunday, November 3, 2013

Microsft Bugs - Sql Server

      In This article we are going to see a sample bug in microsoft. In the past few years i had face so many Microsoft Bugs, So many bugs are identified both in Front language [C#,asp.net] as well as Backend [Sql server] while i am doing my job, Now from that list i am going to share one of the interesting bug and that can be understand by every one. Which is present in DB Sql Server side.

    I am working in Sql Server so many times, but when a two or three tasks are combined and wrote a batch script i came across this issue.


Bug 1 :

We are all knew the How to create User Defiend Datatype and TableValued function in Sql server.

Now the issue is related to this , If we create a Both the things under a same transaction result in error as Transaction deadlock

Sample Code :



BEGIN TRANSACTION etran
go

CREATE TYPE [dbo].T_GUID FROM VARCHAR(128) NOT NULL
go

CREATE FUNCTION fn_details
(   
@ID    VARCHAR(128)    ,
@CUSTOMERID    VARCHAR(128)   
)
RETURNS @RETVALUE TABLE
(
PP_GUID    T_GUID
)
BEGIN    

DECLARE@QUERY    NVARCHAR(MAX)
DECLARE@TASKS    NVARCHAR(MAX)

RETURN
END

Error:

Msg 1205, Level 13, State 55, Procedure fn_details, Line 7
Transaction (Process ID 53) was deadlocked on lock resources with another process and has been chosen as the deadlock victim. Rerun the transaction.

link to see the Bug : Error in Create a Function


Bug 2:

A another interesting bug in sql server, i have faced is Loss of data in DB, When we make change tracking enable in  DB and tracking the changes and make suddenly switch off the system. Results in loss of data there is no data in change tracking once you execute the query to fetch the data from the sql server

link to see the Bug : Loss of Data


Still more there in front end language bugs existed, but these are could not resolve easily some of the bugs are violation of  Technology rules specified that are works well in Java.But Microsoft says a work around to work the code to be  like expected but that is not a rule to be kept in mind while programming.