Quantcast
Channel: .NET Framework Class Libraries forum
Viewing all 8156 articles
Browse latest View live

test


webresponse.close() blocking

$
0
0

I have some code doing http uploading/downloading. Most of the time, it works just fine. When some socket send/receive operations timed out, my code can deal with it nicely, basically, it will call webrequest.abort() in the timeout callback function, then, in the original read/write thread, the exceptions will be caught and webresponse.close() and/or stream.close() will be called. The situation will be under control and we can start over.

Once in awhile, when the read/write operation timed-out, and the code calls webrequest.abort() as usual. Then on the original socket read/write thread, the code that calls webresponse.close() or stream.close() will block, while under normal situations, those call will not block. The blocking only happens very infrequently, but it is very frustrating. I would like to know under what conditions will webresponse.close() or stream.close() calls block, so that I can make changes to my code to try to avoid that.

Thanks in advance!

Problem in background task with Control channel trigger in Windows 8.1 app

$
0
0

Hi,

I created app with control channel trigger as background task.

This is working fine in windows 8.1 desktop whenever app in background and switching from my app to other apps.

But this same behavior is not working fine in windows tab, whenever app switching the notification associated with background task is not working. And some times it throws delayed notifications.

As assumption based, is there any problem in tab to initiate the background task in suspended mode? or is there any regulations for control channel trigger using?

Expecting your feedback!!! thanks


Modular application and config files

$
0
0

Using MEF and Prism to develop a modular application.
Discovering modules with DirectoryModuleCatalog.

I find it "natural" to have separate config files for each module, after all, one module can have different implementation which requires different configuration (possibly even totally unknown for the shell assembly at design time)
Having these settings

However, this is not recommended by many, anyone knows really why ?

What is best approach ?
Both module and user scope handling is generally necessary.

Create a Shell Extension Handler thumbnail extractor with .net?

$
0
0

Hi,
My application creates nice graphics see http://www.mavericksplan.com/mavericks and it saves a custom document type.
I'd like to show the contet of the document in Explorer when the user switch to Thumbnail view.

To implement this feature I understand I need to create a Shell Extension Handler Thumbnail Extractor that extract the image from my file type to feed Explorer thumbnail vew, which is not easy at all for me.

I look on the web and I found 1 C++ example and none in C#.

Does anybody have a sample code to create a Shell Extension Handler thumbnail extractor with .net in C#?

Thank you
Andrea

user.scope settings path changed after upgrade

$
0
0

Hi I have develop a small app in c# (.net 4.0) that uses the LocalFileSettingsProvider Class to save and load settings for the user. But after the last upgrade last night I have notice that the url path

<Profile Directory>\<Company Name>\<App Name>_<Evidence Type>_<Evidence Hash>\<Version>\user.config

changes after I run the upgraded application. What I believe is being changed is the "<Evidence Type>_<Evidence Hash>"

part of the path. Since the last upgrade I have only change a few lines of code to fix a minor bug in my application and the application version. Everything else look the same so I am a little bit in the dark here. I have also tried to revert to an older version of the app and re-commit the changes again but the result was the same.

Does anyone have any clue why the above path is now being changed and causes the user settings not to get upgraded? Is the above behavior normal for the LocalFileSettingsProvider Class?

Under what circumstances does the above path get changed?

Any help is appreciated!

Regards



Unload y Show en Vbasic 2010 Express

$
0
0

Private Sub button1_Click()

Frm2.Show()

Me.Close()

End Sub

he aplicado esta propuesta. Aparentemente trabaja correctamente.

¡¡¡SOLO QUE LA Frm2.Show() DESAPARECE AUTOMATICAMENTE CUANDO SE EJECUTA Me.Close()!!!

O sea, que ambos formularios se descargan en el momento en que se ejecuta Me.Close().

VB Load/Unload Forms

$
0
0

Private Sub button1_Click()

Frm2.Show()

Me.Close()

End Sub

He aplicado esta propuesta. Aparentemente trabaja correctamente.

¡¡¡SOLO QUE LA Frm2.Show() DESAPARECE AUTOMATICAMENTE CUANDO SE EJECUTA Me.Close()!!!

O sea, que ambos formularios se descargan en el momento en que se ejecuta Me.Close().

¿Qué debo hacer?

JoeInvestiga


ASP.NET MVC5 (reference issue)

$
0
0

Hi ,

MVC5 was known to be released with Visual studio 2015, after we installed VS2015, where can I find the "System.Web.MVC.dll" version 5.0.0?

For all the previous version for MVC were in the folder "Program Files (x86)\Microsoft ASP.NET\ASP.NET MVC X", and we can find the DLL from extensions in add reference dialog, but MVC 5.0 was not there.

 So could you please tell me how to migrate the MVC reference(4.0 to 5.0) during migrating projects(vs2013 to vs2015)?

Thanks a lot!

Implicit and explicit Type conversion using Type object in heap

$
0
0

Hi,

I am surprised how Implicit and explicit Type conversion works using Type object in heap. for example when implicit type conversion occur what pointer it returns to object and similarly with explicit type conversion.

Can't find SerialPort in .NETMF 4.1

$
0
0

Dear all,

I try to use serialPort with .NETMF 4.1 for build a software with FEZ PAndaII.

"using System.Threading;
using System.IO.Ports;

using Microsoft.SPOT;
using Microsoft.SPOT.Hardware;
using Microsoft.SPOT.Hardware.SerialPort;<-THIS DON'T EXIST in Microsoft.SPOT.Hardware and I need to use

using GHIElectronics.NETMF.FEZ;
using GHIElectronics.NETMF.Hardware;

"

What I must do?

Thank You very much,

Francesco

Web request fails, but only for localhost and when using System.Net.HttpWebRequest

$
0
0

I've got a very weird problem with System.Net.HttpWebRequest, that's driving me nuts: When I run it with a localhost address, then it is either extremely slow (around 30 sec) or, in most cases, it times out entirely. This happens only with requests that target localhost, and only from C# code.

Concretely, taking an ASP.NET Web API project as an example, when I have this code:

[Test]publicvoidTestRequest(){var request =WebRequest.Create("http://localhost:64497/api/values");WebResponse response = request.GetResponse();}

..it will most of the time fail with this exception:

System.Net.WebException:Unable to connect to the remote server---->System.Net.Sockets.SocketException: A connection attempt failed because the connected party did not properly respond after a period of time or established connection failed because connected host has failed to respond 127.0.0.1:64497

By inspecting the .NET code, I tracked down the error to the WSAConnect API returning non-null value, but I can't see that this is of much help. (However, this is a 32bit API, whereas I'm running on a 64bit system. Could there be some strange 32/64bit problem?)

When I run the above code with an address other than localhost (say http://www.google.com), then it behaves normally and I get response times around 1 sec. Also, when I submit the above request from a different client (I used Chrome's Advanced REST Client), then I get the normal behaviour: A delay time of about 5-8 sec for the first request due to initial compilation, and very short response times (20-40 msec) for all subsequent requests.

Given these findings, it seems quite obvious to me that the problem must come from something that's specific to the implementation of the System.Net.HttpWebRequest class...

The web application itself is hosted on IIS Express, but I'm quite sure that this is irrelevant, since the the above request never reaches the web server (I checked that both by running IIS Express from the command line and then inspecting the request coming through and also per ProcessMonitor).

Further information: I'm running Win 8.1 64bit and VS 2013 SP4 pro. The system's HOST file is unmodified, i.e. it does not contain any entries.

Things I've tried so far:

  • Running VS in admin mode
  • setting proxysettings explicitly to null, both per code and per configuration
  • inspecting the IIS Express process per ProcessMonitor - no result (as I said, I'm quite sure that the Web server is not directly involved in this problem)
  • changing localhost to 127.0.0.1

I don't understand what the problem is, and I can't find any relevant info on the web. I don't even have any more ideas what I could try to track down the error. In other words: I'm totally stuck on this, and it effectively prevents me from writing any integration tests against locally hosted webs. Any help/hint/tip is highly appreciated.


LoadFrom() to pick From my Path

$
0
0

Hi all

how can i make LoadFrom() to Pick Dll's from my given Path to it rather than GAC.

with regards,

vishnu k.


vishnu

Application shortcut causes reinstall/repair of application....

$
0
0

I'm working with an application (win 7, vb.net) and I'm trying to work around some odd behavior of my application shortcut. Here is a summary of the problem:

My app installs and places a shortcut on the Desktop.
I go into my application's directory and modify any files.
Go back to the Desktop shortcut and click on it.The application appears to perform a reinstall/repair and will replace any files I have modified.

I need to figure out what is causing this and how I can fix my application or shortcut so I can stop this behavior.
If I re-create a new shortcut, from the executable, I do not see that behavior but I don't want to have to create a new shortcut in this case.

Thanks. 

Download UI Spy (UISpy.exe)

$
0
0

Hi ,

Currently I'm looking for UI Spy for UI automation latest version and where to download it. Your help is very appreciated.

Regards

Hash007

 


VISA COM 3.0 Type Library can not be used in .NET Framework 4.5

$
0
0

Hi Friends:

When wrote my code I used a DLL file named VisaComLib.dll from NI. I used two classes, the first one is "Ivi.Visa.Interop.ResourceManagerClass",the second is "Ivi.Visa.Interop.FormattedIO488Class", namespace is "using Ivi.Visa".

My problems is that the code rans well when I used .NET Framework 3.5(please see the picture blow)

But when I exchanged the framework from .NET3.5 to .NET4.5, the classes can not be used(plesae see blow picture)

The programe of IVI.Visa.Interop.ResourceManagerClass is like blow code:

#region 程序集 Ivi.Visa.Interop.dll, v5.0.0.0
// C:\Program Files\IVI Foundation\VISA\VisaCom\Primary Interop Assemblies\Ivi.Visa.Interop.dll
#endregion
using System;
using System.Runtime.InteropServices;
namespace Ivi.Visa.Interop
{
    [ClassInterface(0)]
    [Guid("DB8CBF1C-D6D3-11D4-AA51-00A024EE30BD")]
    [TypeLibType(2)]
    public class ResourceManagerClass : IResourceManager3, ResourceManager, IResourceManager
    {
        public ResourceManagerClass();
        [DispId(1610678275)]
        public virtual int ComponentVersion { get; }
        [DispId(1610678274)]
        public virtual string Description { get; }
        public virtual int IResourceManager_ComponentVersion { get; }
        public virtual string IResourceManager_Description { get; }
        public virtual string IResourceManager_ProgID { get; }
        public virtual short IResourceManager_SoftwareManufacturerID { get; }
        public virtual string IResourceManager_SoftwareManufacturerName { get; }
        public virtual int IResourceManager_SpecVersion { get; }
        [DispId(1610678276)]
        public virtual string ProgID { get; }
        [DispId(1610678273)]
        public virtual short SoftwareManufacturerID { get; }
        [DispId(1610678272)]
        public virtual string SoftwareManufacturerName { get; }
        [DispId(1610678277)]
        public virtual int SpecVersion { get; }
        public virtual string[] FindRsrc(string expr);
        public virtual string[] IResourceManager_FindRsrc(string expr);
        public virtual IVisaSession IResourceManager_Open(string ResourceName, AccessMode mode = AccessMode.NO_LOCK, int openTimeout = 2000, string OptionString = "");
        public virtual void IResourceManager_ParseRsrc(string ResourceName, ref short pInterfaceType, ref short pInterfaceNumber, ref string pSessionType);
        public virtual IVisaSession Open(string ResourceName, AccessMode mode = AccessMode.NO_LOCK, int openTimeout = 2000, string OptionString = "");
        public virtual void ParseRsrc(string ResourceName, ref short pInterfaceType, ref short pInterfaceNumber, ref string pSessionType);
        public virtual void ParseRsrcEx(string ResourceName, ref short pInterfaceType, ref short pInterfaceNumber, ref string pSessionType, ref string pUnaliasedExpandedResourceName, ref string pAliasIfExists);
    }
}

I want to use the two classes in .NET Framework  4.5 , how should I do?

Please help me, thank you so much.

Best Regards

Daniel

Unmanaged VC++ DLL in VS2010

$
0
0

Hi,

I have a C# desktop application that talks to a C++ DLL through a COM Interop.
I am currentlly modifying the C++ DLL which makes use of MFC. The code was initially written in VC++ 6.0. I have upgraded the same to VS2010.
The exported class contains many std::string private variables. Whenever I assign a CString value to these variables, I get the exception -
"An unhandled exception of type 'System.AccessViolationException' occurred in XXX.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."

I tried passing in wide-char (CStringW to std::wstring), unchecked/checked 'Suppress JIT optimization on module load (Managed only) but the error keeps coming unchanged.

The error is very inconsistent. It occurs sometimes on the first assignment, sometimes somewhere in the middle & sometimes in the end.

How am I supposed to resolve this? Please help me. I need to resolve this ASAP. 

Thanks..


ReportingService2005 keep db connection open

$
0
0

I have project that uses ReportingService2005 and I try write tests for this project. There are some test which testing part where using ReportingSevice. After all test I have method that restore database from backup for saving original state.

The problem is reportingservice keep use database and I cannot restore it. I tried send command to mssql service close all connection directly. Now I can restore db, but I have another problem: when I start tests again, ReportingService try use closed connection and throw exception.

After that I tried just restart ReportingService before restore db. It help, but it is unsuitable solution.

Any guess how to resolve it? I want have possibility to restore db AND I don't want to restart Reporting service.

Thanks, Igor.

Where does HWND information i mean in which path it looks for

$
0
0

HI,

I using the below code to get information of a webcontrol into the ControlInfo*

 ::SendMessage(hWebControl, WM_GETCONTROLINFO, 0, (LPARAM) pInfo);

From which Path does it Gets the Required Info.?


vishnu

PropertyInfo does not contain a definition for 'GetCustomAttribute' ?

$
0
0

Hello,

I inherited a .Net 4 Asp.net web application . I did a build and got the error below. According to MSDN, PropertyInfo doesn't have a GetCustomAttribute method. (It does have aGetCustomAttributes method). Am I missing a extension method? Or using wrong version of .net framework? Thanks, Peter

xxx= property.GetCustomAttribute<JsonPropertyAttribute>();

Error 1 'System.Reflection.PropertyInfo' does not contain a definition for 'GetCustomAttribute' and no extension method 'GetCustomAttribute' accepting a first argument of type 'System.Reflection.PropertyInfo' could be found (are you missing a using directive or an assembly reference?) C:\projects\DotNetDemo\WebSite\CreateIncident.aspx.cs 357 

Viewing all 8156 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>