Click here to Skip to main content
15,867,686 members
Home / Discussions / Design and Architecture
   

Design and Architecture

 
GeneralRe: Implementing Google Contacts in WPF App Pin
Kevin Marois14-Dec-22 10:22
professionalKevin Marois14-Dec-22 10:22 
GeneralRe: Implementing Google Contacts in WPF App Pin
Gerry Schmitz15-Dec-22 8:07
mveGerry Schmitz15-Dec-22 8:07 
GeneralRe: Implementing Google Contacts in WPF App Pin
Kevin Marois15-Dec-22 12:27
professionalKevin Marois15-Dec-22 12:27 
GeneralRe: Implementing Google Contacts in WPF App Pin
Gerry Schmitz15-Dec-22 16:30
mveGerry Schmitz15-Dec-22 16:30 
GeneralRe: Implementing Google Contacts in WPF App Pin
Kevin Marois15-Dec-22 18:15
professionalKevin Marois15-Dec-22 18:15 
GeneralRe: Implementing Google Contacts in WPF App Pin
Gerry Schmitz16-Dec-22 2:06
mveGerry Schmitz16-Dec-22 2:06 
AnswerRe: Implementing Google Contacts in WPF App Pin
jschell20-Dec-22 13:34
jschell20-Dec-22 13:34 
QuestionI have a really strange problem with WebRequest in a ServiceStack web application (hosted by XSP on Mono). It seems that the registration of request modules works in a very strange way; I am using WebRequest to create an HTTP request, and it is faili Pin
Isaac Tack12-Dec-22 1:20
Isaac Tack12-Dec-22 1:20 
I have a really strange problem with WebRequest in a ServiceStack web application (hosted by XSP on Mono). It seems that the registration of request modules works in a very strange way; I am using WebRequest to create an HTTP request, and it is failing because it was not able to find a creator for that "prefix" (HTTP).

The exception I am seeing is NotSupportedException, and I was able to track it to the fact that no creator is registered for the HTTP prefix (I am hitting https://github.com/mono/mono/blob/master/mcs/class/System/System.Net/WebRequest.cs, around line 479)

EDIT: more details: NotSupportedException is thrown by WebRequest.GetCreator, which uses the URL prefix as a key to choose which creator to return; in my case, a HttpRequestCreator. The exception is thrown because there is no creator registered for the "HTTP" prefix (actually, there are no creators at all).

So I searched around a little bit, dug into Mono sources, and found that modules are (or should be) added to the webRequestModules section of system.web in one of the various *.config files.

I looked at my machine.config file, and there it is:

System.Net.HttpRequestCreator, System, Version=4.0.0.0
Looking at WebRequest Mono sources it seems that prefixes are added from configuration(s) inside the class static constructor (not a good choice, IMHO, but still.. it should work).

To test it, I tried to add an HttpRequestCreator to system.net/webRequestModules in my web.config; this is loaded by XSP/Mono and results in a duplicate key exception (which is expected since HttpRequestCreator should be already loaded, as it is already present in machine.config).

Even stranger: if I add a mock handler for Http, like this:

bool res = System.Net.WebRequest.RegisterPrefix ("http", new MyHttpRequestCreator ());
Debug.Assert (res == false);
The assertion sometimes pass... sometimes not! (RegisterPrefix returns "false" if a creator for the same prefix is already registered; I expect it always to return false, but this is not the case! Again, it is completely random)

When the registration "fails" (i.e., returns false because an "HTTP" prefix is already registered), then the WebRequest can create requests for HTTP. It is as if calling RegisterPrefix "wakes up" the static constructor and let it run.

I am perplexed: it seems like a race condition in the execution of the static constructor of WebRequest, but this does not make sense (the runtime protects static constructors with a lock, IIRC)

What am I missing? How could I solve or work around this problem? Is it my fault (misunderstanding or missing something), or does it look like a Mono bug, so should I submit it?

modified 16-Dec-22 4:27am.

AnswerRe: JWT vs Redis - to improve the performance of my application Pin
jschell13-Dec-22 10:42
jschell13-Dec-22 10:42 
QuestionCompare two remote git repositories Pin
_Flaviu17-Nov-22 21:10
_Flaviu17-Nov-22 21:10 
AnswerRe: Compare two remote git repositories Pin
Richard Deeming17-Nov-22 21:43
mveRichard Deeming17-Nov-22 21:43 
GeneralRe: Compare two remote git repositories Pin
_Flaviu17-Nov-22 21:52
_Flaviu17-Nov-22 21:52 
GeneralRe: Compare two remote git repositories Pin
Richard Deeming17-Nov-22 21:58
mveRichard Deeming17-Nov-22 21:58 
GeneralRe: Compare two remote git repositories Pin
infantformula218-Dec-22 6:17
infantformula218-Dec-22 6:17 
GeneralRe: Compare two remote git repositories Pin
Richard Deeming18-Dec-22 20:53
mveRichard Deeming18-Dec-22 20:53 
AnswerRe: Compare two remote git repositories Pin
jschell12-Dec-22 10:29
jschell12-Dec-22 10:29 
Question? where should I go ? Pin
pitwi17-Nov-22 10:35
pitwi17-Nov-22 10:35 
AnswerRe: ? where should I go ? Pin
Richard Deeming17-Nov-22 21:41
mveRichard Deeming17-Nov-22 21:41 
AnswerRe: ? where should I go ? Pin
Gerry Schmitz18-Nov-22 4:32
mveGerry Schmitz18-Nov-22 4:32 
AnswerRe: ? where should I go ? Pin
pitwi19-Nov-22 23:39
pitwi19-Nov-22 23:39 
AnswerRe: ? where should I go ? Pin
Waynegi8-Dec-22 23:38
Waynegi8-Dec-22 23:38 
QuestionFinancial/Accounting Data warehouse model design - need advice!!! Pin
Trang T10-Nov-22 17:28
Trang T10-Nov-22 17:28 
AnswerRe: Financial/Accounting Data warehouse model design - need advice!!! Pin
Gerry Schmitz20-Nov-22 5:25
mveGerry Schmitz20-Nov-22 5:25 
QuestionWhat Languages/Frameworks are Modern Commercial Windows Applications Made With? Pin
Peter Moore - Chicago9-Nov-22 10:40
Peter Moore - Chicago9-Nov-22 10:40 
AnswerRe: What Languages/Frameworks are Modern Commercial Windows Applications Made With? Pin
Gerry Schmitz20-Nov-22 5:32
mveGerry Schmitz20-Nov-22 5:32 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.